3
$\begingroup$

$i$ is a set $1$ to $n$.

$j$ is a set $1$ to $m$.

$j$ and $k$ are from the same set such that $j\neq k$.

$c_{ij}$ is a parameter.

$x_{ij}$ is a binary variable.

How to model: If $$c_{ij}\cdot x_{ij} \ge c_{ik}, \forall i,j,k,j\neq k$$ then $$x_{ij} \ge x_{ik}, \forall i,j,k,j\neq k$$

The goal is to select $x_{ij}$ with the highest coefficient.

$\endgroup$

2 Answers 2

4
$\begingroup$

I suspect your quantifiers are misplaced and you instead want to enforce $$\bigwedge_{i,j,k,j\neq k} \left(c_{ij}x_{ij} \ge c_{ik} \implies x_{ij} \ge x_{ik}\right)$$ Equivalently, $$\bigwedge_{i,j,k,j\neq k} \left(x_{ij} < x_{ik} \implies c_{ij}x_{ij} < c_{ik} \right)$$ $$\bigwedge_{i,j,k,j\neq k} \left(\lnot x_{ij} \land x_{ik} \implies c_{ij}x_{ij} < c_{ik} \right)$$ Introduce constants $\epsilon > 0$ and $M_{ijk} = \max(c_{ij},0) - c_{ik} + \epsilon$ and binary variable $y_{ijk}$, and impose linear constraints \begin{align} (1 - x_{ij}) + x_{ik} - 1 &\le y_{ijk} \tag1\label1 \\ c_{ij}x_{ij} - c_{ik} + \epsilon &\le M_{ijk}(1 - y_{ijk}) \tag2\label2 \end{align} Constraint \eqref{1} enforces $\lnot x_{ij} \land x_{ik} \implies y_{ijk}$. Constraint \eqref{2} enforces $y_{ijk} \implies c_{ij}x_{ij}+ \epsilon \le c_{ik}$.


From your last sentence, maybe what you really want is much simpler: $$x_{ij} \ge x_{ik} \quad \text{for all $i,j,k$ such that $j \not= k$ and $c_{ij} > c_{ik}$}$$

$\endgroup$
2
  • $\begingroup$ Yes, your are right in your last sentence with a small change: $c_{ij} \ge c_{ik}$. What do you think is the way to achieve it? Is there a simpler way? I am sorry if I caused a confusion, I do not have a deep knowledge in logical constraints. $\endgroup$
    – user5245
    Commented Nov 19, 2022 at 22:17
  • 1
    $\begingroup$ In that case, the conditions depend on known constants, so you can express the constraint directly as $x_{ij} \ge x_{ik}$ with the specified conditions in the index set for the constraint. $\endgroup$
    – RobPratt
    Commented Nov 19, 2022 at 22:19
1
$\begingroup$

As I understand if $c_{ij}>c_{ik}$ then when $x_{ij}>= {c_{ik}\over c_{ij}}$ implies $x_{ij} = 1$ as ${c_{ik}\over c_{ij}}$ will be $[0,1]$. So in that case $x_{ij}>=x_{ik}$ is obvious and moot as $x_{ij}$ is binary and will be 1.
Game begins if ${c_{ik}\over c_{ij}} < 0$.
Then $x_{ij}$ can be $0$ or $1$. If $x_{ij}=0$ then need to ensure $x_{ik}=0$.
So introduce M (just big enough, say slightly larger than $\lvert{c_{ik}\over c_{ij}}\rvert$ and introduce a constraint
$x_{ik} <= {M+ {c_{ik}\over c_{ij}}\over M}$.
This ensures if ${c_{ik}\over c_{ij}} <0$ then $x_{ik} < 1$ and hence is $0$.

$\endgroup$

Your Answer

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