# Tag Info

## New answers tagged constraint

4

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); } ...

9

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

4

You could try and get rid of variables $Y_{p,t,j,c}$: remove constraints $(6)-(7)$; constraints $(6)$ simply link $x$ and $Y$ variables, so removing them should not have any impact on the feasibility of the solution (assuming you remove $Y$ variables) ; constraints $(7)$ are not mandatory if my understanding is correct replace constraints $(5)$ by \sum_{... 10 Let x_{p,\ell} be the continuous variables in your table. Introduce integer variables y_{p,\ell} and binary variables z_{p,\ell}, and impose linear constraints \begin{align} -z_{p,\ell} \le x_{p,\ell} - y_{p,\ell} &\le z_{p,\ell} &&\text{for all p and \ell} \tag1 \\ \sum_\ell z_{p,\ell} &\le 1 &&\text{for all p} \tag2 \... 6 A variable that can assume values of zero or between some lower and upper bound is called a semi-continuous variable. Most high-end solvers have direct support for this type of variable. If not supported, you can model this with an additional binary variable:\begin{align} & \color{darkblue}L\cdot \color{darkred}\delta \le \color{darkred}x \le \color{...

Top 50 recent answers are included