1

I'm trying to find the mathematical linearization of this constraint:

p = 0 if and only if s = 0

Where p is binary and s is an integer >= 0 (thus it cannot be treated as a binary!!!)

Thanks in advance to anyone willing to help.

1 Answer 1

1

The constraint:

  p = 0 if and only if s = 0
  p binary, s non-negative integer 

is sometimes written as:

 p = 0 <=> s = 0 

This can be restated as the set of implications:

  p = 0 => s = 0
  p = 1 => s >= 1

If your solver has support for indicator constraints this can be implemented as is. If not, we can write:

 p <= s <= U⋅p
 s ∈ {0,1,2,..,U}
 p ∈ {0,1}
  

Here U is an upper bound on s. Note that most likely, you will need to write this as two separate inequalities.

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

1 Comment

Thanks Erwin!!! Where would I be without your help!

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.