trigx.gms : Another Trigonometric Example

Description

```Another trigonometric problem from the LGO library (GO_test_2v_2c)

Find a solution to the system of nonlinear equations
x - sin(2x+3y) - cos(3x-5y) = 0
y - sin(x-2y)  + cos(x+3y)  = 0.

This is a 2-variable, 2-constraint global optimization test
problem in itself that could have (in fact, it has) multiple
solutions. Therefore we will determine the minimal norm solution
and iteratively increase the lower bound on the objective.
```

Small Model of Type : NLP

Category : GAMS Model library

Main file : trigx.gms

``````\$title Another Trigonometric Example (TRIGX,SEQ=388)

\$onText
Another trigonometric problem from the LGO library (GO_test_2v_2c)

Find a solution to the system of nonlinear equations
x - sin(2x+3y) - cos(3x-5y) = 0
y - sin(x-2y)  + cos(x+3y)  = 0.

This is a 2-variable, 2-constraint global optimization test
problem in itself that could have (in fact, it has) multiple
solutions. Therefore we will determine the minimal norm solution
and iteratively increase the lower bound on the objective.

Pinter, J D, Nonlinear optimization with GAMS/LGO.
Journal of Global Optimization 38 (2007), 79-101.

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

Variable obj, x, y;

Equation defobj, con1, con2;

* Define an objective function as the squared norm of the
* solution to the equations.
defobj.. obj =e= x*x + y*y;

con1..   x - sin(2*x + 3*y) - cos(3*x - 5*y) =e= 0;

con2..   y - sin(x - 2*y)   + cos(x + 3*y)   =e= 0;

Model m / all /;

solve m minimizing obj using nlp;

Set sol / sol1*sol10 /;

Parameter res;

option solPrint = on, optCr = 0, decimals = 6;

\$if not set TOL \$set TOL 1e-6
loop(sol\$(m.solveStat = 1 and m.modelStat <= 2),
res(sol,'obj')          = obj.l;
res(sol,'x')            = x.l;
res(sol,'y')            = y.l;
res(sol,'slack')        = obj.l - obj.lo;
res(sol,'m.objval')     = m.objval;
res(sol,'obj recalc')   = x.l*x.l + y.l*y.l;
res(sol,'con1 recalc')  = x.l - sin(2*x.l + 3*y.l) - cos(3*x.l - 5*y.l);
res(sol,'con2 recalc')  = y.l - sin(  x.l - 2*y.l) + cos(  x.l + 3*y.l);
res(sol,'defobj.slack') = defobj.slack + eps;
abort\$(abs(res(sol,'con1 recalc')) > %TOL%) 'Con1 violated', res;
abort\$(abs(res(sol,'con2 recalc')) > %TOL%) 'Con2 violated', res;
obj.lo = obj.l*1.1;
solve m minimizing obj using nlp;
);
display res;
``````
GAMS Development Corp.
GAMS Software GmbH

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