# Questions tagged [binary-variable]

For questions that involve variables than can only take on one of two values, usually 0 or 1.

89 questions
Filter by
Sorted by
Tagged with
29 views

### Modeling an either-or-constraint

We would like to model a constraint for an assignment problem that dictates that either assign a specific subset of nodes $I\subset\mathcal{I}$ to a specific subset of nodes $J\subset\mathcal{J}$, or ...
1k views

### How can we write a binary variable as a power to a constant number?

Let $x_{i,j}$ be a two-dimensional binary variable. Is it possible to write $x_{i,j}$ as a power to a number? For example: $$1- 0.3^{x_{i,j}}$$
182 views

### Meaning of infeasible model: unsuccessful solving for an IP model with binary variables

For fun, I have modeled the Union-closed sets conjecture for a universe of a given size into a problem with binary variables. Each binary variable $x_k$ is the indicator of the set with elements ...
76 views

### Binary/integer variables get real values in docplex

I have an MILP model, in which I am handling all Big M constraints with add_if_then constraints (following this topic). I generate this model only once (to save time) and solve it iteratively with ...
101 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 ...
78 views

### Robust way to implement $(x=0) \Rightarrow (y=0)$, with $x$ nonnegative and $y$ binary

I am formulating a MILP in which there is a continuous variable x and a binary variable $y$. In the program formulation there are the following constraints: $Ay\leq x \leq By$ (with $0\leq A\leq B$). ...
73 views

### Are there examples where introducing clusters of binary variables provides a benefit for solving?

I have a larger model with a large number of binary variables among many others. For the purpose of this question, consider the effect that the binary variables impose on the model to be similar to ...
136 views

### Constraints like "max(column a + column b) == 2" are not DCP

I am struggling with the following constraint on a minimization problem cvx.max(z[:, i] + z[:, j]) == 2 where z is a Boolean ...
1 vote
74 views

### Taking derivatives of objective function with a binary variable to find minimum

I transform my minimization problem into one with only an objective function (no constraints). I only have one variable, which is binary. Can I derivate the objective and make it equal to 0 to find ...
52 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 ...
151 views

### Binary variable switch constraints

I have a set of binary variables $X = \{ x_1, x_2, x_3, ... x_N \}$ which are connect and used with the rest of the model. I want to define a set of binary variables which represents the change ...
228 views

### Constraint on groups of variables

Assume a LP/MILP with a large number of variables. It is easy to formulate constraints to group variables such that each variable in a group takes the same value, if we know which variables are in a ...
240 views

### mixed integer programming with if then statement for two binary sequences

I have two random binary sequences of the same size, denoted as P1 and P2 respectively here. Let's say they are both the size of ten, like P1 = [1,0,1,1,0,0,0,1,1,1], P2 = [0,1,1,0,0,1,0,0,1,1]. I ...
89 views

### How to make a constraint for consecutive zeros in the mixed integer programming problems

I intend to generate a binary sequence with a size of $N = 10$, for example, $[1, 0, 0, 0, 0, 1, 1, 1, 0, 0]$. The constraint is that when zero appears, it must appear for at least two consecutive ...
187 views

### How to construct my mixed integer programming problem with constraint of minimum consecutive ones

My target is to formulate a binary sequence with fixed size $N$ = 10, such as $[1, 0, 0, 0 ,1, 1, 0, 1, 0, 0]$. However, I want to constrain this sequence so that when 1 appears, it has to appear at ...
100 views

### Sources of Min-Cost Flow Models That Utilize Binary Variables for Transportation Networks

I am looking for articles that include min-cost flow models with binary variables for flow transportation like gas networks, traffic systems, heating systems. Is there any specific place(like OR ...
128 views

### What fraction of the search space has been searched for ILP?

Is there a way to make Gurobi output (an estimate of) how much of the search space has already been cut off as infeasible? If not with Gurobi are you aware of any binary only (912 of them) ILP solver ...
301 views

### Implement if-else without then part using int variables {0,1}

I have 6 binary variables $a_i$ for $i$ from 0 to 5. I would like to model the next if-else statement using only MILP constraints   if $(a_0+a_1+a_2)\mod 2=1$ then $(a_3+a_4+a_5) \mod 2 = 0$ I tried <...