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.
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.