How to use non-binary variable in a conditional statement MILP Topic is solved

Problems with modeling
Post Reply
charlesuko
User
User
Posts: 3
Joined: 4 months ago

How to use non-binary variable in a conditional statement MILP

Post by charlesuko » 3 months ago

I have a conditional statement I want to implement in a MILP. A is a non-binary variable that has known upper and lower bounds. B is a known parameter. And C is a binary variable. How do I formulate the condition?

If A < B then C is 1 otherwise C is 0 or 1.

Is this possible? I am new to optimization using GAMS and i'm still figuring out how this works

User avatar
bussieck
Moderator
Moderator
Posts: 273
Joined: 2 years ago

Re: How to use non-binary variable in a conditional statement MILP

Post by bussieck » 3 months ago

Similar questions have been asked before. Search for "logic constraints" or "williams" (that's a name of an author for a book that teaches that). So here only a short answer: A<B => C=1 is equivalent to C=0 => A>B. This we can do with a linear constraint (and binary variable C): A > B - (B-A.lo)*C. If C=0 then A>B, if C=1 then A>A.lo which is a redundant constraint.

-Michael

Post Reply