Description
In this model we attempt to solve a number of models that have generation errors of various types. We set the error limit and the sys12 switch to allow this non-default behavior. Contributor: Steve Dirkse, Nov 2004
Small Model of Type : GAMS
Category : GAMS Test library
Main file : badpt2.gms includes : badpt.inc [html]
$title 'Test acceptance of models with generation errors' (BADPT2,SEQ=179)
$onText
In this model we attempt to solve a number of models that have
generation errors of various types. We set the error limit
and the sys12 switch to allow this non-default behavior.
Contributor: Steve Dirkse, Nov 2004
$offText
$if not set TESTTOL $set TESTTOL 1e-6
scalar
tol / %TESTTOL% /;
* get the model definitions
$include badpt.inc
maxexecerror = 10;
option sys12 = 1;
scalar haveBaron / 0 /;
$if NOT SOLVER baron $goTo NO_BARON
haveBaron = 1;
option nlp = baron, optcr = 0, optca = 0;
$goTo HAVE_SOLVER
$label NO_BARON
$if NOT SOLVER pathnlp $exit
option nlp = pathnlp;
* bounds will cause PATHNLP to shift the initial iterate
* if the initial point it gets is bad
y.lo = -INF;
y.up = +INF;
$label HAVE_SOLVER
solve logzero using nlp min z;
if {haveBaron,
abort$(logzero.solvestat <> %solveStat.normalCompletion% or (logzero.modelstat > %modelStat.locallyOptimal% and logzero.modelstat <> %modelStat.feasibleSolution%)) 'wrong status codes';
abort$(logzero.numnopt <> 0) ' NONOPT flags set';
abort$(logzero.numinfes <> 0) 'INFEASIBLE flags set';
abort$(abs(x.l-1) > tol) 'bad solution: x.l ', x.l;
abort$(abs(z.l) > tol) 'bad solution: z.l ', z.l;
abort$(abs(f.l) > tol) 'bad solution: f.l ', f.l;
abort$(abs(g.l-1) > tol) 'bad solution: g.l ', g.l;
else
abort$(logzero.solvestat <> %solveStat.setupFailure% or logzero.modelstat <> %modelStat.noSolutionReturned%) 'wrong status codes';
};
execError=0;
solve divzero using nlp min z;
if {haveBaron,
abort$(divzero.solvestat <> %solveStat.normalCompletion% or divzero.modelstat <> %modelStat.optimal%) 'wrong status codes';
abort$(divzero.numnopt <> 0) ' NONOPT flags set';
abort$(divzero.numinfes <> 0) 'INFEASIBLE flags set';
abort$(abs(x.l-1) > tol) 'bad solution: x.l ', x.l;
abort$(abs(z.l+1) > tol) 'bad solution: z.l ', z.l;
abort$(abs(s.l) > tol) 'bad solution: s.l ', s.l;
abort$(abs(t.l-1) > tol) 'bad solution: t.l ', t.l;
else
abort$(divzero.solvestat <> %solveStat.setupFailure% or divzero.modelstat <> %modelStat.noSolutionReturned%) 'wrong status codes';
};