New answers tagged logical-constraints
6
votes
Accepted
Is it possible to do a linearization without introducing new variables?
You want to enforce
$$\bigvee_m x_{i,j}^{m,r} \implies w_j^r = w_i^r + \sum_{m} y_j^{m,r} - \sum_{m} z_j^{m,r} \quad \text{for all $r,i,j$}$$
Rewriting in conjunctive normal form leads to linear big-M ...
3
votes
Accepted
Formulation of binary constraint with the least binary variables for linear programming
You want to impose the following two logical constraints:
$$
\begin{align}
\delta_{t-1} = 1 \wedge \delta_t = 0 &\implies \beta_t = 1 \tag{1} \\
\neg (\delta_{t-1} = 1 \wedge \delta_t = 0) &\...
2
votes
Linearizing if else conditions in ILP
Besides @RobPratt's answer, the first condition would be (for simplicity I omitted indices $i$ and $j$ and continued with only two $y$ variables:
$$ x \implies (y_1 \oplus y_2) $$
$$ \lnot x \lor (y_1 ...
2
votes
Accepted
Linearizing if else conditions in ILP
Your first constraint enforces more than was asked. When $X_{ij}=0$, it forces $\sum_k Y_{jk}=0$, hence $Y_{jk}=0$ for all $k$. To enforce only $$X_{ij}=1 \implies \sum_k Y_{jk}=1,$$ you can instead ...
2
votes
Accepted
Activating a sequence of the binary variables in a multi-dimensional array
Introduce an ordering $\text{ord}: I \to \{1,\dots,|I|\}$ and impose
$$x_i \le x_j$$
for all $i\in I$ and $j\in I$ such that $\text{ord}_i + 1 = \text{ord}_j$.
An alternative, less efficient, approach ...
Top 50 recent answers are included
Related Tags
logical-constraints × 122mixed-integer-programming × 58
modeling × 55
integer-programming × 35
linearization × 31
binary-variable × 31
linear-programming × 28
constraint × 25
indicator-constraints × 20
optimization × 17
constraint-programming × 10
big-m × 9
gurobi × 7
python × 5
combinatorial-optimization × 4
nonlinear-programming × 4
cplex × 3
solver × 2
reference-request × 2
graphs × 2
pulp × 2
ampl × 2
chance-constraints × 2
continuous-optimization × 2
scheduling × 1