Hi,

I don’t know what kind of debugging you want to do but usually the equation listing in the listing file is a pretty good debugging tool if you visually need to inspect your constraints:

A Transportation Problem (TRNSPORT,SEQ=1)

Equation Listing SOLVE transport Using LP From line 66

---- cost =E= define objective function

cost… - 0.225*x(seattle,new-york) - 0.153*x(seattle,chicago) - 0.162*x(seattle,topeka) - 0.225*x(san-diego,new-york) - 0.162*x(san-diego,chicago) - 0.126*x(san-diego,topeka) + z =E= 0 ; (LHS = 0)

---- supply =L= observe supply limit at plant i

supply(seattle)… x(seattle,new-york) + x(seattle,chicago) + x(seattle,topeka) =L= 350 ; (LHS = 0)

supply(san-diego)… x(san-diego,new-york) + x(san-diego,chicago) + x(san-diego, topeka) =L= 600 ; (LHS = 0)

---- demand =G= satisfy demand at market j

demand(new-york)… x(seattle,new-york) + x(san-diego,new-york) =G= 325 ; (LHS = 0, INFES = 325 ****)

demand(chicago)… x(seattle,chicago) + x(san-diego,chicago) =G= 300 ; (LHS = 0, INFES = 300 ****)

demand(topeka)… x(seattle,topeka) + x(san-diego,topeka) =G= 275 ; (LHS = 0, INFES = 275 ****)

You can try to stop Cplex with a time limit or an iteration limit, but it still will take some time before Cplex checks the very first time for this limit.

Convert produces a scalar GAMS model with generic names x1,x2, … and e1, e2, … and a dict.txt that helps mapping back to original GAMS names. What we have done before is to replaces the generic names with the ones in dict.txt:

sed -n -e “s:^ ([ex][0-9]*) (.*):s/\1/\2/g:gp” dict.txt | sed -n “1!G;h;$p” > r.sed

sed -f r.sed gams.gms > names.gms

The file names.gms does not compile but is good to look at. If you need the resulting file to run, do

sed -n -e “y/(),-/____/” -e “s:^ ([ex][0-9]*) (.*):s/\1/\2/g:gp” dict.txt | sed -n ‘1!G;h;$p’ > r.sed

sed -f r.sed gams.gms > namesThatDoesCompile.gms

This works well as long as you don’t have original variable or equation names that match x[0-9]* or e[0-9]*:

Thanks to my colleague Stefan Vigerske who came up with the sed commands. BTW, GAMS ships the sed tool with its Windows distribution: c:\GAMS\win64\24.8\gbin\sed.exe

Hope this helps,

Michael