1

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

RobPratt
  • 32,006
  • 1
  • 44
  • 84
Mike
  • 707
  • 7
  • 14

1 Answers1

2

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}

RobPratt
  • 32,006
  • 1
  • 44
  • 84
  • Thanks. may I ask about enforcing each separately? It seems that your explanation in the link is bidirectional concurrently. – Mike Apr 29 '23 at 15:42
  • Thank you again, this helps a lot. Also, thank you for editing my question. It is much clearer after editing. – Mike Apr 29 '23 at 17:14