mathopt3.gms : MathOptimizer Example 3

Description

```A larger example with several constraints.

```

References

• Mathematica, MathOptimizer - An Advanced Modeling and Optimization System for Mathematica Users.
• Pinter, J D, Global Optimization in Action - Continuous and Lipschitz Optimization: Algorithms, Implementations, and Applications. Kluwer Acadameic Publishers, Nonconvex Optimization and Its Applications, 1996.
• Pinter, J D, Computational Global Optimization in Nonlinear Systems - An Interactive Tutorial. Lionheart Publishing, Atlanta, GA, 2001.

Small Model of Type : NLP

Category : GAMS Model library

Main file : mathopt3.gms

``````\$title MathOptimizer Example 3 (MATHOPT3,SEQ=257)

\$onText
A larger example with several constraints.

Mathematica, MathOptimizer - An Advanced Modeling and Optimization System
for Mathematica Users, http://www.wolfram.com/products/applications/mathoptimizer/

Janos D Pinter, Global Optimization in Action, Kluwer Academic Publishers,
Dordrecht/Boston/London, 1996.

Janos D Pinter, Computational Global Optimization in Nonlinear Systems,
Lionheart Publishing, Inc., Atlanta, GA, 2001

Keywords: nonlinear programming, mathematics, global optimization
\$offText

Variable x1, x2, x3, x4, x5, x6, obj;

Equation defobj, eq1, eq2, eq3, eq4, ineq1, ineq2, ineq3;

defobj.. obj =e= sqr(x1 + x2) + sqr(x3 - x5) + sqr(x6 - x4)
+  2*sqr(x1 + x3 - x4) + sqr(x2 - x1 + x3 - x4)
+  10*sqr(sin[x5 - x6 + x1]);

eq1..    sqr(x1) - sin[x2] - x4 + x5 + x6 =e= 0;

eq2..    x1*x3 - x2*x4*x1 - x5 - sin[x6 - x1 - x3] =e= 0;

eq3..    x2*x6*cos[x5] - sin[x3*x4] + x2 - x5 =e= 0;

eq4..    x1*x2 - sqr(x3) - x4*x5 - sqr(x6) =e= 0;

ineq1..  2*x1 + 5*x2 + x3 + x4  - 1 =l= 0;

ineq2..  3*x1 - 2*x2 + x3 - 4*x4    =l= 0;

ineq3..  x1 + x2 + x3 + x4 + x5 + x6 - 2 =l= 0;

Model m / all /;

* most local solvers will find the global solution from this starting point
* x1.l = 1; x2.l = -2; x3.l = 1; x4.l = 2; x5.l = 1; x6.l = -1;
* solve m using nlp min obj;

x1.l = 10; x2.l = -10; x3.l = 10; x4.l = 10; x5.l = 10; x6.l = -10;

solve m using nlp min obj;

Parameter report 'diff from global solution';
report('x1') = round(0 - x1.l,6);
report('x2') = round(0 - x2.l,6);
report('x3') = round(0 - x3.l,6);
report('x4') = round(0 - x4.l,6);
report('x5') = round(0 - x5.l,6);
report('x6') = round(0 - x6.l,6);

display report;
``````