$ontext
This model demonstrates an issue wrt 2nd derivatives in GAMS.
The original formulation is slow, but a rewrite makes it fast.
In 23.3 this has been fixed for COINIPOPT, but for instance
MOSEK is still slow.
The fast formulation shows good performance with interior point
solvers like COINIPOPT and especially MOSEK. This model is convex.
Erwin Kalvelagen 2009
$offtext
Sets
i canning plants / seattle, san-diego /
j markets / new-york, chicago, topeka /
k multiplicity / 1*10000/
;
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,k) shipment quantities in cases
z total transportation costs in thousands of dollars ;
Positive Variable x ;
Equations
cost1 define objective function
cost2 define objective function
supply(i,k) observe supply limit at plant i
demand(j,k) satisfy demand at market j ;
scalar e /0.000001/;
* IFPRI VERSION NL + LINEAR
cost1 .. z =e= sum((i,j,k), x(i,j,k)*log(x(i,j,k)+e)) -
sum((i,j,k), x(i,j,k)*log(c(i,j)+e));
* EK VERSION NL ONLY
cost2 .. z =e= sum((i,j,k), x(i,j,k)*log((x(i,j,k)+e)/(c(i,j)+e)));
supply(i,k) .. sum(j, x(i,j,k)) =l= a(i) ;
demand(j,k) .. sum(i, x(i,j,k)) =g= b(j) ;
option limrow=0;
option limcol=0;
Model t1 /cost1,supply,demand/ ;
Model t2 /cost2,supply,demand/ ;
* Solve t1 using nlp minimizing z ;
Solve t2 using nlp minimizing z ;