Linked Questions

0 votes
2 answers
219 views

How to formulate "If statement with equality constraints" using big m? [duplicate]

How to convert this one to a linear program: if $x=1$ then $B=1$; otherwise, $B=0$. If I use the Big M method: \begin{align}x&\ge1-M(1-B)\\x&\le1+M(1-B)\end{align} A) with $B=1$: \begin{align}...
Hussein Sharadga's user avatar
3 votes
0 answers
65 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 \...
ooo's user avatar
  • 1,589
0 votes
0 answers
37 views

Could you model this if -else statement [duplicate]

I need to build a if-else constraint for this statement, where $c_j$ and $x_{ij}$ are decision variables, and $m_i$ is a constant: if $c_j$ = $m_i$ then $x_{ij}$ = 1 else $x_{ij} = 0$. Any help is ...
Vamsi Krishna Kunapareddy's user avatar
16 votes
1 answer
10k 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 ...
Mostafa's user avatar
  • 2,104
12 votes
2 answers
3k 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$ (...
LarrySnyder610's user avatar
12 votes
1 answer
5k views

If-then constraints in MIP programming

For continuous variables $x$ and $y$, the constraints are: ...
Qbik's user avatar
  • 221
4 votes
3 answers
1k views

How to couple a binary variable to a continuous variable to indicate values greater 0

I have a continuous variable $x_t$. A binary variable $b_t$ should be coupled to $x_t$ such that $b_t$ has the value $1$ if $x_t$ has a value greater than $0$ and $b_t$ has the value $0$ if $x_t$ has ...
PeterBe's user avatar
  • 1,652
2 votes
3 answers
350 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 ...
C Marius's user avatar
  • 507
4 votes
2 answers
297 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 \ \ \...
Psyndrom Ventura's user avatar
5 votes
2 answers
552 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$...
Clement's user avatar
  • 2,252
5 votes
1 answer
358 views

If continuous variable < constant then same variable = 0

When I come across with a situation needs an if-then constraints I visit Larry's post. I am a bit confused with the titled constraint this time because I am not trying to set $y$ based on $x$ but ...
tcokyasar's user avatar
  • 1,249
10 votes
1 answer
215 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. ...
GrayLiterature's user avatar
3 votes
2 answers
509 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 ...
Oleg K's user avatar
  • 33
3 votes
2 answers
499 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 ...
Sam's user avatar
  • 161
9 votes
1 answer
202 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$...
independentvariable's user avatar

15 30 50 per page