Hello,
I'm using GAMS interfaced with matlab, and I was wondering if it is possible to obtain a default output from gams in case the problem is infeasible?
By this I mean, that if problem is infeasible "result.l =e= 100000".
Thank you.
Default output for infeasible problems.
Re: Default output for infeasible problems.
Laurus,
GAMS has a robust data-handling capability for just such a need. Something like this will do it:
if {(m.modelStat eq 4),
result.L = 9999999;
};
But the model status can be many things, even for an infeasible model. There are nice compile-time constants to help keep that straight.
https://www.gams.com/latest/docs/UG_Gam ... Omodelstat
https://www.gams.com/latest/docs/UG_Gam ... eConstants
It might be better to bring the model status back to Matlab and use that more directly. For example, maybe you want to do the "usual" thing if the model status is %modelStat.optimal%, but something else in other cases.
scalar modStat;
solve m .....
modStat = m.modelStat;
* include modStat in the stuff you send to GDX and from there to Matlab
HTH,
-Steve
GAMS has a robust data-handling capability for just such a need. Something like this will do it:
if {(m.modelStat eq 4),
result.L = 9999999;
};
But the model status can be many things, even for an infeasible model. There are nice compile-time constants to help keep that straight.
https://www.gams.com/latest/docs/UG_Gam ... Omodelstat
https://www.gams.com/latest/docs/UG_Gam ... eConstants
It might be better to bring the model status back to Matlab and use that more directly. For example, maybe you want to do the "usual" thing if the model status is %modelStat.optimal%, but something else in other cases.
scalar modStat;
solve m .....
modStat = m.modelStat;
* include modStat in the stuff you send to GDX and from there to Matlab
HTH,
-Steve