3
$\begingroup$

So if I have some quantity bounded i.e $ 1-N \leq (p^i-p^{i+1}) \leq N-1,$ for $N\ge1 $. The quantity $p^i-p^{i+1}$ will be an integer as well.

I was trying to figure out how to pose the constraint so that if I have binary variable $b_i$, then $ b_i=\begin{cases} 0 & (p^i-p^{i+1}) =0 \\ 1 & (p^i-p^{i+1}) >0 \end{cases} $

I attempted to pose it as

$\begin{align} b_i \geq (p^i-p^{i+1})\\ M(p^i-p^{i+1}) \geq b_i, \end{align}$

for a large value of $M$ but this does not seem to be exactly what I'm looking for since the quantiy $(p^i-p^{i+1})$ could be negative.

Any suggestions would be greatly appreciated how to properly represent this constraint.

$\endgroup$

1 Answer 1

5
$\begingroup$

$$b_i \le p^i-p^{i+1} \le (N-1)b_i$$

$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.