$TITLE Test of flipping equations with equilibrium (FLIPPER, SEQ=50)
$ontext
Test to verify that the flip operator is working as expected when used
with the equilibrium keyword. We expect that the MCP generated by
JAMS with the flip in the info file will be identical to the unflipped
version. To test this we check that the expected solution is accepted
as such with an iterlim of 0.
Contributors: Steve Dirkse and Michael Ferris, June 2010
$offtext
$call gamslib -q trnsport
$include trnsport.gms
* change data to make non-degenerate and nonzero supply.m
d('seattle','new-york') = 1.5;
d('seattle','chicago') = 0.7;
c(i,j) = f * d(i,j) / 1000 ;
* resolve the LP to get known solution
Solve transport using lp minimizing z ;
file e /'%emp.info%'/;
* solve using EMP without flipping any equations to check that the LP
* solution also solves the generated MCP
put e;
put / 'equilibrium';
put / 'min z x';
put / 'cost';
put / 'supply';
put / 'demand';
putclose;
transport.iterlim = 0;
solve transport using emp;
abort$[transport.modelstat > 2] 'bad model status', transport.modelstat;
abort$[transport.solvestat <> 1] 'bad solve status', transport.solvestat;
* solve using EMP with a flip and verify the unflipped solution solves
* the flipped version too
put e;
put / 'equilibrium';
put / 'min z x';
put / 'cost';
put / '-supply';
put / 'demand';
putclose;
transport.iterlim = 0;
solve transport using emp;
abort$[transport.modelstat > 2] 'bad model status', transport.modelstat;
abort$[transport.solvestat <> 1] 'bad solve status', transport.solvestat;
* solve using EMP, again without flipping any equations
* this checks that the solution of the flipped model was returned as expected
put e;
put / 'equilibrium';
put / 'min z x';
put / 'cost';
put / 'supply';
put / 'demand';
putclose;
transport.iterlim = 0;
solve transport using emp;
abort$[transport.modelstat > 2] 'bad model status', transport.modelstat;
abort$[transport.solvestat <> 1] 'bad solve status', transport.solvestat;