其他分享
首页 > 其他分享> > 应用运筹学1 - 变量使用

应用运筹学1 - 变量使用

作者:互联网

Use of variables

Continuous variables

Continuous variables are intuitively used to determine divisible quantities. Are very often bounded.

Discrete variables

  1. Represent a quantity which can come only in whole amounts
  2. Model type of decisions

Logical condition

\[\begin{array}{ll} \text { Logical condition } & \text { Constraint } \\ \hline A \text { OR } B & x_{A}+x_{B} \geq 1 \\ A \text { AND } B & x_{A}=1, x_{B}=1 \\ \text { NOT } A & x_{A}=0 \text { or }\left(1-x_{A}\right)=1 \\ A \Longrightarrow B & x_{A} \leq x_{B} \\ A \Longleftrightarrow B & x_{A}-x_{B}=0 \end{array} \]

Generalized logical conditions

\[\begin{array}{cc} \text { Implication } & \text { Translation } \\ \hline A \Longrightarrow B & x_{A} \leq x_{B} \\ A \Longrightarrow \text { SOME } B_{j} & x_{A} \leq \sum_{j=1}^{m} x_{B_{j}} \\ A \Longrightarrow \text { ALL } B_{j} & x_{A} \leq x_{B_{j}} \text { for } j=1, \ldots, m \\ \text { SOME } A_{i} \Longrightarrow B & x_{A_{i}} \leq x_{B} \text { for } i=1, \ldots, n \\ \text { SOME } A_{i} \Longrightarrow \text { SOME } B_{j} & x_{A_{i}} \leq \sum_{j=1}^{m} x_{B_{j}} \text { for } i=1, \ldots, n \\ \text { SOME } A_{i} \Longrightarrow \text { ALL } B_{j} & x_{A_{i}} \leq x_{B_{j}} \text { for } i=1, \ldots, n \text { and } j=1, \ldots, m \\ \text { ALL } A_{i} \Longrightarrow B & \sum_{i=1}^{n} x_{A_{i}} \leq x_{B}+n-1 \text { for } i=1, \ldots, n \\ \text { ALL } A_{i} \Longrightarrow \text { SOME } B_{j} & \sum_{i=1}^{n} x_{A_{i}} \leq \sum_{j=1}^{m} x_{B_{j}}+n-1 \\ \text { ALL } A_{i} \Longrightarrow \text { ALL } B_{j} & \sum_{i=1}^{n} x_{A_{i}} \leq x_{B_{j}}+n-1 \text { for } j=1, \ldots, m \\ \hline \end{array} \]

Indicator variables

Indicate the variable value:

  1. Consider \(x\geq 0\) and a binary variable \(y\in\{0,1\}\). Enforce \(x>0 \Longrightarrow y=1\), achieved by:

\[x\leq Uy \]

​ \(U\) is an upper bound of \(x\). Note that if \(x=0,y\) can be either 0 or 1.

  1. To impose also \(x=0 \Longrightarrow y=0\), we add:

\[x\geq Ly \]

​ \(L\) is the lower bound for \(x\).

Indicate the constraints \(\leq\):

  1. To model \(y=1 \Longrightarrow \sum_{i} a_{i} x_{i} \leq b\), (force the inequality holds by variable) we can have:

\[\sum_{i} a_{i} x_{i}+M y \leq b+M \]

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.

  1. 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\):

\[\begin{gathered} y=1 \Longrightarrow \sum_{i} a_{i} x_{i} \geq b \\ \sum_{i} a_{i} x_{i}+L y \geq b+L \end{gathered} \]

and

\[\begin{gathered} \sum_{i} a_{i} x_{i} \geq b \Longrightarrow y=1 \\ \sum_{i} a_{i} x_{i}-(M+\epsilon) y \leq b-\epsilon \end{gathered} \]

Indicate the constraints \(=\):

Consider \(\sum_{j}a_jx_j=b\):

\[y=1 \Longrightarrow \sum_{i} a_{i} x_{i} \geq b \operatorname{AND} \sum_{i} a_{i} x_{i} \leq b \]

both inequalities hold at the same time:

\[\begin{aligned} &\sum_{i} a_{i} x_{i}+M y \leq M+b \\ &\sum_{i} a_{i} x_{i}+L y \geq L+b \end{aligned} \]

Indicate the constraints \(\neq\):

Consider:

\[y=0 \Longrightarrow \sum_{i} a_{i} x_{i} \neq b \]

If \(y=0\), we enforce one of the two inequalities to be broken:

\[\begin{gathered} \sum_{i} a_{i} x_{i}-(L-\epsilon) y^{\prime} \geq b+\epsilon \\ \sum_{i} a_{i} x_{i}-(M+\epsilon) y^{\prime \prime} \leq b-\epsilon \\ y^{\prime}+y^{\prime \prime} \leq 1+y \end{gathered} \]

Connecting continuous and binary variables

Fixed costs

if \(x=1\), then add cost \(K\) in objective function.

\[\begin{aligned} &\min C x+K y \\ &\quad x \leq U y \\ &x \geq 0, y \in\{0,1\} \end{aligned} \]

Counting

we want to have a constraint that only a certain number of real variables are strictly greater than 0, namely \(K\).

\[\begin{aligned} &x_{i} \leq Uy_{i} \\ &\sum_{i=1}^{I} y_{i} \leq K \end{aligned} \]

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\).

\[\begin{aligned} &y_{1}+y_{2}+y_{3}=1 \\ &x_{1} \leq B_{1} y_{1} \\ &B_{1} y_{2} \leq x_{2} \leq B_{2} y_{2} \\ &B_{2} y_{3} \leq x_{3} \leq B_{3} y_{3} \end{aligned} \]

Disjunctive Constraint

Disjunctive Constraint require that at least or at most one subset of constraints holds.

  1. 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 \]

  2. 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

  1. We wish to linearize the product of two binary term \(\delta_1\delta_2\) by \(\delta\), we can

\[\delta=1\Longrightarrow \delta_1=1\land\delta_2=1 \]

​ In this case:

\[\begin{aligned} &\delta \leq \delta_{1} \\ &\delta \leq \delta_{2} \\ &\delta_{1}+\delta_{2} \leq 1+\delta \end{aligned} \]

  1. 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} \]

标签:geq,变量,text,sum,leq,应用,delta,Longrightarrow,运筹学
来源: https://www.cnblogs.com/romaLzhih/p/15582866.html