Sunday, May 25, 2008

GAMS/Convert bug

To export GAMS models with semi-continuous variables to MPS files the tool GAMS/Convert can be used. However note that semi-continuous variables with lower bound = upper bound are exported incorrectly. Consider the small example:

semicont variable x;
variable y;
equation e;

y.lo=0;
x.fx=1;

e.. y =e= x;

model m /e/;
solve m minimizing y using mip;
The solution is x=0.

Convert generates the following MPS file:
ROWS
N obj
E c1
COLUMNS
sc1 c1 -1
x2 obj 1
x2 c1 1
RHS
BOUNDS
FX bnd sc1 1
ENDATA
In this MPS file column sc1 corresponds to GAMS variable x. However, this representation excludes sc1=0 as sc1 is fixed to one using FX. The correct MPS representation should look like:

ROWS
N obj
E c1
COLUMNS
sc1 c1 -1
x2 obj 1
x2 c1 1
RHS
BOUNDS
LO bnd sc1 1
SC bnd sc1 1
ENDATA
Work around: use the Cplex option writemps to create an MPS file. This will generate correct MPS files with fixed semi-continuous variables.