$title 'Test unbounded integer variables (MIP)' (PF4MIP,SEQ=596)
$ontext
With GAMS 23.1 the GAMS parameter PF4 was introduced to modify the default
upper bound on integer variables:
Pf4=0: The new default upper bound of +INF will be passed to the solver.
Pf4=1: The value of 100 instead of +INF will be passed to the solver. The
solvers will operate as with older GAMS versions. In addition messages
will be written to the log and listing to report on the number of
integer or semi-integer variables which had the new default bound of
+INF reset to 100.
PF4=2: The new default values of +INF will be used as with PF4=0. When a
solution is returned to GAMS and the level value of an integer variable
exceeds the old bound value of 100, a message will be written to the log
and listing.
PF4=3: The same as PF4=2 with an additional execution error issued if the
solution reports a level value greater than 100 for any integer variable
with a default bound of +INF.
Further, PF4=0,2,3 allow to set the lower bound of an integer variable to -INF.
This simple test checks that solvers are working correctly with PF4=0.
Contributor: Lutz Westermann, January 2013
$offtext
$if not set TOL $set TOL 1e-6
* The default is 1
$ife not %gams.pf4% == 1 $abort Default for pf4 should be 1
$onecho > test.gms
scalar rhs;
variable z;
integer variable y;
equation a,b;
a.. z =e= y;
b.. y =l= rhs;
model m /all/;
$offecho
$if not %GAMS.mip% == "" $echo option MIP = %GAMS.mip%; >> test.gms
$onecho >> test.gms
rhs = 150;
solve m max z use mip;
abort$(abs(z.l-150) > %TOL%) 'Objective value should be 150', z.l;
rhs = 200.5;
solve m max z use mip;
abort$(abs(z.l-200) > %TOL%) 'Objective value should be 200', z.l;
y.lo = -inf;
rhs = -41.1;
solve m max z use mip;
if( not m.solvestat = %Solvestat.Capability Problems%,
abort$(abs(z.l+42) > %TOL%) 'Objective value should be -42', z.l;
);
$offecho
* Check that everything works if pf4 is set to 0
$call gams test.gms lo=%GAMS.lo% pf4=0 iterlim=%gams.iterlim% reslim=%gams.reslim%
$if errorlevel 1 $abort Error in test.gms! Check test.lst!