dollar condition in MIP

Problems with syntax of GAMS
Post Reply
Posts: 1
Joined: 3 months ago

dollar condition in MIP

Post by Plzhelpme » 3 months ago

in my MIP program, I want to use an equation that looks like
cannotequal .. x('1','2')$(x('3','2')>0) =e= 0;
saying if x(3,2) is greater than zero, then x(1,2) will equal zero. However, this causes an error "Endogenous relational operations require model type "dnlp" ." What can I do to fix this? Thank you!

Posts: 190
Joined: 10 months ago

Re: dollar condition in MIP

Post by abhosekar » 3 months ago

Optimization problems are not solved sequentially as your normal code. Therefore, the condition you are trying to impose is not acceptable. This is not a GAMS problem, but in general, no optimization model allows this (you can see it as if your equation block changes based on some condition, the solver cannot identify/solve it).

You should read about big-M constraints to formulate such constraints. For convenience, let's call x('1', '2') as x and x('3','2') as y

Are these variables binary? do you imply also the opposite? if x is 1 then y is 0? If yes, you can write x + y =l= 1;

If not, you can declare a binary variable b that is 1 if y is greater than 0

y=l= Mb;

where M is a big constant (not too big). you can then use b to control x

x =l= M(1-b);

Hope this helps.

- Atharv

Post Reply