3
$\begingroup$

I have a constraint in a linear programming formulation with two variables: $X \ge Y$

To which I want to apply the following if-else conditions:

if Y=1:
 X=1
else:
 X=0

Where $X$ and $Y$ are binary.

How can I fit this if-else into linear programming? Do I need to define another variable? It looks as an AND operation, between $X$ and $Y$.

D.W.
168k23 gold badges234 silver badges517 bronze badges
asked Dec 15, 2016 at 16:18
$\endgroup$

1 Answer 1

5
$\begingroup$

This can be expressed with just the equation $X=Y$. Since $X,Y$ are zero-or-one variables, the only possible assignments that are consistent with your condition are $X=Y=0$ and $X=Y=1$.

See Express boolean logic operations in zero-one integer linear programming (ILP) for many more boolean conditions and how to express them as linear inequalities.

answered Dec 15, 2016 at 18:14
$\endgroup$

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.