# Questions tagged [logical-constraints]

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

76 questions
Filter by
Sorted by
Tagged with
70 views

### Creating constraints dynamically in pyomo abstract model

I have a networkX graph with few nodes and these nodes have attributes such as "demand". ...
56 views

### Constrained shift assignment problem using ilogcp solver can´t find an optimal solution

I´ve been trying to solve a contrained assignation problem given a set of constraints based in a real-world problem. I modeled the problem in AMPL as follows: ...
1 vote
90 views

### PULP : Constraint violation - multiple of expected value

I am developing a linear programming model in PULP that sends material from Origin Facilities to Transfer and Final Treatment Facilities. The objective function is based on summing the transport and ...
• 11
100 views

### which method has been used to automatically reformulate logical constraints in a standard MIP solver?

There are many of the formulations to linearize logical constraints by introducing new auxiliary binary or any appropriate variables and adding the corresponding constraints to the model. It can be ...
• 6,206
205 views

### Piecewise function with two variables

I have a square like region centered at the origin, which is divided into 4 sub-regions. Region 1 can formed from by the diagonal of a square, $x + y \leq 0$. Region 2 is formed by joining the center ...
• 133
102 views

### gurobi bigM constraint vs. epsilon

I am new to mathematical programming and I am trying to implement case specific constrains in Gurobi with Python. I am wondering about how I can implement my constraints in the fastest or most common ...
• 85
68 views

### Disjunctive Constraint , Using Binary Variable to Replace a If or condition

I am trying to use a binary variable based on an inequality. The value of binary variable $q$ is 1 or 0 based on the following equation. [ $q$ = \begin{cases} 0,& \text{if } b \geq \pi ,\\ 1,...
313 views

• 6,206
148 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 ...
• 33
408 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 =...
• 387
92 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 ...
• 109
45 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 ...
• 507
243 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 ...
• 533
452 views

• 2,219
384 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 - ...
• 294
204 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 ...
• 695
133 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 ...
• 117
192 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：
• 51
361 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 ...
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 \... • 117 3 votes 1 answer 369 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 ... • 117 3 votes 2 answers 252 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 ...