miles01.gms : MILES test suite - basic option reading test

Description


Small Model of Type : GAMS


Category : GAMS Test library


Main file : miles01.gms

$title 'MILES test suite - basic option reading test' (MILES01,SEQ=278)

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 = 0;
y.up = pi/2;
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);
* older CMEX versions lack arccos
* ybar = arccos(sqrt(xbar)-2);
ybar = arctan(sqrt(1-sqr(sqrt(xbar)-2))/(sqrt(xbar)-2));
zbar = exp(ybar);

display a, xbar, ybar, zbar;

$onEcho > miles.opt
begin
norm   1  ! this is a trailing comment
itlimt = 1
end
$offEcho

$onEcho > miles.op2
begin
* itlimt 1
* crank down to get a precise solution
contol 1e-9
end
$offEcho

option mcp = miles;

m.optfile = 1;
solve m using mcp;
abort$(m.solvestat <> %solveStat.iterationInterrupt% or m.modelstat <> %modelStat.intermediateInfeasible%) 'unexpected MILES behavior';


m.optfile = 2;
solve m using mcp;
abort$(m.solvestat <> %solveStat.normalCompletion% or m.modelstat <> %modelStat.optimal%) 'unexpected MILES 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';