cplex06.gms : CPLEX test suite - multiobjective

Description

Tests the CPLEX multiobjective optimization features.

Contributor: Renke Kuhlmann, October 2020


Small Model of Type : GAMS


Category : GAMS Test library


Main file : cplex06.gms

$title 'CPLEX test suite - multiobjective test' (CPLEX06,SEQ=831)
$if not '%GAMS.lp%' == '' $set solver %GAMS.lp%
$if not set solver        $set solver cplex
$onText
Tests the CPLEX multiobjective optimization features.

Contributor: Renke Kuhlmann, October 2020
$offText

Variables x, y, z, z1, z2;
Equations obj_1, obj1, obj2, obj3, obj4, con1, con2;
obj_1.. z =e= 1.1 * z1 + z2;
obj1.. z1 =e= x;
obj2.. z2 =e= y;
obj3.. z2 =e= y;
obj4.. z1 =e= x;
con1.. 2 * x + y =l= 3;
con2.. 0.5 * x + y =l= 1.5;
x.lo = 0;
y.lo = 0;

Model m1 / obj_1, obj1, obj2, con1, con2 /;
Solve m1 using lp maximizing z;

abort$(x.l <> 1 or z1.l <> x.l) 'false value x';
abort$(obj1.l <> 0) 'false value obj1';
abort$(y.l <> 1 or z2.l <> y.l) 'false value y';
abort$(obj2.l <> 0) 'false value obj2';


file fcpx 'Cplex Option file' / %solver%.opt /;

m1.optfile=1;
putclose fcpx 'multobj 1';
Solve m1 using lp maximizing z;

abort$(x.l <> 1.5 or z1.l <> x.l) 'false value x';
abort$(obj1.l <> 0) 'false value obj1';
abort$(y.l <> 0 or z2.l <> y.l) 'false value y';
abort$(obj2.l <> 0) 'false value obj2';


putclose fcpx 'multobj 1' / 'objnabstol z1 0.5';
Solve m1 using lp maximizing z;

abort$(x.l <> 1) 'false value x';
abort$(z1.l <> 1) 'false value z1';
abort$(obj1.l <> 0) 'false value obj1';
abort$(y.l <> 1) 'false value y';
abort$(z2.l <> 1) 'false value z2';
abort$(obj2.l <> 0) 'false value obj2';


putclose fcpx 'multobj 1' / 'objnabstol z1 1.5';
Solve m1 using lp maximizing z;

abort$(x.l <> 0) 'false value x';
abort$(z1.l <> 0) 'false value z1';
abort$(obj1.l <> 0) 'false value obj1';
abort$(y.l <> 1.5) 'false value y';
abort$(z2.l <> 1.5) 'false value z2';
abort$(obj2.l <> 0) 'false value obj2';


* test with different objective ordering

Model m2 / obj_1, obj3, obj4, con1, con2 /;
Solve m2 using lp maximizing z;

abort$(x.l <> 1 or z1.l <> x.l) 'false value x';
abort$(obj4.l <> 0) 'false value obj4';
abort$(y.l <> 1 or z2.l <> y.l) 'false value y';
abort$(obj3.l <> 0) 'false value obj3';

m2.optfile=1;
putclose fcpx 'multobj 1';
Solve m2 using lp maximizing z;

abort$(x.l <> 1.5 or z1.l <> x.l) 'false value x';
abort$(obj4.l <> 0) 'false value obj4';
abort$(y.l <> 0 or z2.l <> y.l) 'false value y';
abort$(obj3.l <> 0) 'false value obj3';


putclose fcpx 'multobj 1' / 'objnabstol z1 0.5';
Solve m2 using lp maximizing z;

abort$(x.l <> 1) 'false value x';
abort$(z1.l <> 1) 'false value z1';
abort$(obj4.l <> 0) 'false value obj4';
abort$(y.l <> 1) 'false value y';
abort$(z2.l <> 1) 'false value z2';
abort$(obj3.l <> 0) 'false value obj3';


putclose fcpx 'multobj 1' / 'objnabstol z1 1.5';
Solve m2 using lp maximizing z;

abort$(x.l <> 0) 'false value x';
abort$(z1.l <> 0) 'false value z1';
abort$(obj4.l <> 0) 'false value obj4';
abort$(y.l <> 1.5) 'false value y';
abort$(z2.l <> 1.5) 'false value z2';
abort$(obj3.l <> 0) 'false value obj3';