cns06.gms : CNS model with globally unique solution

Description

```The following model has a globally unique solution even though it
is nonlinear.
Not all solvers will recognize that the solution is globally unique.
Equation e1 can be solved uniquely w.r.t. x1 because the function
exp is monotone.
Equation e2 can then be solved uniquely w.r.t. x2 even though it
is nonlinear in x1 since x1 has a unique nonzero value.
```

Small Model of Type : CNS

Category : GAMS Test library

Main file : cns06.gms

``````\$title CNS model with globally unique solution (cns06,SEQ=96)

\$ontext
The following model has a globally unique solution even though it
is nonlinear.
Not all solvers will recognize that the solution is globally unique.
Equation e1 can be solved uniquely w.r.t. x1 because the function
exp is monotone.
Equation e2 can then be solved uniquely w.r.t. x2 even though it
is nonlinear in x1 since x1 has a unique nonzero value.
\$offtext

\$if not set TESTTOL \$set TESTTOL 1e-6
scalar tol / %TESTTOL% /;

variable x1, x2;
equation e1, e2;

e1 .. exp(x1) =e= exp(1);
e2 .. x1 * x2 =e= 9;

model cns06 / all /;
option limrow = 0, limcol = 0;
solve cns06 using cns;
abort\$(cns06.solvestat <> %solvestat.NormalCompletion%
or (cns06.modelstat <> %modelstat.SolvedUnique%) and (cns06.modelstat <> %modelstat.Solved%))  'bad return codes';
abort\$(abs(x1.l-1) > tol)       'bad x1.l';
abort\$(abs(x2.l-9) > tol)       'bad x2.l';
abort\$(abs(e1.l-exp(1)) > tol)  'bad e1.l';
abort\$(abs(e2.l-9) > tol)       'bad e2.l';
``````
GAMS Development Corp.
GAMS Software GmbH

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