$title 'Test acceptance of models with generation errors' (BADPT4,SEQ=203) $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. The results are analyzed and any unacceptable results cause an error. 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; solve logzero using nlp min z; if {(logzero.solvestat = %solveStat.normalCompletion%), abort$(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(x.m) > tol) 'bad solution: x.m ', x.m; abort$(abs(z.l) > tol) 'bad solution: z.l ', z.l; abort$(abs(z.m) > tol) 'bad solution: z.m ', z.m; abort$(abs(f.l) > tol) 'bad solution: f.l ', f.l; abort$(abs(f.m-1) > tol) 'bad solution: f.m ', f.m; abort$(abs(g.l-1) > tol) 'bad solution: g.l ', g.l; abort$(abs(g.m-.5) > tol) 'bad solution: g.m ', g.m; else abort$(logzero.solvestat <> %solveStat.setupFailure% or logzero.modelstat <> %modelStat.noSolutionReturned%) 'wrong status codes'; }; $exit 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(x.m) > tol) 'bad solution: x.m ', x.m; abort$(abs(z.l+1) > tol) 'bad solution: z.l ', z.l; abort$(abs(z.m) > tol) 'bad solution: z.m ', z.m; abort$(abs(s.l) > tol) 'bad solution: s.l ', s.l; abort$(abs(s.m-1) > tol) 'bad solution: s.m ', s.m; abort$(abs(t.l-1) > tol) 'bad solution: t.l ', t.l; abort$(abs(t.m-.5) > tol) 'bad solution: t.m ', t.m; else abort$(divzero.solvestat <> %solveStat.setupFailure% or divzero.modelstat <> %modelStat.noSolutionReturned%) 'wrong status codes'; };