cns10.gms : CNS model - solvable, singular

Description

Solvable, singular model with feasible starting point
Apart from the start point, identical to cns09


Small Model of Type : CNS


Category : GAMS Test library


Main file : cns10.gms

$title CNS model - solvable, singular (cns10,SEQ=100)

$onText
  Solvable, singular model with feasible starting point
  Apart from the start point, identical to cns09
$offText

$if not set TESTTOL $set TESTTOL 1e-6
scalar tol / %TESTTOL% /;
$if not set SLOWOK $set SLOWOK 0
scalar slowOK 'slow solves are OK: just abort.noerror in this case' / %SLOWOK% /;
scalar havesol / 0 /;

variable x, y;
equation e1, e2;

e1 .. x+y =e= 1;
e2 .. x+y =e= 1;

model m / all /;
option limrow = 0, limcol = 0;

x.l = 0.5;  y.l = 0.5;
solve m using cns;
abort.noError$[slowOK and %solveStat.resourceInterrupt% = m.solvestat] 'Solve too slow';
abort$(m.solvestat <> %solveStat.normalCompletion%) 'bad solvestat', m.solvestat;
if   { (m.modelstat = %modelStat.locallyInfeasible%),
* locally infeasible, should report a row that way
  abort$(m.numinfes < 1)                            'wrong .numinfes';
elseif (m.modelstat = %modelStat.solvedSingular%),
* solved singular, should indicate that one dependency exists
  havesol = 1;
  abort$(m.numdepnd <> 1)                           'wrong .numdepnd';
else
  havesol = 1;
  abort$(m.modelstat <> %modelStat.solved%) 'bad modelstat', m.modelstat;
};
if {havesol,
  abort$(abs(x.l+y.l-1) > tol)       'bad x.l+y.l';
  abort$(abs(e1.l-1) > tol)          'bad e1.l';
  abort$(abs(e2.l-1) > tol)          'bad e2.l';
};