Final exam on Operations Research (I)
助教 黎福全
1. Consider the following Linear Programming problem (P):
min x + 4y
s.t. 4x + y ≥ 4 2x + y ≥ 3 x + 2y ≥ 3
y ≥ 0.5 2x − y ≤ 6
x − y ≤ 2 x ≥ 0 , y ≥ 0
(a) Draw the feasible domain on the x-y plane and find out the optimal solution using the graphic method.
(b) Notice that (1,1) is not optimal. Transform (P) into the LP standard form and perform one iteration of the revised simplex method from the point (1,1). You have to compute the reduced cost vector, complete the minimum ratio test, and finally determine the pivoting variables.
Sol:
(a) 參照下圖,optimal 發生在 (2,0.5), 最小值為 5.
(b) 將原題目改寫如下
min x + 4y
s.t. 4x + y − z1 = 4 2x + y − z2 = 3 x + 2y − z3 = 3
y − z4 = 0.5 2x − y + z5 = 6
x − y + z6 = 2
x ≥ 0 , y ≥ 0, zi ≥ 0, i = 1, 2, 3, 4, 5, 6.
則
A =
4 1 −1 0 0 0 0 0
2 1 0 −1 0 0 0 0
1 2 0 0 −1 0 0 0
0 1 0 0 0 −1 0 0
−2 1 0 0 0 0 1 0
−1 1 0 0 0 0 0 1
bt = (4, 3, 3, 0.5, −6, −2)
ct = (1, 4, 0, 0, 0, 0, 0, 0).
(1) 由x = 1, y = 1開始, 可得知z1 = 1, z2 = 0, z3 = 0, z4 = 0.5, z5 = 5, z6 = 2.
所以 Basis= {x, y, z1, z4, z5, z6} ; Non-basis= {z2, z3}.
(2) 計算 Reduced Cost Vector (ctN − ctBB−1N )
= [0, 0] − [1, 4, 0, 0, 0, 0]
0 2/3 −1/3 0 0 0 0 −1/3 2/3 0 0 0
−1 7/3 −2/3 0 0 0 0 −1/3 2/3 −1 0 0 0 −5/3 4/3 0 1 0
0 −1 1 0 0 1
0 0
−1 0 0 −1
0 0
0 0
0 0
=−2
3 ,73 (由此決定將z2加入 Basis).
(3) 進行 Minimum Ratio Test θ = min{¯ (B−1b)j
(B−1aq)j|B−1aq> 0}
= min{ 1 1/3, 0.5
1/3, 5 5/3,2
1} = 3
2. (所以決定將z4移出 Basis).
(4) 所以 New Basis= {x, y, z1, z2, z5, z6} ; New Non-basis= {z3, z4}.
即從(1, 1)移動到(2, 0.5).
2. Consider the linear programming in its standard form (1):
min cTx
s.t. Ax = b x ≥ 0
where A is m×n matrix, c∈ Rn, b∈ Rm. Its Lagrange dual is a max-min linear program- ming (2):
y∈Rmaxm,σ≥0 min
x∈Rn{L(x; y, σ) = cTx + yt(b − Ax) − σTx}
with σ ≥ 0 being a n-dimensional nonnegative vector.
(a) Solve the max-min Lagrange dual problem to show that (2) is indeed equivalent to the dual linear programming of (1).
(b) Show that the weak duality theorem holds for the pair (1) and (2) upon the dual feasible domain {y ∈ Rm, σ ≥ 0}. (Remark: You are NOT allowed to use the result of (a), but have to prove it directly.)
(c) Suppose y∗ and σ∗ = c − Aty∗ ≥ 0 constitutes the dual optimal solution. Denote x(y∗, σ∗) to be the optimal solution set that minimizes L(x; y∗, σ∗) on Rn. Find the subset of x(y∗, σ∗) that truly minimizes (1).
(d) Suppose ¯y and ¯σ = c − Aty ≥ 0 is dual feasible but FAILS to be the dual optimal¯ solution. Denote x(¯y, ¯σ) to be the optimal solution set that minimizes L(x; ¯y, ¯σ) on Rn. Can you find a subset from x(¯y, ¯σ) that truly minimizes (1)? Why?
Sol:
(a) The max-min Lagrange dual problem can be rewrite as
y∈Rmaxm,σ≥0min
x∈Rn{L(x; y, σ) = bTy + (cT − yTA − σT)x}.
To solve the inner optimization problem (IOP)
x∈RminnL(x; y, σ) = bTy + (cT − yTA − σT)x, the equality
∂L(x; y, σ)
∂x = cT − yTA − σT = 0
must be satisfied, else if, (cT − yTA − σT)i > 0 for some i, the (IOP) problem approachs to −∞ by letting xi → −∞; if (cT − yTA − σT)j < 0 for some j, the (IOP) problem is unbounded below if xj → +∞. Therefore σ = c − ATy, hence the max-min Lagrange dual problem thus equivalent to the problem
y∈Rmaxm,σ≥0bTy,
that is
maxy∈Rm bTy
s.t. c − ATy ≥ 0 which is the dual form of the problem (1).
(b) If x is a primal feasible solution, we have Ax = b, x ≥ 0, thus the max-min Lagrange dual problem becomes
max
y∈Rm,σ≥0min
x∈Rn{L(x; y, σ) = cTx − σTx}.
Observe that cTx − σTx ≤ cTx since σ ≥ 0 and x ≥ 0, the Weak Duality holds.
(c)
原命題 ⇒ min
x∈x(y∗,σ∗){L = cTx + (y∗)T(b − Ax) − (σ∗)Tx}
⇔ min
x {L = cTx + (y∗)T(b − Ax) − (c − Aty∗)Tx}
⇔ min
x {L = (y∗)Tb}
we choose {x | x ∈ x(y∗, σ∗), x ≥ 0, cTx = bTy∗} is a subset of x(y∗, σ∗) , then the subset is that truly minimizes (1).
(d)
原命題 ⇒ min
x∈x(¯y,¯σ){L = cTx + (¯y)T(b − Ax) − (¯σ)Tx}
⇔ min
x {L = (¯y)Tb}
(¯y, ¯σ)is not optimal ⇒ ∃(y∗, σ∗) s.t. bTy < b¯ Ty∗
If we can find a subset from x(¯y, ¯σ) that truly minimizes (1), then we get cTx = bTy < b¯ Ty∗ (contradiction). So we can not find a subset from x(¯y, ¯σ) that truly minimizes (1).
3. Consider the linear programming problem (in the standard form) amd also its dual with data set A = [1, −3], b = 3, c = (1, 2)t.
(a) Draw the picture for the primal feasible set {x|Ax = b, x ≥ 0} and the picture of the convex set {y|Aty ≤ c}. Solve the promal and dual problems graphically.
(b) Let ˆx be any primal feasible solution. Notice that the dual objective function bty can be expressed as ˆxtλ. Use ˆx to find the dual optimal solution y∗ and show that (using this example) the dual optimal solution is independent of the choice of ˆx.
(c) Let x∗ be the primal optimal solution. Use the picture to observe the complemen- tarity property that c − Aty∗⊥x∗.
Sol:
(a) 根據題目我們可以寫出 primal proplem 和 dual proplem, 如下:
min x1+ 2x2
s.t. x1− 3x2 = 3 x1 ≥ 0 , x2 ≥ 0
max 3y
s.t. y ≤ 1
−3y ≤ 2
(b) (1) 因為bTy = (Ax)Ty = xTATy = xTλ,where λ = ATy = (y, −3y)T. (2) 而且從題目得知ATy ≤ C = (1, 2)T.
(3) 若λ在第二象限,∀¯x ∈ {x|Ax = b, x ≥ 0}, ¯xTλ ≤ 0.(因為夾角大於 90 度) 若λ在第四象限,∀¯x ∈ {x|Ax = b, x ≥ 0}, ¯xTλ ≥ 0.(因為夾角小於 90 度) 所以λ∗會在第四象限.(因為需要找 max bTy)
(4) ∀¯x ∈ {x|Ax = b, x ≥ 0}, λ∗ = (1, −3)T.
(表示和¯x選擇無關, 當夾角固定時, 取|λ|最大的), 所以y∗ = 1(與¯x無關).
(c) 如下圖:
4. Give the cost matrix with Cij being the cost for assigning the ith person to the jth job.
7 2 1 9 4 9 6 9 5 5 3 8 3 1 8 7 9 4 2 2 8 4 7 4 8
(a) Apply the Hungarian method to solve the assignment problem.
(b) Formulate the assignment problem as a minimum cost flow problem and use network simplex algorithm to solve it.
(c) An algorithm is called a primal-dual method if it maintains simultaneously the primal and dual feasibility at each iteration while seeking for the reduction of the duality gap. Which of the above two methods for solving the assignment problem is a primal-dual method? Why?
Sol:
(a)
7 2 1 9 4 9 6 9 5 5 3 8 3 1 8 7 9 4 2 2 8 4 7 4 8
−→
6 1 0 8 3 4 1 4 0 0 2 7 2 0 7 5 7 2 0 0 4 0 3 0 4
−→
4 1 0 8 3
2 1 4 0 0
0 7 2 0 7
3 7 2 0 0
2 0 3 0 4
所以第 1 個人給第 3 份工作; 第 2 個人給第 5 份工作; 第 3 個人給第 1 份工作; 第 4 個人給第 4 份 工作; 第 5 個人給第 2 份工作; total cost = 1 + 5 + 3 + 2 + 4 = 15.
(b) Set:
min Σi,jCijXij
s.t. Σ5i=1Xij = 1 for j = 6, 7, 8, 9, 10 Σ10j=6Xij = 1 for i = 1, 2, 3, 4, 5
Xij = 0or1
Use network simplex algorithm: Check non-basic variable:
C16− (W1− W6) = 7 − (3 − 0) = 4 ; C19− (W1− W9) = 9 − (3 − 2) = 8 C1 10− (W1− W10) = 4 − (3 − 2) = 3 ; C26− (W2− W6) = 9 − (7 − 0) = 2 C28− (W2− W8) = 9 − (7 − 2) = 4 ; C29− (W2− W9) = 5 − (7 − 2) = 0 C37− (W3− W7) = 8 − (3 − 1) = 6 ; C38− (W3− W8) = 3 − (3 − 2) = 2 C3 10− (W3− W10) = 8 − (3 − 2) = 7 ; C46− (W4− W6) = 7 − (4 − 0) = 3 C47− (W4− W7) = 9 − (4 − 1) = 6 ; C48− (W4− W8) = 4 − (4 − 2) = 2 C56− (W5− W6) = 8 − (5 − 0) = 3 ; C58− (W5− W8) = 7 − (5 − 2) = 4 C59− (W5− W9) = 4 − (5 − 2) = 1 ; C5 10− (W5− W10) = 8 − (5 − 2) = 5 因為 non-basic variable 均大於等於零, 所以為最佳解.
(c) Hungarian method is a primal-dual method. 因為它同時要求 primal feasible 和 dual feasible; Network simplex algorithm is not a primal-dual method. 因為每回合中它會 重新計算 Reduced Cost Vector 測試是否產生小於零的值, 如果有就必須進行解的更動, 直 到所有 Reduced Cost Vector 均大於等於零.
5. Given the network with capacity matrix
U =
− 1 3 2
4 − 2 1 6 3 − 5
7 2 1 −
(a) Apply the labeling algorithm to solve the maximum flow. Assume that s = 1 (source) and t = 4 (sink) and start with the zero flow.
(b) Find ALL minimum cuts of the network.
(c) A slight modification to the labeling procedure is the so called first-labeling-first- picked strategy. That is, if both (a1, b1), (a2, b2) ∈ (S, ¯S) are unsaturated arcs and create no cycle; a1 was labeled before a2, we pick a1 to continue the search. Use this modified labeling algorithm to solve the maximum flow again.
Sol:
(a) 因為節點v1為 source 而節點v4為 sink 所以對節點 1 來說必須流出大於流入而節點v4必須流 入大於流出, 而整個網路就如下.
首先我們從節點v1出發用 labeling algorithm, 走到節點v2可以得知l(v2) = 1, 繼續往下 走到了節點v3可以得知l(v3) = min{1, 2} = 1, 繼續往下走到了節點v4可以得知l(v4) = min{1, 5} = 1.
接著退回到節點v3, 但是節點v3無法再往其它地方走, 只好又退回到節點v2, 而節點v2, 就再往 節點v4前進。 但是因為路徑x1,2被塞滿, 所以節點v4可以得知l(v4) = min{0, 1} = 0。 只好又 退回到節點v2, 而節點v2也無法再前進了 就只好退回節點v3, 節點v3可以得知l(v3) = 3, 再從
節點v3前進到節點v2可以得知l(v2) = min{3, 2} = 2, 再從節點v2 只能前進到節點v4可以得 知l(v4) = min{2, 1} = 1.
接著就退回到節點v3, 因為原本路徑x1,3已經被使用 1 單位了可以得知l(v3) = 2, 再前進到結 點v4所以得知l(v4) = min{2, 4} = 2.
接著就退回到節點v3, 但是節點v3無法再往其它地方走, 只好又退回到節點v1, 就再往節點v4前 進, 可以得知l(v4) = 2.
最後退回到節點v1, 但是節點v1無法再往其它地方走, 因此結束此演算法, 可以得到最大流量 為 6。
(b) 我們將列出所有的 cut。(由於節點 1 一定屬於S, 而節點 4 一定屬於 ¯S, 所以我們可以先把一些 不需列入考量的方向砍掉, 像是節點4 到節點 1 此流向等等.)
第一個, 我們將S = {1, 2, 3}及 ¯S = {4}, 可以算得出其cap1 = 1 + 2 + 5 = 8.
第二個, 我們將S = {1, 3}及 ¯S = {2, 4}, 可以算得出其cap2 = 1 + 2 + 3 + 5 = 11.
第三個, 我們將S = {1, 2}及 ¯S = {3, 4}, 可以算得出其cap3 = 3 + 2 + 2 + 1 = 8.
第四個, 我們將S = {1}及 ¯S = {2, 3, 4}, 可以算得出其cap4 = 1 + 2 + 3 = 6.
而這個例子也可以驗証了 maximum flow 的 dual 為 minimum cut.
(c) 跟著這 first-labeling-first-picked 個方法跑一次。
首先從節點v1出發, 走到節點v2可以得知l(v2) = 1; 再從節點v1出發, 走到節點v3可以得知l(v3) = 3 ; 再從節點v1出發, 走到節點v4可以得知l(v4) = 2, 所以可得知送出流量為 2 單位, 並且因為 節點v1無路可走了就不再搜尋了, 換成節點v2.
接著從節點v2, 因為節點v1 ∈ S所以無法回頭, 而節點v3也被挑選了, 所以只能前往到節點v4可 以得知l(v4) = min{1, 1} = 1。 並且因為節點v2無路可走了就不再搜尋了, 換成節點v3.
接著從節點v3, 因為節點v1 ∈ S所以無法回頭, 所以前往節點v2, 因為路徑x2,4已經被塞滿 了, 所以可以得知l(v4) = min{3, 0} = 0。 只好又退回節點v3, 接著只能前進節點v4可以得 知l(v4) = min{3, 5} = 3。 節點v3無路可走了就不再搜尋了, 最後因為沒有其它的節點了, 因 此演算法終止.
原本的 labeling algorithm 簡單的來說就是深度蒐尋 (DFS), 而這個 first-labeling-first- picked 也就是廣度蒐尋 (BFS)。
6. Characterize the maximal flow value ν as a function of c24 and c35 for the network shown below.
Sol:
In any network, since the value of a maximal flow is equal to the capacity of a minimum cut. Therefore, we discuss the following cuts to compute the maximal flow value ν.
(1) If the cut K = (S, S) with S = {1}, S = {2, 3, 4, 5}
⇒ max ν = 5
(2) If the cut K = (S, S) with S = {1, 2}, S = {3, 4, 5}
⇒ max ν = 3 + c24
(3) If the cut K = (S, S) with S = {1, 3}, S = {2, 4, 5}
⇒ max ν = 5 + 2 + c35= 7 + c35
(4) If the cut K = (S, S) with S = {1, 4}, S = {2, 3, 5}
⇒ max ν = 5 + 3 = 8
(5) If the cut K = (S, S) with S = {1, 2, 3}, S = {4, 5}
⇒ max ν = 2 + c24+ c35
(6) If the cut K = (S, S) with S = {1, 2, 4}, S = {3, 5}
⇒ max ν = 3 + 3 = 6
(7) If the cut K = (S, S) with S = {1, 3, 4}, S = {2, 5}
⇒ max ν = 5 + 3 + c35= 8 + c35
(8) If the cut K = (S, S) with S = {1, 2, 3, 4}, S = {5}
⇒ max ν = 3 + c35 Hence,
max ν = min{5, 3 + c24, 7 + c35, 8, 2 + c24+ c35, 6, 8 + c35, 3 + c35}
= min{5, 3 + c24, 2 + c24+ c35, 3 + c35}