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.
No comments:
Post a Comment