1
$\begingroup$

I would like to seek some advice on modeling the following logical implications, where $\delta$ is a binary variable, $D_{j}$ and $A_{j}$ are nonnegative discrete variables, and $p_{j}$ are nonnegative discrete parameter values.

$$\delta = 1 \implies D_{j}+p_{j}\gt A_{j} \lor D_{j}+p_{j}\lt A_{j} \tag1\label1$$

$$D_{j}+p_{j}\gt A_{j} \lor D_{j}+p_{j}\lt A_{j} \implies \delta = 1 \tag2\label2$$

$\endgroup$
2
  • 1
    $\begingroup$ $\delta$ is a binary variable? $\endgroup$
    – prubin
    Apr 29 at 15:59
  • $\begingroup$ Yes, δ is a binary variable. Thank you $\endgroup$
    – Mike
    Apr 29 at 15:59

1 Answer 1

2
$\begingroup$

Apply the formulation given in https://or.stackexchange.com/a/2632/500 with $y=1-\delta$, $x=D_j-A_j$, and $b=-p_j$.

Assuming by “discrete” you mean that $D_j$ and $A_j$ are integer-valued, you can use a tolerance of $1$ (the $\delta$ in the linked answer).


If you want to enforce only $(1)$, introduce binary variables $\delta_1$ and $\delta_2$, and impose linear constraints: \begin{align} \delta &\le \delta_1 + \delta_2 \\ -D_j - p_j + A_j + 1 &\le M_1 (1-\delta_1) \\ D_j + p_j - A_j + 1 &\le M_2 (1-\delta_2) \end{align}

If you want to enforce only $(2)$, consider its contrapositive $$\delta = 0 \implies D_{j}+p_{j}\le A_{j} \land D_{j}+p_{j}\ge A_{j},$$ which you can enforce via \begin{align} D_j + p_j - A_j &\le M_3 \delta \\ -D_j - p_j + A_j &\le M_4 \delta \end{align}

$\endgroup$
2
  • $\begingroup$ Thanks. may I ask about enforcing each separately? It seems that your explanation in the link is bidirectional concurrently. $\endgroup$
    – Mike
    Apr 29 at 15:42
  • $\begingroup$ Thank you again, this helps a lot. Also, thank you for editing my question. It is much clearer after editing. $\endgroup$
    – Mike
    Apr 29 at 17:14

Your Answer

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