# Questions tagged [logical-constraints]

For questions about constraints that can be expressed in (usually propositional) logic.

52 questions
Filter by
Sorted by
Tagged with
44 views

### Write in ILP: If $x$ within range then $s=1$, else $0$

How can write the following function in LP: $$s= \begin{cases} 1 & 1 \leq x \leq C \\ 0 & \text{otherwise} \end{cases}$$ where $x$ takes only non-negative integers and $C$ is some large ...
276 views

### Model “if and only if” indicator constraints in Linear programming

Apologies if this question has been asked, but I haven't been able to find it. I'm modelling something with Gurobi and want to do the following: \begin{align}\text{cond} < \dfrac{1}{3} &\iff x =...
80 views

### MILP modelling on minimal disturbance of right-hand-side to make a linear system infeasible

I try to model the following problem: given $z\in\{0,1\}^m$ and a linear system $Ax\le b(z), x\in\Bbb R^n, A\in\Bbb R^{d\times n}, b(z)\in\Bbb R^{d}$, where $b(z)$ means that some entries of $b$ are ...
40 views

### How to write the following constraint? [duplicate]

I would like to write the following constraint, where $varBuyWater$ and $varSellWater$ are decision variables on how much water to buy and to sell. However, I do not want the solver to buy and sell ...
198 views

### Linearize x different of y in ILP

I am surprised I couldn't find an already written answer for my question in the internet. I want to linearize $x$ different of $y$ for two nonegative integer decision variables. I am not considering ...
429 views

227 views

### How to linearize the Min function while letting the binary variable to be fixed for x1==x2 as well?

As discussed here, the min function, i.e $X = \min\{x_1,x_2\}$, can be linearized as follows: \begin{align} X & \le x_1 \\ X & \le x_2 \\ X & \ge x_1 - ...
149 views

### Switching of decision variables to be equal to a certain decision variable according to a binary (indicator) variable

I would like to seek some advice on modeling the following: I have two integer decisions variables, $x, x'$, that are either equal or greater than zero and either of them is to be equated to a third ...
98 views

### Formulating these logical constraint in an ILP

I have these two constraints : $z \leq My$ $t \leq M'y$ where $z$ and $t$ are two integer variables $z, t\geq 0$, $y$ is a binary variable, and $M$, $M'$ are two big numbers. So basically these ...
114 views

### how to apply Big M to model the logic constraint （if-then-else）

I was hoping to get some help in modelling the following logic as an MIP Constraint c_{m,l}^{RC} is binary decision variable. Simplify it：
184 views

### Formulating the conditional constraint

I want to develop a model extension of capacitated location problem. The variables are a binary $x_i$ and a continuous $Q_i$. The following condition must be satisfied: if $x_i = 0$, $Q_i$ must be ...
126 views

I want to write the following constraint: Let $z$ be an integer variable such that $0\le z\le M$, and $t$ be a binary variable where $M$ denotes big-M. The logical constraint is as follows: if $z \... 1answer 153 views ### How to express this logical constraint for an ILP? I am trying to write an ILP for a problem but I have this logical constraint and I'm stuck. In my model I have: two binary variables:$x$and$y$One Integer variable:$z$The logical constraint I am ... 2answers 178 views ### Model “If, then” constraint How to model the following "If, then" type constraint? If$\sum\limits_{i \in I}x_i = 0$then$\sum\limits_{j \in J}x_{j} = n$where$x$are binary variables,$n$is a known parameter and$...
It is well-known that when we maximize a 1-norm, e.g., $\|Ax\|_1$, we can use binary variables and obtain a mixed-integer convex problem (otherwise maximizing 1-norm is non-convex). I am mentioning ...