Conditions in equations (Making a decision variable 0, if it is not greater than a particular value)

Problems with modeling
Post Reply
jonkaneshiro
User
User
Posts: 2
Joined: 7 years ago

Conditions in equations (Making a decision variable 0, if it is not greater than a particular value)

Post by jonkaneshiro »

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!
User avatar
bussieck
Moderator
Moderator
Posts: 1033
Joined: 7 years ago

Re: Conditions in equations (Making a decision variable 0, if it is not greater than a particular value)

Post by bussieck »

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/usergu ... sVariables):

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
Post Reply