Mixed Integer Linear Programming Conditional Constraints I have a set of variables:
$x_1,x_2,x_3,x_4$
$x_1$ is a binary integer variable while the rest are real numbers all between $0$ and $1$.
I want a constraint such that:
if $x_2+x_3+x_4>0$ then $x_1=1$,
and
if $x_2+x_3+x_4=0$ then $x_1=0$.
 A: You can write $$x_1=-\left\lfloor -{x_2+x_3+x_4\over 3}\right\rfloor$$which is equivalent to the following linear constraints:$$-x_1\le -{x_2+x_3+x_4\over 3}<-x_1+1$$or equivalently$$-3x_1+x_2+x_3+x_4\le 0\\-3x_1+x_2+x_3+x_4>-3$$
A: This looks like a fixed cost problem, and it is easy to model if you have an objective function such as 
$$
Min \quad x_1
$$
If so, all you have to do is add the following constraint:
$$
x_2+x_3+x_4\le x_1 \\
x_1 \in \{0,1\}
$$
Indeed, if $x_2+x_3+x_4>0$, then necessarily you will have $x_1=1$. Otherwise, the objective function will "pull down" $x_1$ to $0$.
A: Here is my suggestion. Let $0<a<1$ be a constant
$$ 
\begin{align}
x_2+x_3+x_4 \leq 3 x_1\\
x_2+x_3+x_4 \geq a x_1
\end{align}
$$
This will work because:


*

*if $x_2+x_3+x_4=0$ then $a x_1 \leq 0$. For $x_1 =1$, we have $a<0$ (contradiction due to $0<a<1$), thus $x_1 =0$.

*if $x_2+x_3+x_4 \geq 1$ then $x_2 + x_3 + x_4\leq 3 x_1$. For $x_1 =0$, $x_2 +x_3 + x_4 \leq 0$, (contradiction due to $x_2+x_3+x_4 \geq 1$), thus $x_1=1$
A: You can think about it logically:
If $x_2 + x_3 + x_4 > 0$, then $x_1 = 1$
$\iff$
$x_2 + x_3 + x_4 = 0$ if $x_1 = 0$
$\iff$
$x_2 + x_3 + x_4 = 0$ or $x_1 = 1$
$\iff$
$x_2 = x_3 = x_4 = 0$ or $x_1 = 1$
$\iff$
$x_2 = x_3 = x_4 = 0$ or $x_1 = 1$
$\iff$
$[x_2 = 0 \ and \ x_3 = 0 \ and \ x_4 = 0]$ or $x_1 = 1$
$\iff$
$x_2 = 0 \ or \ x_1 = 1$
and
$x_3 = 0 \ or \ x_1 = 1$
and
$x_4 = 0 \ or \ x_1 = 1$
$\iff$
$1-x_2 = 1 \ or \ x_1 = 1$
and
$1-x_3 = 1 \ or \ x_1 = 1$
and
$1-x_4 = 1 \ or \ x_1 = 1$
$\iff$
$1-x_2 + x_1 \ge 1$
and
$1-x_3 + x_1 \ge 1$
and
$1-x_4 + x_1 \ge 1$
Alternative:
$$x_2+x_3+x_4 \le M(x_1)$$
Alternative:
What Kuifje said.

If $x_2 + x_3 + x_4 = 0$, then $x_1 = 0$
$\iff$
$x_2 + x_3 + x_4 > 0$ if $x_1 = 1$
$\iff$
$x_2 > 0 \ or \ x_3 > 0 \ or \ x_4 > 0$ if $x_1 = 1$
$\iff$
$x_2 > 0 \ or \ x_3 > 0 \ or \ x_4 > 0 \ or \ 1 - x_1 = 1$
$\iff$
$x_2 > 0 \ or \ x_3 > 0 \ or \ x_4 > 0 \ or \ 1 - x_1 > 0$
$\iff$
$x_2 + x_3 + x_4 + 1 - x_1 > 0$
$\iff$
$x_2 + x_3 + x_4 > x_1 - 1$
Alternative:
$$-(x_2+x_3+x_4) < M(1-x_1)$$

Don't forget
$$x_1 \in \{0,1\}$$
$$1 \ge x_2, x_3, x_4 \ge 0$$
A: According to you $x_1$ is a binary decision variable. So the constraints will look like this 
[
    $x_1$= 
\begin{cases}
1,& \text{if } x_2+x_3+x_4>0\\
0, & \text{if } x_2+x_3+x_4 =0
\end{cases}
]
I think this constraint suitable for MILP. 
