I was hoping to get some help in modelling the following logic as an MIP Constraint

If $X_{ij}=1$ and $\text{SDV}_{ikj}=1$ for a particular index $i$, then $\text{SOC}^L_i=100$, else $\text{SOC}^L_i$ can take any value.

$X_{ij}$ and $\text{SDV}_{ikj}$ are binary decision variables, while $\text{SOC}^L_i$ is a system variable.

I figured it would use some kind of Big M formulation but I am not sure how. Thank you in advance!


$$\text{SOC}_i^L \ge 100 - M \times (1- X_{i,j}) - M \times (1- \text{SDV}_{i,k,j})$$ $$\text{SOC}_i^L \le 100 + M \times (1- X_{i,j}) + M \times (1- \text{SDV}_{i,k,j})$$

When $X_{i,j} = 1$ and $SDV_{i,k,j} = 1$ the two equations above will end up becoming:

$$\text{SOC}_i^L \ge 100 $$ $$\text{SOC}_i^L \le 100 $$

Otherwise, the range of $\text{SOC}_i^L$ will be $[-M, +M]$.

  • $\begingroup$ Thank you @anoop !! $\endgroup$ – gravityman123 Jan 28 '20 at 8:59

More generally, if $s\in[L,U]$, you can model $(x=1 \land y=1) \implies s=C$ (constant $C$) as follows: $$ x + y - 1 \le z\\ (L-C)(1-z) \le s - C \le (U-C)(1-z)\\ z\in\{0,1\} $$ This approach introduces an additional binary variable and constraint beyond @anoopyadav's model but avoids $2M$.

  • $\begingroup$ when $x =1 \wedge y=1$ range of $z$ is $[0,1]$ shouldn't it be $[1,1]$. $\endgroup$ – ooo Jan 28 '20 at 18:14
  • 1
    $\begingroup$ $(x=1 \land y=1)\implies 1\le z$, and the implication is only one direction. You do not need the converse $z=1 \implies (x=1 \land y=1)$. $\endgroup$ – RobPratt Jan 28 '20 at 19:27
  • $\begingroup$ will there be any problem if I add two more constrain $z \leq x$, $z \leq y$? now they are bounded as $[1,1]$ when $x=1 \wedge y=1$ $\endgroup$ – ooo Jan 29 '20 at 6:33
  • $\begingroup$ Those additional two constraints would enforce the converse so that, together with my first constraint, every feasible solution would satisfy $z= x y$ instead of just $z\ge x y$. If you have a lot of these $(x,y)$ pairs, then adding five constraints per pair when only three are needed could slow down the underlying LP solves. $\endgroup$ – RobPratt Jan 29 '20 at 13:22
  • $\begingroup$ ok, I did not know about that. $\endgroup$ – ooo Jan 29 '20 at 19:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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