mathopt4.gms : MathOptimizer Example 4

Description

```This the 4th example from Mathematica and LGO. The global solution is at x = 0.

More information at http://www.wolfram.com/products/applications/mathoptimizer/
```

Small Model of Type : NLP

Category : GAMS Model library

Main file : mathopt4.gms

``````\$title MathOptimizer Example 4 (MATHOPT4,SEQ=258)

\$onText
This the 4th example from Mathematica and LGO. The global solution is at x = 0.

More information at http://www.wolfram.com/products/applications/mathoptimizer/

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

\$eolCom //

Variable x1, x2, obj;

Equation objdef, eq1, ineq1;

objdef.. obj =e= sqr(2*sqr(x1) - sqr(x2)) + sqr(x2 - 6*sqr(x1));

eq1..    x1  =e= 10*x2 + 100*sin(2*x1 + 3*x2);

ineq1..  x2 + x1 =l= 2;

Model m / all /;

x1.lo = -10; x2.lo = -10;
x1.up =  10; x2.up =  10;

Set row / one, two, three, global /;

Parameter report(row,*) 'summary solution report';
x1.l = -4; x2.l = -2; // leads to local solution
report('one','x1_0') = x1.l;
report('one','x2_0') = x2.l;

solve m using nlp min obj;

report('one','x1.l') = x1.l;
report('one','x2.l') = x2.l;
report('one','modelstat') = m.modelStat;

x1.l = -2; x2.l = -1; // leads to local optimum
report('two','x1_0') = x1.l;
report('two','x2_0') = x2.l;

solve m using nlp min obj;

report('two','x1.l') = x1.l;
report('two','x2.l') = x2.l;
report('two','modelstat') = m.modelStat;

x1.l = 1; x2.l = -1; // leads to global optimum
report('three','x1_0') = x1.l;
report('three','x2_0') = x2.l;

solve m using nlp min obj;

report('three','x1.l') = x1.l;
report('three','x2.l') = x2.l;
report('three','modelstat') = m.modelStat;

x1.l = 0; x2.l = 0; // is the global optimum
report('global','x1_0') = x1.l;
report('global','x2_0') = x2.l;

solve m using nlp min obj;

report('global','x1.l') = x1.l;
report('global','x2.l') = x2.l;
report('global','modelstat') = m.modelStat;

Acronym global;
report(row,'status')\$((abs(report('global','x1_0') - report(row,'x1.l'))
+abs(report('global','x2_0') - report(row,'x2.l'))) < 1e-6) = global;

display report;
``````
GAMS Development Corp.
GAMS Software GmbH

General Information and Sales
U.S. (+1) 202 342-0180
Europe: (+49) 221 949-9170