0

I am solving an integer programming problem with the condition

if a=0 then b=0 else b=1

where a is integer while b is binary

I looked on previous question similar to this but could not find solution. please help to define constraint equation in integer programming for above conditions.

2
  • What types are they? Commented Dec 5, 2016 at 17:27
  • a is integer while b is binary Commented Dec 5, 2016 at 17:33

2 Answers 2

1

The first constraint is easy: a=0 ⇒ b=0 can be written as a ≥ b. The second constraint (a ≥ 1 ⇒ b=1) is more complicated. If a ≤ M where M is relatively small, then you can write this as M ⋅ b ≥ a. Otherwise, you will need to use a solver feature called indicator constraints.

Sign up to request clarification or add additional context in comments.

2 Comments

thanks for reply , constraint a ≥ b does not hold true if a is negative integer
Typically, there are no negative integers in Integer Programming. A lower bound of zero is assumed if not stated otherwise.
1

Use these two constraints:

a<=bM
b<=aM

where M is a big number (M>a). When a=0, the 1st constraint is redundant, 2nd one gonna impose b=0. If a>0 then 2nd constraint is redundant, but the 1st one gonna force the b gets the value of 1 (if M is enough big).

2 Comments

Since b is binary, you should simplify the second constraint to b <= a.
Greg, It was my misreading of your previous answer, I though the (dot) you put after M is a colon. Basically, I just anwsered what you already did.M is not necessary in the 2nd constraint as you mentioned.

Your Answer

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.