Friday, May 30, 2008

GAMS smin bug

The expression smin(s, xxx) over an empty set s may or may not return -INF. The following fragment from a real world scheduling model with a problem in its input data illustrates inconsistencies in how GAMS evaluates this.


set si /i1,i2/;
parameter duedateadj(si) /i1 10, i2 10/;
set k /k1,k2/;
parameter duration(si,k) / i1.k1 1 /;
 
parameters
   minduration(si)
   mintime(si)   "calculate in one step"
   mintime2(si)  "calculate in two steps"
;
 
mintime(si) = duedateadj(si)-smin(k$duration(si,k),duration(si,k));
 
minduration(si) =  smin(k$duration(si,k),duration(si,k));
mintime2(si) = duedateadj(si)-minduration(si);
 
display mintime, mintime2;


This should give the same result, however when we run it we see:

----     17 PARAMETER mintime  calculate in one step
 
i1 9.000,    i2  -INF
 
 
----     17 PARAMETER mintime2  calculate in two steps
 
i1  9.000,    i2 10.000


This is of course highly undesirable. In general I would try to prevent such situations by not using SMIN or SMAX over an empty set. As GAMS does not flag these occurences you will need to add explicit tests for this.

Update

This problem has been fixed in GAMS release 24,3,1 (july 2014).

No comments:

Post a Comment