Description
This model contains variables that are nearly fixed: x.lo < x.up but they are very close. This can cause issues if the assumption is made that x cannot be close to both x.lo and x.up. Contributor: Steve Dirkse, Nov 2024.
Small Model of Type : MCP
Category : GAMS Test library
Main file : mcp17.gms
$title MCP model with nearly-fixed variables (MCP17,SEQ=974)
$onText
This model contains variables that are nearly fixed:
x.lo < x.up but they are very close. This can cause issues if
the assumption is made that x cannot be close to both x.lo and x.up.
Contributor: Steve Dirkse, Nov 2024.
$offText
variable x, y;
equation fE, fN, fL, gE, gN, gG;
fE.. exp(x) =E= 3;
fN.. exp(x) =N= 3;
fL.. exp(x) =L= 3;
gE.. exp(y) =E= 2;
gN.. exp(y) =N= 2;
gG.. exp(y) =G= 2;
model
mE / fE.x, gE.y /
mN / fN.x, gN.y /
mM / fL.x, gG.y /
;
scalars
delta 'less than or equal to at-bound tolerance' / 8e-7 /
objval 'objval upper bound if initial point is also solution point' / 3e-7 /
;
x.lo = 1;
x.up = x.lo + delta;
x.l = (x.lo + x.up) / 2;
y.lo = 1;
y.up = y.lo + delta;
y.l = (y.lo + y.up) / 2;
solve mE using mcp;
abort$[mE.modelStat <> %modelStat.optimal%] 'bad mE.modelStat', mE.modelStat;
abort$[mE.solveStat <> %solveStat.normalCompletion%] 'bad mE.solveStat', mE.solveStat;
abort$[mE.objval >= objval] 'bad mE.objval', mE.objval, objval;
abort$[mE.maxinfes <> 0] 'mE.maxinfes should be zero', mE.maxinfes;
abort$[mE.numinfes <> 0] 'mE.numinfes should be zero', mE.numinfes;
abort$[mE.suminfes <> 0] 'mE.suminfes should be zero', mE.suminfes;
* with =E=, we get a REDEF: the equation is not satisfied as an equality
abort$[mE.numredef <> 2] 'mE.numredef should be two', mE.numredef;
solve mN using mcp;
abort$[mN.modelStat <> %modelStat.optimal%] 'bad mN.modelStat', mN.modelStat;
abort$[mN.solveStat <> %solveStat.normalCompletion%] 'bad mN.solveStat', mN.solveStat;
abort$[mN.objval >= objval] 'bad mN.objval', mN.objval, objval;
abort$[mN.maxinfes <> 0] 'mN.maxinfes should be zero', mN.maxinfes;
abort$[mN.numinfes <> 0] 'mN.numinfes should be zero', mN.numinfes;
abort$[mN.suminfes <> 0] 'mN.suminfes should be zero', mN.suminfes;
* with =N=, we never get a REDEF. People should use these more.
abort$[mN.numredef <> 0] 'mN.numredef should be zero', mN.numredef;
solve mM using mcp;
abort$[mM.modelStat <> %modelStat.optimal%] 'bad mM.modelStat', mM.modelStat;
abort$[mM.solveStat <> %solveStat.normalCompletion%] 'bad mM.solveStat', mM.solveStat;
abort$[mM.objval >= objval] 'bad mM.objval', mM.objval, objval;
abort$[mM.maxinfes <> 0] 'mM.maxinfes should be zero', mM.maxinfes;
abort$[mM.numinfes <> 0] 'mM.numinfes should be zero', mM.numinfes;
abort$[mM.suminfes <> 0] 'mM.suminfes should be zero', mM.suminfes;
* this solution does not give a REDEF: =L= perp-to x-at-up, =G= perp-to y-at-lo
abort$[mM.numredef <> 0] 'mM.numredef should be zero', mM.numredef;