Description
Contributor: Michael Bussieck
Small Model of Type : GAMS
Category : GAMS Test library
Main file : gurobi04.gms
$title 'GUROBI test suite - multi objective' (GUROBI04,SEQ=712)
$onText
Contributor: Michael Bussieck
$offText
Sets
i canning plants / seattle, san-diego /
j markets / new-york, chicago, topeka / ;
Parameters
a(i) capacity of plant i in cases
/ seattle 350
san-diego 600 /
b(j) demand at market j in cases
/ new-york 325
chicago 300
topeka 275 / ;
Table d(i,j) distance in thousands of miles
new-york chicago topeka
seattle 2.5 1.7 1.8
san-diego 2.5 1.8 1.4 ;
Scalar f freight in dollars per case per thousand miles /90/ ;
Parameter c(i,j) transport cost in thousands of dollars per case ;
c(i,j) = f * d(i,j) / 1000 ;
Variables
x(i,j) shipment quantities in cases
tcost total transportation costs in thousands of dollars
pSeattle total production in Seattle
z combined objective function;
Positive Variable x ; x.up(i,j) = 1e5;
Equations
defobj define objective function
defcost define objective function
defpSeattle define total production in Seattle
supply(i) observe supply limit at plant i
demand(j) satisfy demand at market j ;
Scalar psDirection optimization direction for production in Seattle;
defobj .. z =e= tcost + psDirection*0.1*pSeattle;
defcost .. tcost =e= sum((i,j), c(i,j)*x(i,j)) ;
defpSeattle .. pSeattle =e= sum(j, x('Seattle',j)) ;
supply(i) .. sum(j, x(i,j)) =l= a(i) ;
demand(j) .. sum(i, x(i,j)) =g= b(j) ;
Model transport /all/ ;
$ echo multobj 1 > gurobi.opt
option solver=gurobi;
transport.optfile = 1;
* Maximize production in Seattle
psDirection = -1;
Solve transport using mip minimizing z ;
abort$(transport.modelstat <> 1) 'expect optimal solution';
abort$(abs(pSeattle.l-350)>1e-6) 'expect max production of 350 in Seattle', pSeattle.l;
* Minimize production in Seattle
psDirection = 1;
Solve transport using mip minimizing z ;
abort$(transport.modelstat <> 1) 'expect optimal solution';
abort$(abs(pSeattle.l-300)>1e-6) 'expect min production of 300 in Seattle', pSeattle.l;