Description
Contributor: Jan-H. Jagla, March 2011
Small Model of Type : GAMS
Category : GAMS Test library
Main file : empdisj5.gms
$title Test disjunctions using not on binary variable and constraint (EMPDISJ5,SEQ=517)
$onText
Contributor: Jan-H. Jagla, March 2011
$offText
$onEchoV > testm1.inc
abort$(abs(%1.objval-(-2.0))>1e-6) 'Objective value wrong [%1,%2]' , %1.objval;
abort$(abs(b.l-0.0) >1e-6) 'b.l wrong [%1,%2]' , b.l ;
abort$(abs(x.l-2.0) >1e-6) 'x.l wrong [%1,%2]' , x.l ;
$offEcho
variable z,x;
binary variable b;
equation obj1,obj2,e1,e2;
obj1.. z =e= -0.9*b - x;
e1.. x =l= 1;
x.up = 2;
$onEcho > jams.opt
Filename mymodel.gms
Dict mydoc.txt
$offEcho
model m1 / obj1,e1 /; m1.optcr=0; m1.optfile=1;
* Test with ConvexHull (default reformulation)
execute 'echo disjunction chull b e1 else not e1 > "%emp.info%"';
solve m1 us emp min z;
$batInclude testm1.inc m1 CHull
execute 'echo disjunction chull not b not e1 else e1 > "%emp.info%"';
solve m1 us emp min z;
$batInclude testm1.inc m1 CHull
* Test with bigM
execute 'echo disjunction bigM b e1 else not e1 > "%emp.info%"';
solve m1 us emp min z;
$batInclude testm1.inc m1 BigM
execute 'echo disjunction bigM not b not e1 else e1 > "%emp.info%"';
solve m1 us emp min z;
$batInclude testm1.inc m1 BigM
* Test with bigM and threshold 0 (means equalities will always be split)
* m1/m2 test only for the sake of completeness ( threshold has no impact on inequalities)
execute 'echo disjunction bigM 1e4 1e-4 0 b e1 else not e1 > "%emp.info%"';
solve m1 us emp min z;
$batInclude testm1.inc m1 BigM2
execute 'echo disjunction bigM 1e4 1e-4 0 not b not e1 else e1 > "%emp.info%"';
solve m1 us emp min z;
$batInclude testm1.inc m1 BigM2
$if not SOLVER cplex $goTo SCIP
* Test with Indicators and CPLEX
option mip=cplex;
execute 'echo disjunction indic b e1 else not e1 > "%emp.info%"';
solve m1 us emp min z;
$batInclude testm1.inc m1 Indic
execute 'echo disjunction indic not b not e1 else e1 > "%emp.info%"';
solve m1 us emp min z;
$batInclude testm1.inc m1 Indic
$label SCIP
$if not SOLVER scip $goTo XPRESS
* Test with Indicators and SCIP
option mip=scip;
execute 'echo disjunction indic b e1 else not e1 > "%emp.info%"';
solve m1 us emp min z;
$batInclude testm1.inc m1 Indic
execute 'echo disjunction indic not b not e1 else e1 > "%emp.info%"';
solve m1 us emp min z;
$batInclude testm1.inc m1 Indic
$label XPRESS
$if not SOLVER xpress $goTo DONE
* Test with Indicators and XPRESS
option mip=xpress;
execute 'echo disjunction indic b e1 else not e1 > "%emp.info%"';
solve m1 us emp min z;
$batInclude testm1.inc m1 Indic
execute 'echo disjunction indic not b not e1 else e1 > "%emp.info%"';
solve m1 us emp min z;
$batInclude testm1.inc m1 Indic
$label DONE