Thursday, October 11, 2012

GAMS/Gurobi QCP problems

Some quadratically constrained problems give incorrect results with GAMS/Gurobi:

variables z,x,y;
positive variables
x,y;
equation
e1,e2;
e1.. z =g= x*x+y;
e2.. x+y =g= 1;

model m /all/
;
solve m minimizing z using qcp;

The reported solution:

**** OBJECTIVE VALUE                0.8750

                       LOWER     LEVEL     UPPER    MARGINAL

---- VAR z              -INF      0.812     +INF  3.834E-12
---- VAR x               .        0.250     +INF  3.945E-11
---- VAR y               .        0.750     +INF  1.186E-13

is not correct. Somehow Gurobi receives a different problem with an extra term in the objective:

Minimize
  z + [ 2 x ^ 2 ] / 2
Subject To
e2: x + y >= 1
e1: z - y + [ - x ^ 2 ] >= 0
Bounds
z free
End

At this moment I don't have a workaround for this. No doubt this will be fixed quickly and a GAMS update will be released. Keep an eye on www.gams.com for this.

Note: the LP file was generated by using an option file with writeprob xxx.lp. The documentation for this option in http://www.gams.com/dd/docs/solvers/gurobi.pdf is somewhat terse. The type of file being written is determined by the extension. An lp file has a .lp extension, and similarly an mps file can be generated by using a file name of the form xxx.mps.

PS. the correct solution would be:

**** OBJECTIVE VALUE                0.7500

                       LOWER     LEVEL     UPPER    MARGINAL

---- VAR z              -INF      0.750     +INF       .
---- VAR x               .        0.500     +INF       .
---- VAR y               .        0.500     +INF       EPS