4
$\begingroup$

Let $0\le X\le\bar X$ and $0\le Y\le\bar Y$ be nonnegative continuous variables. Let $\epsilon$ be a small positive number. How can the constraint $X\ge\epsilon\implies X\ge Y$ be modeled?

$\endgroup$

2 Answers 2

10
$\begingroup$

Introduce binary variable $Z$ and linear constraints \begin{align} X - \epsilon &\le (\bar{X} - \epsilon) Z \tag1 \\ Y - X &\le (\bar{Y} - 0) (1-Z) \tag2 \\ \end{align} Constraint $(1)$ enforces $X > \epsilon \implies Z = 1$. Constraint $(2)$ enforces $Z = 1 \implies X \ge Y$.

$\endgroup$
4
$\begingroup$

With CPLEX you can use logical constraints. In OPL for instance you can write

float epsilon=0.01;

dvar float X;
dvar float Y;

subject to
{
  (X>=epsilon) => (X>=Y);
}

And if you wonder , logical constraints are available in OPL but also in all APIs.

float epsilon=0.01;

dvar float X; dvar float Y;

subject to { (X>=epsilon) => (X>=Y); }

main { thisOplModel.generate(); cplex.exportModel("exp.lp"); }

gives exp.lp

Minimize
 obj1: 0 x1 + 0 X + 0 x3 + 0 Y
Subject To
 i1: x1 = 1 <-> X => 0.01
 i2: x3 = 1 <-> X - Y => 0
 i3: x1 = 1 -> x3  = 1
Bounds
 0 <= x1 <= 1
      X Free
 0 <= x3 <= 1
      Y Free
Binaries
 x1  x3 
End
$\endgroup$
1
  • $\begingroup$ But this requires using OPL. Is there a way to see how CPLEX translates the statement to a set of constraints? I suppose the solution is then the same as stated by Rob Pratt? $\endgroup$
    – Clement
    Commented Sep 15, 2021 at 15:26

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