Hello,
I am trying to make a minimum value for a decision variable, but also want a constraint where it can be 0, if it is below the minimum.
I understand there is the $ conditional, but I can’t seem to get it work in GAMS.
For example:
Area(p,crop) =g= (minimum_value)$(Area(p,crop) > 0)
or,
Area(p,crop) =e= 0$(Area(p,crop) < (minimum_value))
Can anyone give me insight,
Thank you!
Anything in $(…) needs to exogenous, so you can’t use variables in there. You need to use a semicontinuous variable (see https://www.gams.com/latest/docs/userguides/userguide/_u_g__language_features.html#UG_LanguageFeatures_Semi-ContinuousVariables):
semicont variable area(p,crop);
area.lo(p,crop) = minimum_value;
It’s also pretty easy to accomplish this with a binary variable and a bigM constraint assuming your area variable has an explicit or implicit upper bound.
-Michael