高级优化理论与方法(十)

Simplex

Given a basis B B B, x = [ x B T , 0 ] T x=[x_B^T,0]^T x=[xBT,0]T, x B = B T b x_B=B^Tb xB=BTb

Goal: new basis B ′ = B → a p , a q B'=B\rightarrow a_p,a_q B=Bap,aq

[ A , b ] = [ B , D , b ] ⇒ [ I , Y , y 0 ] [A,b]=[B,D,b]\Rightarrow[I,Y,y_0] [A,b]=[B,D,b][I,Y,y0]

[ A , b ] = [ B ′ , D ′ , b ] ⇒ [ I , Y ′ , y 0 ′ ] [A,b]=[B',D',b]\Rightarrow[I,Y',y_0'] [A,b]=[B,D,b][I,Y,y0]

y 0 = x B , y 0 ′ = x B ′ y_0=x_B,y_0'=x_B' y0=xB,y0=xB

注: [ B ′ , D ′ ] [B',D'] [B,D]是把原矩阵中的第 p p p列和第 q q q列交换后的结果。

Claim: y 1 j , ⋯   , y m j , m + 1 ≤ j ≤ n y_{1j},\cdots,y_{mj},m+1\leq j\leq n y1j,,ymj,m+1jn, satisfy a j = y 1 j a 1 + ⋯ + y m j a m a_j=y_{1j}a_1+\cdots+y_{mj}a_m aj=y1ja1++ymjam

a q = y 1 q a 1 + ⋯ + y p q a p + ⋯ + y m q a m a_q=y_{1q}a_1+\cdots+y_{pq}a_p+\cdots+y_{mq}a_m aq=y1qa1++ypqap++ymqam

a p = a q y p q − ∑ i = 1 , i ≠ p m y i q y p q a i a_p=\frac{a_q}{y_{pq}}-\sum_{i=1,i\neq p}^m \frac{y_{iq}}{y_{pq}}a_i ap=ypqaqi=1,i=pmypqyiqai

Claim: a 1 , ⋯   , a p − 1 , a p + 1 , a m , a q a_1,\cdots,a_{p-1},a_{p+1},a_m,a_q a1,,ap1,ap+1,am,aq linearly independent ⇔ y p q = 0 \Leftrightarrow y_{pq}=0 ypq=0

a p = y 1 q ′ a 1 + ⋯ + y p q ′ a q + ⋯ + y m q ′ a m a_p=y_{1q}'a_1+\cdots+y_{pq}'a_q+\cdots+y_{mq}'a_m ap=y1qa1++ypqaq++ymqam

y p q ′ = 1 y p q , y i q ′ = − y i q y p q , ∀ 1 ≤ i ≤ m , i ≠ p y_{pq}'=\frac{1}{y_{pq}}, y_{iq}'=-\frac{y_{iq}}{y_{pq}},\forall 1\leq i \leq m, i\neq p ypq=ypq1,yiq=ypqyiq,∀1im,i=p

∀ j ≥ m + 1 , j ≠ q : { y i j − y p j y i q y p q , i ≠ p y p j y p q , i = p \forall j\geq m+1,j\neq q:\begin{cases} y_{ij}-\frac{y_{pj}y_{iq}}{y_{pq}},i\neq p \\ \frac{y_{pj}}{y_{pq}},i=p \end{cases} jm+1,j=q:{yijypqypjyiq,i=pypqypj,i=p

y i 0 ′ = { y i 0 − y p 0 y i q y p q , i ≠ q y p 0 y p q , i = p y_{i0}'=\begin{cases} y_{i0}-\frac{y_{p0}y_{iq}}{y_{pq}},i\neq q\\ \frac{y_{p0}}{y_{pq}},i=p \end{cases} yi0={yi0ypqyp0yiq,i=qypqyp0,i=p

Claim: x ′ = [ y 0 ′ T , 0 ] T x'=[{y_0'}^T,0]^T x=[y0T,0]T satisfies A x = b Ax=b Ax=b

How to determine p and q?

determine p

Known q : ⇒ ? p q:\Rightarrow ?p q:⇒?p

basis: B , [ I , Y , y 0 ] B,[I,Y,y_0] B,[I,Y,y0]

a q = y 1 q a 1 + ⋯ + y m q a m a_q=y_{1q}a_1+\cdots+y_{mq}a_m aq=y1qa1++ymqam

{ ε a q = ε y 1 q a 1 + ⋯ + ε y m q a m b = y 10 a 1 + ⋯ + y m 0 a m \begin{cases} \varepsilon a_q=\varepsilon y_{1q}a_1+\cdots+\varepsilon y_{mq}a_m \\ b=y_{10}a_1+\cdots+y_{m0}a_m \end{cases} {εaq=εy1qa1++εymqamb=y10a1++ym0am

⇒ b = ( y 10 − ε y 1 q ) a 1 + ⋯ + ( y m 0 − ε y m q ) a m + ε a q \Rightarrow b=(y_{10}-\varepsilon y_{1q})a_1+\cdots+(y_{m0}-\varepsilon y_{mq})a_m+\varepsilon a_q b=(y10εy1q)a1++(ym0εymq)am+εaq

x ′ = [ y 10 − ε y 1 q , ⋯   , y m 0 − ε y m q , 0 , ⋯   , 0 , ε , 0 , ⋯   , 0 ] x'=[y_{10}-\varepsilon y_{1q},\cdots,y_{m0}-\varepsilon y_{mq},0,\cdots,0,\varepsilon,0,\cdots,0] x=[y10εy1q,,ym0εymq,0,,0,ε,0,,0]

A x ′ = b , x ′ ≥ 0 ⇒ ε = m i n { y i 0 y i q : y i q > 0 } ⇒ p = a r g m i n 1 ≤ i ≤ m { y i 0 y i q : y i q > 0 } Ax'=b,x'\geq 0\Rightarrow \varepsilon=min\{\frac{y_{i0}}{y_{iq}}:y_{iq}>0\}\Rightarrow p=argmin_{1\leq i\leq m}\{\frac{y_{i0}}{y_{iq}}:y_{iq}>0\} Ax=b,x0ε=min{yiqyi0:yiq>0}p=argmin1im{yiqyi0:yiq>0}

new basis B ′ ⟷ a q a p B , p B' \stackrel{a_p}{\underset{a_q}\longleftrightarrow}B,p BaqapB,p satisfies y p 0 − ε y p q = 0 y_{p0}-\varepsilon y_{pq}=0 yp0εypq=0

What if y i q ≤ 0 y_{iq}\leq 0 yiq0 for all 1 ≤ i ≤ m 1\leq i\leq m 1im?
⇒ \Rightarrow for arbitrarily large ε ≥ 0 , x ′ \varepsilon\geq 0,x' ε0,x satisfies A x ′ = b , x ′ ≥ 0 Ax'=b,x'\geq 0 Ax=b,x0
⇒ \Rightarrow no solution [unbounded]

determine q

Goal: c T x ≥ c T x ′ c^Tx\geq c^Tx' cTxcTx

Given B , x = [ y 10 , ⋯   , y m 0 , 0 , ⋯   , 0 ] T B,x=[y_{10},\cdots,y_{m0},0,\cdots,0]^T B,x=[y10,,ym0,0,,0]T

z 0 = c T x = c 1 y 10 + ⋯ + c m y m 0 z_0=c^Tx=c_1y_{10}+\cdots+c_my_{m0} z0=cTx=c1y10++cmym0

z = c T x ′ = c 1 ( y 10 − ε y 1 q ) + ⋯ + c m ( y m 0 − ε y m q ) + c q ε = z 0 − c p y p 0 + c q ε − ( c 1 ε y 1 q + ⋯ + c m ε y m q ) = z 0 − c p ε y p q + c q ε − ( c 1 ε y 1 q + ⋯ + c m ε y m q ) = z 0 + ε ( c q − ( c 1 y 1 q + ⋯ + c p y p q + ⋯ + c m y m q ) ) = z 0 + ε ( c q − z q ) z=c^Tx'\\ =c_1(y_{10}-\varepsilon y_{1q})+\cdots+c_m(y_{m0}-\varepsilon y_{mq})+c_q\varepsilon\\ =z_0-c_py_{p0}+c_q\varepsilon-(c_1\varepsilon y_{1q}+\cdots+c_m\varepsilon y_{mq})\\ =z_0-c_p\varepsilon y_{pq}+c_q\varepsilon-(c_1\varepsilon y_{1q}+\cdots+c_m\varepsilon y_{mq})\\ =z_0+\varepsilon(c_q-(c_1y_{1q}+\cdots+c_py_{pq}+\cdots+c_my_{mq}))\\ =z_0+\varepsilon(c_q-z_q) z=cTx=c1(y10εy1q)++cm(ym0εymq)+cqε=z0cpyp0+cqε(c1εy1q++cmεymq)=z0cpεypq+cqε(c1εy1q++cmεymq)=z0+ε(cq(c1y1q++cpypq++cmymq))=z0+ε(cqzq)

⇒ z − z 0 = ε ( c q − z q ) = ε r q \Rightarrow z-z_0=\varepsilon(c_q-z_q)=\varepsilon r_q zz0=ε(cqzq)=εrq

∵ ∀ m + 1 ≤ j ≤ n : c j − z j \because \forall m+1\leq j \leq n: c_j-z_j m+1jn:cjzj is computable
∴ z − z 0 < 0 ⇔ ∃ m + 1 ≤ q ≤ n : r q = c q − z q < 0 \therefore z-z_0<0\Leftrightarrow \exist m+1\leq q\leq n: r_q=c_q-z_q<0 zz0<0m+1qn:rq=cqzq<0

Claim: If ∀ m + 1 ≤ j ≤ n : r j = c j − z j ≥ 0 \forall m+1\leq j \leq n: r_j=c_j-z_j\geq 0 m+1jn:rj=cjzj0, then x x x optimal.

Algorithm

Simplex: Given an initial basis B

  1. Compute: [ A , b ] = [ B , D , b ] → [ I , Y , y 0 ] [A,b]=[B,D,b]\rightarrow [I,Y,y_0] [A,b]=[B,D,b][I,Y,y0]
  2. Compute: ∀ m + 1 ≤ j ≤ n : r j = c j − z j \forall m+1\leq j\leq n: r_j=c_j-z_j m+1jn:rj=cjzj
  3. If ∀ j : r j ≥ 0 \forall j: r_j\geq 0 j:rj0, then return x = [ y 0 T , 0 ] T x=[y_0^T,0]^T x=[y0T,0]T
  4. else pick an q q q with r q < 0 r_q<0 rq<0
  5. If no y i q > 0 y_{iq}>0 yiq>0 for 1 ≤ i ≤ m 1\leq i\leq m 1im, then return “no solution”
    else p = a r g m i n { y i 0 y i q : y i q > 0 } p=argmin\{\frac{y_{i0}}{y_{iq}}:y_{iq}>0\} p=argmin{yiqyi0:yiq>0}
  6. Update [ I , Y , y 0 ] [I,Y,y_0] [I,Y,y0], goto 2

Example

min − x 1 − 2 x 2 − x 3 -x_1-2x_2-x_3 x12x2x3
s.t. 2 x 1 + x 2 − x 3 ≤ 2 2 x 1 − x 2 + 5 x 3 ≤ 6 4 x 1 + x 2 + x 3 ≤ 6 x 1 , x 2 , x 3 ≥ 0 2x_1+x_2-x_3\leq 2\\ 2x_1-x_2+5x_3\leq 6\\ 4x_1+x_2+x_3\leq 6\\ x_1,x_2,x_3\geq 0 2x1+x2x322x1x2+5x364x1+x2+x36x1,x2,x30

⇒ 2 x 1 + x 2 − x 3 + x 4 = 2 2 x 1 − x 2 + 5 x 3 + x 5 = 6 4 x 1 + x 2 + x 3 + x 6 = 6 x 1 , ⋯   , x 6 ≥ 0 \Rightarrow 2x_1+x_2-x_3+x_4=2\\ 2x_1-x_2+5x_3+x_5=6\\ 4x_1+x_2+x_3+x_6=6\\ x_1,\cdots,x_6\geq 0 2x1+x2x3+x4=22x1x2+5x3+x5=64x1+x2+x3+x6=6x1,,x60

A = [ 2 1 − 1 1 0 0 2 − 1 5 0 1 0 4 1 1 0 0 1 ] A=\begin{bmatrix} 2 &1&-1&1&0&0\\ 2&-1&5&0&1&0\\ 4&1&1&0&0&1 \end{bmatrix} A= 224111151100010001

b = [ 2 6 6 ] b=\begin{bmatrix} 2\\ 6\\ 6 \end{bmatrix} b= 266

c = [ − 1 − 2 − 1 0 0 0 ] c=\begin{bmatrix} -1\\ -2\\ -1\\ 0\\ 0\\ 0 \end{bmatrix} c= 121000

B = [ 1 0 0 0 1 0 0 0 1 ] B=\begin{bmatrix} 1&0&0\\ 0&1&0\\ 0&0&1 \end{bmatrix} B= 100010001

[ x 4 x 5 x 6 x 1 x 2 x 3 b 1 0 0 2 1 − 1 2 0 1 0 2 − 1 5 6 0 0 1 4 1 1 6 ] \begin{bmatrix} x_4&x_5&x_6&x_1&x_2&x_3&b\\ 1&0&0&2&1&-1&2\\ 0&1&0&2&-1&5&6\\ 0&0&1&4&1&1&6 \end{bmatrix} x4100x5010x6001x1224x2111x3151b266

[ x 4 x 5 x 6 x 1 x 2 x 3 2 6 6 0 0 0 ] \begin{bmatrix} x_4&x_5&x_6&x_1&x_2&x_3\\ 2&6&6&0&0&0 \end{bmatrix} [x42x56x66x10x20x30]

z = [ 0 , 0 , 0 , − 1 , − 2 , − 1 ] [ 2 6 6 0 0 0 ] = 0 z=[0,0,0,-1,-2,-1]\begin{bmatrix} 2\\ 6\\ 6\\ 0\\ 0\\ 0 \end{bmatrix}=0 z=[0,0,0,1,2,1] 266000 =0

z j = ∑ i = 1 m y i j c i = 0 z_j=\sum_{i=1}^m y_{ij}c_i=0 zj=i=1myijci=0 ,for 4 ≤ j ≤ 6 4\leq j \leq 6 4j6

r j = c j − z j = { − 1 , j = 4 − 2 , j = 5 − 1 , j = 6 r_j=c_j-z_j=\begin{cases} -1, j=4\\ -2,j=5\\ -1,j=6 \end{cases} rj=cjzj= 1,j=42,j=51,j=6
⇒ q = 5 \Rightarrow q=5 q=5(取最小的)

y i 0 y i q = { 2 , i = 1 / , i = 2 6 , i = 3 \frac{y_{i0}}{y_{iq}}=\begin{cases} 2,i=1\\ /,i=2\\ 6,i=3 \end{cases} yiqyi0= 2,i=1/,i=26,i=3
⇒ p = 1 \Rightarrow p=1 p=1(取正数中最小的)

y i j ′ = { y i j ′ − y p j y i q y p q , m + 1 ≤ j ≤ n , j ≠ q , i ≠ q y p j y p q , i = p y_{ij}'=\begin{cases} y_{ij}'-\frac{y_{pj}y_{iq}}{y_{pq}}, m+1\leq j\leq n,j\neq q,i\neq q\\ \frac{y_{pj}}{y_{pq}},i=p \end{cases} yij={yijypqypjyiq,m+1jn,j=q,i=qypqypj,i=p

y i q ′ = { 1 y p q , i = p − y i q y p q , i ≠ p y_{iq}'=\begin{cases} \frac{1}{y_{pq}},i=p\\ -\frac{y_{iq}}{y_{pq}},i\neq p \end{cases} yiq={ypq1,i=pypqyiq,i=p

[ 1 0 0 2 1 − 1 2 0 1 0 4 1 3 8 0 0 1 2 − 1 2 4 ] \begin{bmatrix} 1&0&0&2&1&-1&2\\ 0&1&0&4&1&3&8\\ 0&0&1&2&-1&2&4 \end{bmatrix} 100010001242111132284

B ′ = [ a 2 , a 5 , a 6 ] , Y ′ = [ a 1 , a 4 , a 3 ] B'=[a_2,a_5,a_6],Y'=[a_1,a_4,a_3] B=[a2,a5,a6],Y=[a1,a4,a3]

x ′ = [ x 2 x 5 x 6 x 1 x 4 x 3 2 8 4 0 0 0 ] x'=\begin{bmatrix} x_2&x_5&x_6&x_1&x_4&x_3\\ 2&8&4&0&0&0 \end{bmatrix} x=[x22x58x64x10x40x30]

z ′ = − 4 z'=-4 z=4

c = [ − 2 , 0 , 0 , − 1 , 0 , − 1 ] c=[-2,0,0,-1,0,-1] c=[2,0,0,1,0,1]

z j = { − 4 , j = 4 − 2 , j = 5 2 , j = 6 z_j=\begin{cases} -4, j=4\\ -2,j=5\\ 2,j=6 \end{cases} zj= 4,j=42,j=52,j=6

r j = c j − z j = { 3 , j = 4 2 , j = 5 − 3 , j = 6 r_j=c_j-z_j=\begin{cases} 3, j=4\\ 2,j=5\\ -3,j=6 \end{cases} rj=cjzj= 3,j=42,j=53,j=6
⇒ q = 6 \Rightarrow q=6 q=6

由于步骤比较繁琐,样例不再继续计算。

Initial Basic Feasible Solution

min c T x c^Tx cTx
s.t. A x = b Ax=b Ax=b
x ≥ 0 x\geq 0 x0

⇒ \Rightarrow Artificial LP
min y 1 + ⋯ + y m ≥ 0 y_1+\cdots+y_m\geq 0 y1++ym0
s.t. [ A , I ] [ x y ] = b [A, I]\begin{bmatrix} x\\ y \end{bmatrix}=b [A,I][xy]=b
x ≥ 0 , y ≥ 0 x\geq 0,y\geq 0 x0,y0

Theorem

Thm: The initial LP has a basic feasible solution iff the artificial LP has an optimal solution with the objective function equal to 0.

Two-Phases Simplex

min c T x c^Tx cTx
s.t. A x = b Ax=b Ax=b
x ≥ 0 x\geq 0 x0
Assume b ≥ 0 b\geq 0 b0

Phase I {\rm I} I

  1. Construct artifitial LP
  2. Apply simplex to artifitial LP with an initial basic feasible solution [ 0 , ⋯   , 0 , b ] [0,\cdots,0,b] [0,,0,b]
  3. If the optimal solution of the artifitial LP returns a value ∑ y i ≠ 0 \sum y_i\neq 0 yi=0, then “no solution”
  4. else Phase I I {\rm II} II

Phase I I {\rm II} II

Apply Simplex to the initial LP with the optimal solution of the artificial LP.

Example

min 2 x 1 + 3 x 2 2x_1+3x_2 2x1+3x2
s.t. 4 x 1 + 2 x 2 − x 3 = 12 4x_1+2x_2-x_3=12 4x1+2x2x3=12
x 1 + x 2 − x 4 = 6 x_1+x_2-x_4=6 x1+x2x4=6
x 1 , ⋯   , x 4 ≥ 0 x_1,\cdots,x_4\geq 0 x1,,x40

Artifitial LP:
min y 1 + y 2 y_1+y_2 y1+y2
s.t. 4 x 1 + 2 x 2 − x 3 + y 1 = 12 4x_1+2x_2-x_3+y_1=12 4x1+2x2x3+y1=12
x 1 + x 2 − x 4 + y 2 = 6 x_1+x_2-x_4+y_2=6 x1+x2x4+y2=6
x 1 , x 2 , x 3 , x 4 , y 1 , y 2 ≥ 0 x_1,x_2,x_3,x_4,y_1,y_2\geq 0 x1,x2,x3,x4,y1,y20

A = [ 4 2 − 1 0 1 0 12 1 1 0 − 1 0 1 6 ] A=\begin{bmatrix} 4&2&-1&0&1&0&12\\ 1&1&0&-1&0&1&6 \end{bmatrix} A=[412110011001126]

x = 0 , y = [ 12 , 6 ] T , z = 18 x=0,y=[12,6]^T,z=18 x=0,y=[12,6]T,z=18

p = 5 , q = 2 p=5,q=2 p=5,q=2

A = [ 7 2 0 − 1 1 2 1 − 1 2 9 1 4 1 0 − 1 4 0 1 4 3 2 ] A=\begin{bmatrix} \frac{7}{2}&0&-1&\frac{1}{2}&1&-\frac{1}{2}&9\\ \frac{1}{4}&1&0&-\frac{1}{4}&0&\frac{1}{4}&\frac{3}{2} \end{bmatrix} A=[274101102141102141923]

y 1 = 9 , x 2 = 3 2 , x 1 = x 3 = x 4 = y 2 = 0 , z = 9 y_1=9,x_2=\frac{3}{2},x_1=x_3=x_4=y_2=0,z=9 y1=9,x2=23,x1=x3=x4=y2=0,z=9

r j = { − 7 2 , j = 1 1 , j = 3 − 1 2 , j = 4 3 2 , j = 6 r_j=\begin{cases} -\frac{7}{2},j=1\\ 1,j=3\\ -\frac{1}{2},j=4\\ \frac{3}{2},j=6 \end{cases} rj= 27,j=11,j=321,j=423,j=6
⇒ q = 1 \Rightarrow q=1 q=1

y i 0 y i q = { 2 , i = 1 6 , i = 2 \frac{y_{i0}}{y_{iq}}=\begin{cases} 2,i=1\\ 6,i=2 \end{cases} yiqyi0={2,i=16,i=2
⇒ p = 1 \Rightarrow p=1 p=1
注:此处 p = 1 , q = 1 p=1,q=1 p=1,q=1表示用 x 1 x_1 x1的那一列和 y 1 y_1 y1的那一列进行交换。

A = [ 1 0 − 2 7 1 7 2 7 − 1 7 18 7 0 1 1 14 − 2 7 − 1 14 2 7 6 7 ] A=\begin{bmatrix} 1&0&-\frac{2}{7}&\frac{1}{7}&\frac{2}{7}&-\frac{1}{7}&\frac{18}{7}\\ 0&1&\frac{1}{14}&-\frac{2}{7}&-\frac{1}{14}&\frac{2}{7}&\frac{6}{7} \end{bmatrix} A=[100172141717272141717271876]

x 1 = 18 7 , x 2 = 6 7 , x 3 = x 4 = y 1 = y 2 = 0 , z = 0 x_1=\frac{18}{7},x_2=\frac{6}{7},x_3=x_4=y_1=y_2=0,z=0 x1=718,x2=76,x3=x4=y1=y2=0,z=0

注:此时, z = 0 z=0 z=0表示第一阶段已经达到了最优,接下来开始做第二阶段。

[ 1 0 − 2 7 1 7 18 7 0 1 1 14 − 2 7 6 7 ] \begin{bmatrix} 1&0&-\frac{2}{7}&\frac{1}{7}&\frac{18}{7}\\ 0&1&\frac{1}{14}&-\frac{2}{7}&\frac{6}{7} \end{bmatrix} [100172141717271876]

x = [ 18 7 , 6 7 , 0 , 0 ] , z = 8 x=[\frac{18}{7},\frac{6}{7},0,0],z=8 x=[718,76,0,0],z=8

总结

本节课着重解决上次课提出的关于线性规划的三个问题,即如何找到初始可行解、如何确定 x x x达到最优、如何从 x x x构造新的可行解。这节课通过一系列的推导,推导出了单纯形法,并给出了单纯形法的算法和样例。对于如何寻找初始可行解的问题,又提出了两阶段的单纯形法。下节课将讨论单纯形法的时间复杂度以及一些优化。

  • 3
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值