Linked Questions
16 questions linked to/from In an integer program, how I can force a binary variable to equal 1 if some condition holds?
3
votes
0answers
38 views
Extract binary value from continuous variable [duplicate]
I have a continuous variable $c$ which has value in between $[-R, +R]$.
I want to create a boolean variable $x$ and,
$x = 1$ when $c = 1.0$ otherwise $x = 0$
In more general form:
$x = 1$ when $c \...
11
votes
2answers
834 views
In an integer program, how can I “activate” a constraint only if a decision variable has a certain value?
Suppose we have the constraint
$$a_1x_1 + \cdots + a_nx_n \gtreqless b,$$
where $a_i$ and $b$ are constants and $x_i$ are decision variables. Suppose also that we want the constraint to hold if $y=1$ (...
15
votes
1answer
2k views
How to formulate (linearize) a maximum function in a constraint?
How to formulate (linearize) a maximum function in a constraint? Suppose $C = \max \{c_1, c_2\}$, where both $c_1$ and $c_2$ are variables. If the objective function is minimizing $C$, then it can be ...
12
votes
1answer
1k views
If-then constraints in MIP programming
For continuous variables $x$ and $y$, the constraints are:
...
2
votes
3answers
333 views
Find the farthest point in hypercube to an exterior point
Let $\mathcal{U} = \{ [x_1, ..., x_n] \in \mathbb{R}^n : 0 \leq x_i \leq 1\}$ be the unit hypercube and $C \in \mathbb{R}^n\setminus\mathcal{U}$ fixed. Let us consider the following problem
$$ \max_{X ...
4
votes
2answers
178 views
Conditional Constraint in MIP
I need to formulate a conditional constraint for a binary variable z defined as:
$z_{i,j,k}$, $\ \ i=1:10 \ , \ j=1:5 \ , \ k=1:3$
If any $z_{i,j,3} = 1$ then $z_{i,j,1} + z_{i,j,2} = 0 \ \ \...
5
votes
2answers
291 views
How to model If $A \le B$ then $Y = 1$, otherwise $Y = 0$
Somehow I don't get it right.
I would like to model the following conditional:
If $A\le B$ then $Y=1$ otherwise $Y=0$
where $A, B$ are reals and $Y$ is binary.
I can model as follows:
$Y \cdot A \le B$...
10
votes
1answer
143 views
Conditional Controls in MIP Models
Innocently cross-posted at Mathematics SE
I am developing a model that operates in the realm of mixed integer programming, although I am fairly unfamiliar with this area of mathematics at the moment. ...
3
votes
2answers
294 views
Mocking up conditional statements in LP
I would like to know how if condition statements in linear programming can be reformulated using indicator constraints, and hence solved as a mixed integer linear program. Specifically:
1. Is it ...
9
votes
1answer
96 views
Binary variable to count appearances
Let $x \in \mathbb{R}^n$ be an optimization variable. Now, at a constraint, I would like to count how many times a value, say $2$, appears in $x$ decision.
I think we can have a binary variable $y_i$...
4
votes
1answer
69 views
How to model $A_i=B_i$ for only one $i$
I would like to model the following:
Only one of the following equalities can hold.
$$(A_1 = B_1)\quad\text{OR}\quad(A_2 = B_2)\quad\text{OR}\quad\dots\quad\text{OR}\quad(A_k = B_k)$$
I can ...
3
votes
1answer
127 views
Linearizing constraint with continuous and boolean variables
I have two continuous variables $A$, $B$ and two binary variables $x$, $y$.
Condition: if $A = B \wedge x = 1 \wedge y=1$ then $z = 1$ else $z = 0$ from
In an integer program, how I can force a ...
2
votes
1answer
87 views
Same values constraint and grouping of variables
In a linear program, I would like some variables to:
1. Take the same values
2. Group some variables i.e. some variables should take same values or lie within certain percentage.
3. All different ...
3
votes
1answer
118 views
How to optimize with “if” constraints
The minimizing problem is the following :
$$ \underset{w}{\operatorname{argmin}} \sum_{i=1}^{n}\left[w_{i}\times (\frac{Vw}{\sigma})_{i} - b_{i}\right]^{2}$$
with $V$ a $n\times n$ matrix (covariance ...
4
votes
0answers
91 views
Conditional constraint formulation [duplicate]
How can I create constraints to make sure $x=1$ if $k\geq 0$ and $x=0$ if $k<0$, where $x\in \{0,1\}$ and $k\in \mathbb{R}$?
Here is my attempt:
\begin{equation}\label{cons:1}
\begin{aligned}
...