Description
Small Model of Type : GAMS
Category : GAMS Test library
Main file : path01.gms
$title 'PATH test suite - basic option reading test' (PATH01,SEQ=260)
variable x, y, z;
equation f, g, h;
scalar a, xbar, ybar, zbar;
f.. exp(x) =N= a;
g.. cos(y) =N= sqrt(x) - 2;
h.. log(z) =N= y;
x.lo = 1e-6;
x.up = 20;
y.lo = pi * 1.5;
y.up = 2*pi;
z.lo = 1e-6;
model m / f.x, g.y, h.z /;
* this is not a tough model but it will take a few iterations
* to get a solution
a = 1000;
xbar = log(a);
* catch y where cos(y) is increasing & y is positive
* older CMEX versions lack arccos
* ybar = 2*pi-arccos(sqrt(xbar)-2);
ybar = 2*pi-(arctan(sqrt(1-sqr(sqrt(xbar)-2))/(sqrt(xbar)-2)));
zbar = exp(ybar);
display a, xbar, ybar, zbar;
* test the path option reading mode: first 3 chars are significant
$echo "maj_iterjjjjjj_limzzz 1" > path.opt
$echo "minor_iteration_limit 1" >> path.opt
$echo "* empty option file" > path.op2
option mcp = path;
m.optfile = 1;
solve m using mcp;
abort$(m.solvestat <> %solveStat.terminatedBySolver% or m.modelstat <> %modelStat.intermediateInfeasible%) 'unexpected PATH behavior';
m.optfile = 2;
solve m using mcp;
abort$(m.solvestat <> %solveStat.normalCompletion% or m.modelstat <> %modelStat.optimal%) 'unexpected PATH behavior';
abort$(abs(xbar-x.l) > 1e-7) 'bad x.l at solution';
abort$(abs(ybar-y.l) > 1e-7) 'bad y.l at solution';
abort$(abs(zbar-z.l) > 1e-7) 'bad z.l at solution';