Use of variables
Continuous variables
Continuous variables are intuitively used to determine divisible quantities. Are very often bounded.
Discrete variables
- Represent a quantity which can come only in whole amounts
- Model type of decisions
Logical condition
Generalized logical conditions
Indicator variables
Indicate the variable value:
- Consider \(x\geq 0\) and a binary variable \(y\in\{0,1\}\). Enforce \(x>0 \Longrightarrow y=1\), achieved by:
\(U\) is an upper bound of \(x\). Note that if \(x=0,y\) can be either 0 or 1.
- To impose also \(x=0 \Longrightarrow y=0\), we add:
\(L\) is the lower bound for \(x\).
Indicate the constraints \(\leq\):
- To model \(y=1 \Longrightarrow \sum_{i} a_{i} x_{i} \leq b\), (force the inequality holds by variable) we can have:
where \(M\) is an upper bound to \(\sum_{i}a_ix_i-b\). When \(y=1\) the constraint is forced to hold. However, if the constraint holds \(y\) can be either 1 or 0.
- To model \(\sum_{i} a_{i} x_{i} \leq b \Longrightarrow y=1\), (be the indicate variable) according to \(p \Longrightarrow q \equiv N O T q \Longrightarrow N O T p\), we can have:\[y=0 \Longrightarrow \sum_{i} a_{i} x_{i}>b=\sum_{i}a_ix_i\geq b+\epsilon \]Let \(L \leq \sum_{i} a_{i} x_{i}-b\), we have\[\sum_{i} a_{i} x_{i}-(L-\epsilon) y \geq b+\epsilon \]
Indicate the constraints \(\geq\):
and
Indicate the constraints \(=\):
Consider \(\sum_{j}a_jx_j=b\):
both inequalities hold at the same time:
Indicate the constraints \(\neq\):
Consider:
If \(y=0\), we enforce one of the two inequalities to be broken:
Connecting continuous and binary variables
Fixed costs
if \(x=1\), then add cost \(K\) in objective function.
Counting
we want to have a constraint that only a certain number of real variables are strictly greater than 0, namely \(K\).
Economies of scale
If \(x\leq B_1\), pay \(C_1x\);
If \(B_1\leq x\leq B_2\), pay \(C_2x\);
If \(B_2\leq x\leq B_3\), pay \(C_3x\).
Disjunctive Constraint
Disjunctive Constraint require that at least or at most one subset of constraints holds.
-
At least \(K\).
First introduce \(N\) indicator variables \(\delta_i\), such that
\[\delta_i=1\Longrightarrow C_i \]If \(C_i\) is in type \(\leq\), we have:
\[\sum_ja_ix_i+L\delta_i\leq b_i+L,\qquad \forall i \]If \(C_i\) is in type \(\geq\), we have:
\[\sum_{j} a_{i j} x_{i j}+L \delta_{i} \geq L+b_{i},\qquad \forall i \]Finally,
\[\sum_i\delta_i\geq K \] -
At most \(K\).
We need to impose \(\sum_i\delta_i\leq K\), in turn:
\[C_i\Longrightarrow \delta_i=1 \]For \(\leq\):
\[\sum_ja_{ij}x_{ij}-(U-\epsilon)\delta_i\geq b_i+\epsilon \]For \(\geq\):
\[\sum_ja_{ij}x_{ij}-(L+\epsilon)\delta_i\leq b_i-\epsilon \]
Linearizing Models
- We wish to linearize the product of two binary term \(\delta_1\delta_2\) by \(\delta\), we can
In this case:
-
linearize terms involving a product of a binary variable, say \(\delta\), with a continuous variable, say \(x\).
\[x\delta \]using continuous variables \(y\), such that:
\[\begin{aligned} &\delta=0 \Longrightarrow y=0 \\ &\delta=1 \Longrightarrow y=x \end{aligned} \]by enforcing:
\[\begin{aligned} &y \leq M \delta \\ &y \leq x \\ &x+M \delta \leq y+M \end{aligned} \]