# Questions tagged [logical-constraints]

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

111 questions
Filter by
Sorted by
Tagged with
338 views

### How to model a binary variable?

I am trying to find a constraint for the following relationship, but am failing a bit at it right now. I want to find a linear constraint that does the following. The binary variable $switch_{ot}$ is ...
829 views

### Rewriting if-then constraints of binary summations

Suppose both $x_{i,j}^{ab}$ and $y_{i,j}^a$ are binaries. Then how can I rewrite the following if-then in linear form? $\sum_b x_{i,j}^{ab} \ge 1 \implies \sum_{i,j} y_{i,j}^a = 0$ I was thinking of ...
1 vote
49 views

### Assistance in formulating implication constraints for inequalities

I would like to seek some advice on modeling the following logical implications, where $\delta$ is a binary variable, $D_{j}$ and $A_{j}$ are nonnegative discrete variables, and $p_{j}$ are ...
480 views

196 views

### Can we use continuous variables instead of binary variables in this NLP problem?

The following problem is defined with binary variables $a_{i1}, a_{i2}, a_{i3}, k_1$ and $k_2$. Is it possible to avoid binary variables and to only work with continuous variables? How would we ought ...
420 views

Consider the binary variables $x_1, x_2 \in \{0,1\}$ and the integer variable $y \in \mathbb{Z}$ with $0 \leq y \leq 3$. I'd like to formulate the following logical constraint: $$x_1 = 1 \wedge y \... 2 votes 1 answer 170 views ### Binary variable constraint for condition I am trying to solve the following task: If x=1 or y=0 then z=0 My approach: If z=0 then x+y \le 2 + Mz \implies x+y \le 2+2z \quad where M = 2 If z=1 then x+y=1 \\ \implies x+y \le 1, ... 0 votes 1 answer 54 views ### Conditional constraint for binary variables I would appreciate any help to solve the following task: If y=1 then x_i=1 for at least k of the possible indices i\in\{1,\cdots,n\} where k and n are parameters, x is a binary variable ... 2 votes 2 answers 73 views ### How to model this? i is a set 1 to n. j is a set 1 to m. j and k are from the same set such that j\neq k. c_{ij} is a parameter. x_{ij} and y_{j} are binary variables. How to model: If$$c_{ij}\... 238 views

### Binary variable constraint

The task is to ensure that if $x_i = 1$ for at least $k$ of the possible indices $i$ in $\{1,...,n\}$ then $y = 1$, where $k$ and $n$ are parameters, $x$ is a binary variable vector with $n$ elements, ...
263 views

### Binary variables constraint

What constraints would you write to ensure that if $x = 1$ then $y = 0$ where $x, y$ are binary variables? Until now I only learnt how to build the constraint with 3 binary variables, therefore the ...
69 views

How can I add to this ILP with all binary variables (again related to this question): $$\min \sum_{1\leq i<j\leq n-1-h} t_{i,j}$$ $$\sum_{i=1}^{n-1-h} a_{k,i} \ge \lfloor (n-1)/2\rfloor \qquad \... 5 votes 3 answers 611 views ### Constraint for two binary vectors to be different If I have a matrix A of binary variables a_{i,j}, 1 \le i \le n, 1 \le j \le m, how can I enforce in an Integer Linear Program with binary variables, the condition that every two columns must ... 3 votes 2 answers 98 views ### How to model if-then? i is a set 1 to n. j is a set 1 to m. j and k are from the same set such that j\neq k. c_{ij} is a parameter. x_{ij} is a binary variable. How to model: If$$c_{ij}\cdot x_{ij} \... 1 vote
194 views

### How to linearize this if-then constraint?

If $x \ge 1$ then $y = y + x$. And, if $x \le 0$ then $y = y$, where $x$ and $y$ are non-negative integer decision variables. I am using GLPK solver. How do I linearize this if-then constraint?
227 views

139 views

### Binary variable to indicate zero probabilities

I have a finite probability distribution $p_1, p_2, \ldots, p_n$ (but these are variables of an optimization problem). Moreover, we have monotonicity, $p_1 \geq p_2 \geq \cdots \geq p_n$. Assume we ...
212 views

### Disjunctive equality constraints: modelling

I have the following constraint in my model: $$x = 0 \lor \sum_{i=1}^n y_i = 3$$ where $x$ and $y_i$ are all binary variables. How this can be linearized by means of big-M notation? Should I include ...
914 views

### is prime? in Operations Research

Is there a way to linearize is prime? in Operations Research? is prime(n) being true if $n$ is a prime number or false otherwise....
64 views

### Ensure that scheduled repeating maintenance has to be completed

I'm trying to model the scheduling of maintenance in some machines, and was wondering how I could ensure that, if maintenance is planned to start in period $t$, then it has to be carried out until ...