Linear Programming
Cheng-Liang Chen
PSE
LABORATORY
Department of Chemical Engineering National TAIWAN University
Chen CL
1
Refinery Scheduling The Refinery Process
Chen CL
1
Refinery Scheduling The Refinery Process
Chen CL
2
Refinery Scheduling Problem Data Produ Product ct Yiel Yields ds bbl/ bbl/bb bbll crud crudee Products/Crudes
1
Fuel Process 2 3
Produ Product ct
Maxi Ma ximu mum m
4
Lube 4
Value $/bbl
Demand kbbl/wk
Gasoline Heating Oil
0.6 0.2
0.5 0.2
0.3 0.3
0 .4 0 .3
0 .4 0 .1
45.00 45. 30..00 30
170 85
Jet Fuel Lube Oil Operating Losses
0.1 0.0 0.1
0.2 0.0 0.1
0.3 0.0 0.1
0 .2 0 .0 0 .1
0 .2 0 .2 0 .1
15.00 15. 60..00 60
85 20
−
−
Crude Cost $/bbl Operating Cost $/bbl
15. 15. 5.0
15. 15. 8.5
15. 15. 7.5
25. 25. 3 .0
25. 25. 2 .5
Crude Supply kbbl/wk
100
100
100
200
Chen CL
3
Refinery Scheduling Problem Analysis
For 1 kbbl/ For kbbl/wk wk of crude 1, one can produ oduce 0.6 kbbl/ kbbl/wk wk of gasoline, 0.2 kbbl/wk of heating oil, 0.1 kbbl/wk of jet fuel, with production cost of 20 20 k$ k$ per kbbl/wk. ⇒ Values of products produced: 45(0. 45(0.6) + 30(0. 30(0.2) + 15(0. 15(0.1) = 34. 34.5 k$ 34..5 − (15 + 5) = 14 14..5 k$ ⇒ Profit for 1 kbbl/wk of crude 1: 34 Similarly: profits of 8.0, 4.5, 2.0, 8.5 k$ for crude options 2, 3, 4, 5
⇒ The usage preference for crude options are:
1 > 5 > 2 > 3 > 4 > 4
Chen CL
4
Refinery Scheduling Problem Analysis
The only constraints that we should satisfy are supply constraints and maximum demand constraints
Use most profitable crude (crude 1) as much as we can: ⇒ Using 100 kbbl/wk of crude 1 produces 60 kbbl/wk of gasoline, 20 kbbl/wk of heating oil, 10 kbbl/wk of jet fuel, 0 kbbl/wk of lube oil. (not exceed maximum demands)
Use next most profitable crude (crude 4 in lube process)
Chen CL
5
Refinery Scheduling Problem Analysis
Use next most profitable crude (crude 4 in lube process):
⇒ Using 100 kbbl/wk of crude 4 produces (accumulated value ) 60 + 40 = 100 kbbl/wk of gasoline, 20 + 10 = 30 kbbl/wk of heating oil, 10 + 20 = 30 kbbl/wk of jet fuel, 0 + 20 = 20 (max demand) kbbl/wk of lube oil. (not exceed maximum demands except lube oil)
Use 3rd most profitable crude (crude 2) as much as we can
Chen CL
6
Refinery Scheduling Problem Analysis
Use 3rd most profitable crude (crude 2) as much as we can:
⇒ Using 100 kbbl/wk of crude 2 produces 60 + 40 + 50 = 150 kbbl/wk of gasoline, 20 + 10 + 20 = 50 kbbl/wk of heating oil, 10 + 20 + 20 = 50 kbbl/wk of jet fuel, 0 + 20 + 0 = 20 (max demand) kbbl/wk of lube oil. (not exceed maximum demands except lube oil)
Use 4th most profitable crude (crude 3) as much as we can
Chen CL
7
Refinery Scheduling Problem Analysis
Use 4th most profitable crude (crude 3) as much as we can:
⇒ Using 66.67 kbbl/wk of crude 3 produces 60 + 40 + 50 + 20 = 170 (max demand) kbbl/wk of gasoline, 20 + 10 + 20 + 20 = 70 kbbl/wk of heating oil, 10 + 20 + 20 + 20 = 70 kbbl/wk of jet fuel, 0 + 20 + 0 + 0 = 20 (max demand) kbbl/wk of lube oil. (reaching maximum demand for gasoline and lube oil)
Chen CL
8
Refinery Scheduling Problem Analysis
We cannot use crude 4 in fuel process, because it also produces gasoline (gasoline has reached maximum demand)
Summary: Using (100, 100, 66.67, 0, 100) kbbl/wk of crudes 1, 2, 3, 4,“5”
Chen CL
9
Refinery Scheduling Linear Programming Formulation product sales
production cost
4
Max
J =
v pQ p
p=1
s.t.
5
xr ≤ S r
−
C r xr
r=1
r = 1, 2, 3
x4 + x5 ≤ S 4 Q p = a p1x1 + a p2x2 + a p3x3 + a p4x4 + a p5x5 Q p ≤ D p
p = 1, . . . , 4
Q p ≥ 0
p = 1, . . . , 4
xr ≥ 0
r = 1, . . . , 5
Chen CL
10
Refinery Scheduling GAMS Formulation set C set P data S c D p
crudes products CSUPPLY(C) PDEMAND(P)
v p C c
PVALUE(P) TCOST(C)
a pc TCOST(C)
YIELDs(P,C) sum of CCOST(C) and OCOST(C) (costs of crude c and operating cost)
PROFIT objective function PRODUCTION(P) Q p equations X4 total crude 4 usage X4.UP = CSUPPLY(”4-fuel”), upper bound X.UP(C) supply constraints on xc Q.UP = PDEMAND(P)
Chen CL
11
Refinery Scheduling GAMS Code $TITLE Refinery Scheduling $OFFUPPER $OFFSYMXREF OFFSYMLIST OPTION SOLPRINT = OFF; * Define index sets SETS C Crudes /1*3, 4-fuel, 4-lube/ P Products /gasoline, heat-oil, jet-fuel, lube-oil/ *Define and initialize the problem data PARAMETER CSUPPLY(C) Crude oil availabilities in kbbl per wk / 1 100.0, 2 100.0, 3 100.0, 4-fuel 200.0, 4-lube 200.0/ CCOST(C) Crude oil costs in $ per bbl / 1 15.0, 2 15.0, 3 15.0, 4-fuel 25.0, 4-lube 25.0/ PDEMAND(P) Maximum product demands in kbbl per wk / gasoline 170.0, heat-oil 85.0, jet-fuel 85.0, lube-oil PVALUE(P) Product Values in $ per bbl /
Chen CL
12
gasoline 45.0, heat-oil 30.0, jet-fuel 15.0, lube-oil 6 OCOST(C) Crude operating costs in $ per bbl / 1 5.0, 2 8.5, 3 7.5, 4-fuel 3.0, 4-lube 2.50/ TCOST(C) Total costs: crude plus operating; TCOST(C) = CCOST(C) + OCOST(C); TABLE YIELDS(P, C) Yields of products for crudes 1 2 3 4-fuel 4-lube gasoline 0.6 0.5 0.3 0.4 0.4 heat-oil 0.2 0.2 0.3 0.3 0.1 jet-fuel 0.1 0.2 0.3 0.2 0.2 lube-oil 0.0 0.0 0.0 0.0 0.2; * Define the optimization variables VARIABLES X(C) Crude oils used in kbbl per week Q(P) Amounts of products produced in kbbl X4 Total amount of crude 4 used in kbbl PROFIT Total profit from product sales in k$; POSITIVE VARIABLES X, X4, Q; * Define constraints and objective function EQUATIONS OBJFUN Objective function to be maximized CRUDE4 Total crude 4 usage PRODUCTION(P) Amounts of products produced;
Chen CL
13
OBJFUN.. PROFIT =E= SUM(P, Q(P)*PVALUE(P)) - SUM(C, TCOST(C)*X(C)); PRODUCTION(P).. Q(P) =E= SUM(C, YIELDS(P,C)*X(C)); CRUDE4.. X4 =E= X("4-fuel") + X("4-lube"); * Define upper and lower bounds * Upper bounds on amounts of product produced from their maximum dema Q.UP(P) = PDEMAND(P); * Upper bounds on crude oil usages from their supplies X.UP(C) = CSUPPLY(C); X4.UP = CSUPPLY("4-fuel"); * Define model and solve MODEL SCHEDULE /ALL/; SOLVE SCHEDULE USING LP MAXIMIZING PROFIT; DISPLAY X.L, Q.L, PROFIT.L;
Chen CL
14
Refinery Scheduling GAMS Results
x = [100, 100, 66.667, 0, 100]T (kbbl/wk, crude demands) Q = [170, 70, 70, 20]T (kbbl/wk, gas., heating oil, jet fuel, lube oil)
profit = 3400 k$/wk
Chen CL
15
Refinery Scheduling Linear Programming Formulation: Rearranged for MATLAB product sales
production cost
4
Max J =
5
−
v pQ p
p=1
C r xr
r=1
product sales
4
=
production cost
5
v p
p=1
5
a pr xr
−
r=1
C r xr
r=1
Q p
5
=
5
(v pa pr − C r ) xr =
r=1
Max J =
v tA − C T
x
=
f r xr
r=1 T
f x
Chen CL
16
s.t. xr ≤ S r Q p ≤ D p
⇒
x4 + x5 ≤ S 4
r = 1, 2, 3; p = 1, . . . , 4
1
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
1
1
a11 ..
··· ..
a15 ..
a41
···
a45
A
S 1 S 2
x1
S 3
x2 x3 x4 x5 x
≤
S 4
D1 D2 D3 D4 B
Chen CL
17
Refinery Scheduling MATLAB Code
YIELDS = [ 0.6 0.5 0.3 0.4 0.4 ; x = 0.2 0.2 0.3 0.3 0.1 ; 100.0000 0.1 0.2 0.3 0.2 0.2 ; 100.0000 0.0 0.0 0.0 0.0 0.2]; 66.6667 CSUPPLY = [100, 100, 100, 200 ]; 0.0000 PDEMAND = [170, 85, 85, 20 ]; 100.0000 PVALUE = [ 45, 30, 15, 60 ]; CCOST = [ 15, 15, 15, 25, 25]; Q = OCOST = [ 5, 8.5, 7.5, 3, 2.5]; 170.0000 TCOST = CCOST + OCOST ; 70.0000 f = [- PVALUE*YIELDS + TCOST]; 70.0000 A = [1 0 0 0 0 ; 20.0000 0 1 0 0 0 ; 0 0 1 0 0 ; PROFIT = 0 0 0 1 1 ; YIELDS ] ; 3.4000e+003 B = [CSUPPLY, PDEMAND]’ ; lb = zeros(5,1); ub = CSUPPLY’; x0 = [0; 0; 0; 0; 0]; %x0=[50;50;50;50;50]; options = optimset(’LargeScale’,’off’) [x,NPROFIT] = linprog(f,A,B,[],[],lb,ub,x0,options);
Chen CL
18
A Heat Exchange Network Design Problem Stream
F C p (kW/K)
T in (K)
T out (K)
H1 H2 H3 H4
20 40 70 94
700 600 460 360
410 310 310 310
C1 C2
50 180
350 300
650 400
Utility
Temp. (K)
Cost ($/KW-yr)
Max available (kW)
Fuel HP steam
750 510 410 300 − 325
120 90 70 15
∞ 1000 500 ∞
LP steam Cooling water
min. temperature approach = 10 K H1 is not to be allowed to exchange any heat with C1
Chen CL
19
Transshipment LP Model Heat Contents of Process Streams Interval
T hot 700
T cold
800
-
-
-
-
-
1200
-
-
- 3000
-
1800
3600
-
- 4500
-
1000
2000
-
- 2500
-
1000
2000
3500
- 2500
-
-
2000
3500
-
-
2000
3500
4700
2500
9000
350
6 310
C2
400
5 360
C1
450
4 410
H4
500
3 460
H3
590
2 510
H2
650
1 600
H1 690
0 660
Heat Contents
300
- 9000
Chen CL
20
Heat Exchanger Network Design Transshipment Model for Heat Flows
Chen CL
21
Condensed Transshipment LP Model Notations Assume
:
R1∼5
any pair of heat/cold streams can exchange heat heat residuals
Qfuel ,
QHP , QLP , QW : heating and cooling loads
H k = {i| hot stream i supplies heat to interval k} C k = { j | cold stream j demands heat from interval k} S k = {m| hot utility m supplies heat to interval k} W k = {n| cold utility n extracts heat from interval k} S = set of hot utilities W = set of cold utilities
Note
:
Rk = 0 means pinch point
Chen CL
22
Condensed Transshipment LP Model Heat Flows in Interval k Par.s
QH ik
heat contents of hot stream i in interval k
QC jk
heat contents of hot stream i in interval k
cm, cn
unit costs of hot stream m and cold stream n
W Var.s QS , Q heat loads of hot (cold) utility m (n) m n
Rk heat residual exiting interval k
Chen CL
23
Condensed Transshipment LP Model LP Formulation min
m∈S
s.t.
cmQS m
n∈W
QH ik +
Rk−1 +
i∈H k
QS m ≥ 0, Rk ≥ 0,
cnQW n
+
QS m
m∈S k
QW n ≥ 0,
R0 = R K = 0
= Rk +
j ∈C k
QC jk +
QW n
n∈W k
k = 1, · · · , K − 1
Chen CL
24
Expanded Transshipment LP Model Heat Exchange Between Hot and Cold Streams
⇒
Chen CL
25
Expanded Transshipment LP Model
Heat Flows Between Hot/Cold Streams in Interval k
H k= {i| hot stream i supplies heat to interval k or at a higher interval} S k= {m| hot utility m supplies heat to interval k or at a higher interval Qijk = exchange of heat of hot stream i and cold stream j at interval k Qmjk = exchange of heat of hot utility m and cold stream j at interval k Qink= exchange of heat of hot stream i and cold utility n at interval k Rik= heat residual of hot stream i exiting interval k Rmk= heat residual of hot utility m exiting interval k
Chen CL
26
Expanded Transshipment LP Model LP Formulation
min
cmQS m
+
m∈S
s.t.
n∈W
Ri,k−1 +
QH ik
= Rik +
cnQW n
Qijk +
j ∈C k
Rm,k−1 +
i∈H k
QS m
Qijk +
= Rmk +
Qink k ∈ K, i ∈ H k
n∈W k
Qmjk
j ∈C k Qmjk = QC jk
k ∈ K, m ∈ S k k ∈ K, j ∈ C k
m∈S k Qink = QW n
k ∈ K, n ∈ W k
i∈H k
W Rik , Rmk , Qijk , Qmjk , Qink , QS m, Qn ≥ 0 Qijk = 0 for i = 1, j = 1, k ∈ K
Ri0 = RiK = 0 (forbidden match)
K
QL ij ≤
k=1
Qijk ≤ QU ij
∀i, j
(lower/upper bound
Chen CL
27
Expanded Transshipment LP Model GAMS Code $offsymxref offsymlist * filename: TRANS.gms * LP transhipment model with restricted matches * Reference: Papoulias, S.A. and I.E. Grossmann, "A Structural Optimization * Approach in Process Synthesis. II: Heat Recovery Networks", Computers and * Chemical Engineering, 7, 707 (1983) * Authors: Nikolaos V. Sahinidis and I.E. Grossmann option limrow=0, limcol=0, solprint=off; *================= input data SETS H C S W K
hot streams /1*4/ cold streams /1*2/ hot utilities /1*3/ cold utilities /1*1/ temperature intervals (only an upper bound needed) /1*50/;
PARAMETER FCPH(H) FCp of hot streams / 1 20 2 40 3 70 4 94 /; PARAMETER FCPC(C) FCp of cold streams
Chen CL / 1 50 2 180 /; PARAMETER TINH(H) inlet T of hot streams / 1 700 2 600 3 460 4 360 /; PARAMETER TOUTH(H) outlet T of hot streams / 1 420 2 310 3 310 4 310 /; PARAMETER TINC(C) inlet T of cold streams / 1 350 2 300 /; PARAMETER TOUTC(C) outlet T of cold streams / 1 650 2 400 /; PARAMETER TINS(S) hot util temp / 1 750 2 510 3 410 /; PARAMETER TINW(W) cold util temp / 1 300 /; PARAMETER DT minimum T approach ; DT=10; PARAMETER CS(S) hot utility cost / 1 120 2 90 3 70 /;
28
Chen CL
29
PARAMETER / PARAMETER /
CW(W) cold utility cost 1 15 /; AS(S) availability of hot util 1 INF 2 1000 3 500 /; PARAMETER AW(W) availability of cold util / 1 INF /; *===== bounds for heat exchange (imposed and restricted matches) PARAMETER QLHC(H,C) Lower bound between hot and cold stream ; PARAMETER QUHC(H,C) Upper bound between hot and cold stream ; PARAMETER QLHW(H,W) Lower bound between hot stream and cold utility PARAMETER QUHW(H,W) Upper bound between hot stream and cold utility PARAMETER QLCS(C,S) Lower bound between cold stream and hot utility PARAMETER QUCS(C,S) Upper bound between cold stream and hot utility QLHC(H,C) QUHC(H,C) QLHW(H,w) QUHW(H,W) QLCS(C,S) QUCS(C,S) * * * * * * *
= = = = = =
0 ; INF ; 0 ; INF ; 0 ; INF ;
QUHC(’1’,’1’) = 0 ;
these could also be inserted in table format ... imposed matches table QLHC(H,C) 1 2 3 4 1 2 3
; ; ; ;
Chen CL * 4 * 5
30 ;
*================= parameter evaluations *=== temperature intervals PARAMETERS HK(H,K) nonzero (1) elements define set H’(k) - existence CK(C,K) nonzero (1) elements define set C(k) - existence SK(S,K) nonzero (1) elements define set S’(k) - existence WK(W,K) nonzero (1) elements define set W(k) - existence QH(H,K) heat content of hot streams at each interval QC(C,K) heat content of cold streams at each interval QHT(H) total heat content of hot stream QCT(C) total heat content of cold stream TH(K) interval temperature (hot) TC(K) interval temperature (cold) ; PARAMETERS IS(S),IW(W),IH(H),IC(C); * when these become 1, the corresponding stream inlet T * has been considered for interval evaluations HK(H,K)=0; CK(C,K)=0; SK(S,K)=0; WK(W,K)=0; QH(H,K)=0; QC(C,K)=0; TH(K)=0; TC(K)=0; PARAMETER KM actual temperature intervals ; PARAMETERS IEND,AUX; KM=0;IEND=0;IS(S)=0;IW(W)=0;IH(H)=0;IC(C)=0;AUX=0; PARAMETERS HMAX,CMIN; HMAX=SMAX(H,TINH(H)); CMIN=SMIN(C,TINC(C)); IS(S) $(TINS(S) GE HMAX)=1;
Chen CL IW(W) $(TINW(W) LE CMIN)=1; LOOP (K $ (IEND EQ 0), AUX=0; LOOP (S $((IS(S) EQ 0) AND (TINS(S) GT AUX)), AUX=TINS(S)); LOOP (H $((IH(H) EQ 0) AND (TINH(H) GT AUX)), AUX=TINH(H)); LOOP (W $((IW(W) EQ 0) AND (TINW(W) GT AUX)), AUX=TINW(W)+DT); LOOP (C $((IC(C) EQ 0) AND (TINC(C) GT AUX)), AUX=TINC(C)+DT); TH(K)=AUX; TC(K)=TH(K)-DT; IS(S) $(TINS(S) EQ AUX)=1; IW(W) $(TINW(W) EQ (AUX-DT))=1; IH(H) $(TINH(H) EQ AUX)=1; IC(C) $(TINC(C) EQ (AUX-DT))=1; IF (((SUM(S,IS(S))+SUM(H,IH(H))+SUM(W,IW(W))+SUM(C,IC(C))) EQ (CARD(S)+CARD(H)+CARD(W)+CARD(C))), IEND=1;KM=ORD(K)-1 ) ); *=== heat contents of streams LOOP (K $ (ORD(K) LE KM), HK(H,K)=1 $((TINH(H) GE TH(K)) AND (TOUTH(H) LT TH(K))); CK(C,K)=1 $((TINC(C) LE TC(K+1)) AND (TOUTC(C) GT TC(K+1))); SK(S,K)=1 $(((TINS(S) GE TH(K)) AND (TINS(S) LT TH(K-1))) OR ((TINS(S) GE TH(K)) AND (ORD(K) EQ 1))); WK(W,K)=1 $(((TINW(W) LE TH(K)) AND (TINW(W) GT TH(K+1))) OR ((TINW(W) LE TH(K)) AND (ORD(K) EQ KM))) ); LOOP (K, LOOP (H $(HK(H,K) EQ 1),
31
Chen CL
32
QH(H,K)=FCPH(H)*(TH(K)-TH(K+1)); IF ((TOUTH(H) GT TH(K+1)), QH(H,K)=FCPH(H)*(TH(K)-TOUTH(H))) ); LOOP (C $(CK(C,K) EQ 1), QC(C,K)=FCPC(C)*(TC(K)-TC(K+1)); IF ((TOUTC(C) LT TH(K)), QC(C,K)=FCPC(C)*(TOUTC(C)-TC(K+1))) ) ); QHT(H) = FCPH(H) * ( TINH(H) - TOUTH(H) ) ; QCT(C) = FCPC(C) * ( TOUTC(C) - TINC(C) ) ; * ===================== model POSITIVE VARIABLES RH(H,K) heat residual of hot stream H exiting interval K RS(S,K) heat residual of hot utility S exiting interval K QHC(H,C,K) heat exchange between hot H and cold C in interval K QHW(H,W,K) heat exchange between hot H and cold util W in interval K QSC(S,C,K) heat exchange between hot util S and cold C in interval K QS(S) heating load for hot utility S QW(W) cooling load for cold utility S ; VARIABLE UTILITY total utility-cost ; EQUATIONS OBJ1 HBAL(H,K) CBAL(C,K) SBAL(S,K) WBAL(W,K) hcIMPOSE(H,C)
objective function for minimum utility consumption hot stream HEAT BALANCES cold stream HEAT BALANCES hot utility HEAT BALANCES cold utility HEAT BALANCES imposed match between hot and cold stream
Chen CL hcRESTRICT(H,C) hwIMPOSE(H,W) hwRESTRICT(H,W) csIMPOSE(C,S) csRESTRICT(C,S)
33 restriction between hot and cold stream imposed match between hot stream and cold utility restriction between hot stream and cold utility imposed match between cold stream and hot utility restriction between cold stream and hot utility
OBJ1 .. UTILITY =E= SUM ( S, CS(S)*QS(S) ) + SUM ( W, CW(W)*QW(W) ) ; HBAL(H,K) $ ( (TINH(H) GE TH(K)) AND (ORD(K) LE KM) ) .. RH(H,K) - ( RH(H,K-1) $ (HK(H,K-1) EQ 1) ) + SUM (C $ (CK(C,K) EQ 1), QHC(H,C,K) ) + SUM (W $ (WK(W,K) EQ 1), QHW(H,W,K) ) =E= QH(H,K); RH.FX(H,K) $ (ORD(K) EQ KM)= 0; SBAL(S,K) $ ( (TINS(S) GE TH(K)) AND (ORD(K) LE KM) ) .. RS(S,K) - ( RS(S,K-1) $ (TINS(S) GE TH(K-1)) ) + SUM (C $ (CK(C,K) EQ 1), QSC(S,C,K) ) - ( QS(S) $ ( (TINS(S) EQ TH(K)) OR (ORD(K) EQ 1) ) ) =E= 0 ; RS.FX(S,K) $ (ORD(K) EQ KM)= 0; CBAL(C,K) $ ( CK(C,K) EQ 1 ) .. SUM ( H $ (TINH(H) GE TH(K)), QHC(H,C,K) ) + SUM ( S $ (TINS(S) GE TH(K)), QSC(S,C,K) ) =E= QC(C,K) ; WBAL(W,K) $ ( WK(W,K) EQ 1 ) .. SUM ( H $ (TINH(H) GE TH(K)), QHW(H,W,K) ) =E= QW(W) ; QS.UP(S) $(AS(S) LT INF)=AS(S);
;
Chen CL QW.UP(W) $(AW(W) LT INF)=AW(W); hcIMPOSE(H,C) $ (QLHC(H,C) GT 0) .. QLHC(H,C) =L= SUM ( K $ ( (ORD(K) LE KM) AND (CK(C,K) EQ 1) ), QHC(H,C,K) ) ; hcRESTRICT(H,C) $ (QUHC(H,C) LT INF) .. SUM ( K $ ( (ORD(K) LE KM) AND (CK(C,K) EQ 1) ), QHC(H,C,K) ) =L= QUHC(H,C) ; hwIMPOSE(H,W) $ (QLHW(H,W) GT 0) .. QLHW(H,W) =L= SUM ( K $ ( (ORD(K) LE KM) AND (WK(W,K) EQ 1) ) , QHW(H,W,K) ) ; hwRESTRICT(H,W) $ (QUHW(H,W) LT INF) .. SUM ( K $ ( (ORD(K) LE KM) AND (WK(W,K) EQ 1) ) , QHW(H,W,K) ) =L= QUHW(H,W) ; csIMPOSE(C,S) $ (QLCS(C,S) GT 0) .. QLCS(C,S) =L= SUM ( K $ ( (ORD(K) LE KM) AND (CK(C,K) EQ 1) ) , QSC(S,C,K) ) ; csRESTRICT(C,S) $ (QUCS(C,S) LT INF) .. SUM ( K $ ( (ORD(K) LE KM) AND (CK(C,K) EQ 1) ) , QSC(S,C,K) ) =L= QUCS(C,S) ; MODEL TRANS / ALL /; SOLVE TRANS MINIMIZING UTILITY USING LP; DISPLAY UTILITY.L, RH.L, RS.L, QHC.L, QHW.L, QSC.L, QS.L, QW.L ;
34
Chen CL
35
Expanded Transshipment LP Model Results (H1-C1 is Forbidden)
fuel
3900 kW
high pressure steam cold utility min utility cost
500 kW 3800 kW 570, 000 $/year
Chen CL
36
Linear Programming: Simple Examples
Case 1: unique solution
Min f = −4x1 − x2 + 50 s.t. x1 − x2 ≤ 2 x1 + 2x2 ≤ 8 x1, x2 ≥ 0
Chen CL
37
Linear Programming: Simple Examples
Case 2: non-unique solution
Min f = −x1 + x2 + 30 s.t. x1 − x2 ≤ 2 x1 + 2x2 ≤ 8 x1, x2 ≥ 0
Chen CL
38
Linear Programming: Simple Examples
Case 3: unbounded solution
Min f = −4x1 − x2 + 50 s.t. x1 − x2 ≤ 2 x1, x2 ≥ 0
Chen CL
39
Linear Programming: Simple Examples
Case 4: no feasible solution
Min f = −4x1 − x2 + 50 s.t. x1 − x2 ≤ −5 x1 + 2x2 ≤ 8 x1, x2 ≥ 0
Chen CL
40
MATLAB Plot for Case 1 % LP: Case 1 - Single solution Min f = −4x1 − x2 + 50 [x1,x2] = meshgrid(0:0.1:6, 0:0.1:6); s.t. x1 − x2 ≤ 2 f = -4*x1-2*x2+50; x1 + 2x2 ≤ 8 g1 = x1-x2-2; g2 = x1+2*x2-8; x1, x2 ≥ 0 g3 = -x1; g4 = -x2; cla reset; set(gca,’XTick’,[0,2,4,6],... ’YTick’,[0,2,4,6],... ’XTickLabel’,{’0’,’2’,’4’,’6’},... ’YTickLabel’,{’0’,’2’,’4’,’6’},... ’FontSize’,16,’LineWidth’,3) xLabel(’\bf x_1’,’FontSize’,16,’Color’,[0,0,0]) yLabel(’\bf x_2’,’FontSize’,16,’Color’,[0,0,0]) title(’\bf LP Case 1: unique solution’,... ’FontSize’,16,’Color’,[0,0,0])
Chen CL
hold on cv = fv = const1 = const2 = const3 = const4 = fs =
41
Min f = −4x1 − x2 + 50 [0 0]; s.t. x1 − x2 ≤ 2 [25, 30, 35, 40, 45]; x1 + 2x2 ≤ 8 contour(x1,x2,g1,cv,’r’,’LineWidth’,3); x1, x2 ≥ 0 contour(x1,x2,g2,cv,’b’,’LineWidth’,3); contour(x1,x2,g3,cv,’k’,’LineWidth’,3); contour(x1,x2,g4,cv,’k’,’LineWidth’,3); contour(x1,x2,f,fv,’k-’); clabel(fs) text(3.1, 1,’\bf\leftarrow g_1:x_1- x_2=2’,’FontSize’,12, text(1.3,3.5,’\bf\leftarrow g_2:x_1+2x_2=8’,’FontSize’,12, text( 1,0.2,’\bf g_3’,’FontSize’,12) text(0.1, 2,’\bf g_4’,’FontSize’,12) plot( 4, 2,’g’,’Marker’,’o’,’MarkerSize’,6) text( 1, 2,’\it\bf FR’, ’FontSize’,14) text(3.75,2.75,’\it\bf Infeasible Region’,’FontSize’,14) hold off
Chen CL
42
MATLAB Solution for Case 1 % Linear programming: Min % Single solution (Case 1) s.t. % f = [-4 -1]; A = [ 1 -1 ; 1 2]; B = [ 2; 8]; x0 = [ 1; 1]; lb = zeros(2,1); options = optimset(’LargeScale’,’off’) [x,fval,exitflag,output,lambda] = ... linprog(f,A,B,[],[],lb,[],x0,options) x, fval = fval + 50
f = −4x1 − x2 + 50 x1 − x2 ≤ 2 x1 + 2x2 ≤ 8 x1, x2 ≥ 0
x = 4.0000 2.0000 fval = 32.0000
Chen CL
43
MATLAB Solution for Case 2 % Linear programming: Min f = −x1 + x2 + 30 % Multiple solutions (Case 2) s.t. x1 − x2 ≤ 2 % x1 + 2x2 ≤ 8 f = [-1 1]; x1, x2 ≥ 0 A = [ 1 -1 ; 1 2]; B = [ 2; 8]; lb = zeros(2,1); x0 = x0 = x0 = [ 0; 0]; 0 0 %x0 = [ 0; 4]; 0 4 options = optimset(’LargeScale’,’off’) x = x = [x,fval,exitflag,output,lambda] =... 2 3 linprog(f,A,B,[],[],lb,[],x0,options) 0 1 x0, x, fval = fval + 30 fval = fval = 28 28
Chen CL
44
A Standard Linear Programming Problem
n
Min: f f ((x) = c1x1 + · · · + cnxn
=
c j x j
(f = cT x)
j=1 j =1 n
s.t. a11x1 + · · · + a1nxn = b1
=
a1 j x j
j=1 j =1
···
···
···
···
(Ax = b)
n
am1x1 + · · · + amnxn = bm =
amj x j
j=1 j =1
x j ≥ 0, b j ≥ 0; (x ≥ 0
b ≥ 0)
Chen CL
45
−2y1 + y2 ≤ −4 ⇒ 2y1 − y2 ≥ 4
2y1 − y2≥4 ⇒ 2y1 − y2 − s1 = 4, s1 : surplus variable
2y1 − y2≤4 ⇒ 2y1 − y2 + s2 = 4, s2 : slack variable
2y1 − y2 = 4, y2 : unrestricted in sign ⇒ 2y1 − (y2+ − y2− ) = 4, y2+ , y2− ≥ 0
max z ⇒
min f = −z
Chen CL
46
Conversion to Standard LP Form
Max: z = 2y1 + 5y2 s.t. 3y1 + 2y2 ≤ 12 2y1 + 3y2 ≥ 6 y1 ≥ 0, y2 : unrestricted in sign
⇓ Max: z = 2y1 + 5(y 5(y2+ − y2− ) s.t. 3y1 + 2(y 2(y2+ − y2− ) ≤ 12 2y1 + 3(y 3(y2+ − y2− ) ≥ 6 y1, y2+ , y2− ≥ 0
Chen CL
47
⇓ 5(y2+ − y2− ) Max: z = 2y1 + 5(y s.t. 3y1 + 2(y 2(y2+ − y2− ) + s1 = 12 2y1 + 3(y 3(y2+ − y2− ) − s2 = 6 y1, y2+ , y2− , s1, s2 ≥ 0
⇓ Min: f = −2x1 − 5x2 + 5x3 s.t. 3x1 + 2x2 − 2x3 + x4 = 12 2x1 + 3x2 − 3x3 − x5 = 6 xi ≥ 0
Chen CL
48
Basic Concepts Related to Linear Programming Problems
All functions are linear ⇒ minimize convex (cost) function on a convex set, or ⇒ maximize concave (profit) function on a convex set, ⇒ global optimum if optimum solution exists
The solution always lies on the boundary of the feasible region if it exists (some constraints are active at the optimum)
Chen CL
49
Basic Concepts Related to Linear Programming Problems Example: profit maximization problem
Max: z = 400x1 + 600x2 s.t. x1 + x2 ≤ 16 1 28 x1 + 1 14 x1 +
1 14 x2 1 24 x2
x1, x2 ≥ 0
≤1 ≤1
Chen CL
50
⇓ Max: z = 400x1 + 600x2 s.t. x1 + x2 + x3 = 16 1 28 x1 + 1 14 x1 +
1 14 x2 + 1 24 x2 +
x4 = 1 x5 = 1
xi ≥ 0
⇓ x3 = 16 − x1 − x2 1 1 x4 = 1 − 28 x1 − 14 x2 1 1 x5 = 1 − 14 x1 − 24 x2
z = 400x1 + 600x2 (xi ≥ 0)
Infinite number of solutions with different z values
Chen CL
51
n = 5 variables, m = 3 constraints (n > m): ⇒ infinite # of solutions A solution obtained by setting n − m = 2 variables to zero is called a basic solution
⇒ Ten basic solutions (on vertices); five basic feasible solutions x1
x2
x3
x4
x5
z
1 2
0 0
0 16
16 0
1
1
0
3 4
0 0
14 24
2 −8
− 27 0 − 57
1 3 5 12
5 6
16 28
0 0
0 −12
7 8 9 10
14 4 11.2
0 12 4.8
2 0 0
0
130 17
168 17
− 26 17
0
3 7
0 1 2 1 5
− 8400 0 − − 27 − −1 − 0 5600 3 14 8800 0 7360 0 −
infeasible infeasible infeasible infeasible
infeasible
Chen CL
52
MATLAB Code % ProfMax_V2.m (modified from ProfMax.m) a1 = 0; a2 = 30; b1 = 0; b2 = 30; x1 = [a1 : 0.1 : a2]; y1 = 16-x1; y2 = 14-14/28*x1; y3 = 24-24/14*x1; y4 = 0*x1; figure(’name’,’axis property’) hold on plot(x1,y1,’b’,’linewidth’,3) plot(x1,y2,’r’,’linewidth’,3) plot(x1,y3,’Color’,[0,.5,0],’linewidth’,3) set(gca,’xlim’,[a1 a2],’ylim’,[b1 b2],’linewidth’,3,’fontsize’,14) xlabel(’\bf x_1’,’fontsize’,16) ylabel(’\bf x_2’,’fontsize’,16) title(’\bf Profit maximization problem’,’fontsize’,16) text(1,15.3,’\bf\leftarrow x_1+x_2=16’, ’fontsize’,12,’Color’,[0,0,1] text(19,5.3,’\bf 1/28x_1+1/14x_2=1’, ’fontsize’,12,’Color’,[1,0,0] text(21,14-14/28*21+0.6,’\bf\downarrow’,’fontsize’,12,’Color’,[1,0,0]
Chen CL
53
text(7,24-24/14*7+0.3,’\bf\leftarrow 1/14x_1+1/24x_2=1’,... ’fontsize’,12,’Color’,[0,.5,0] text( 3, 5,’\bf FR’, ’fontsize’,14) text(15,20,’\bf Infeasible Region’,’fontsize’,14) text( 0, 0.6,’\bf 1’, ’fontsize’,12,’Color’,[1, 0, 0]) text( 0, 16,’\bf 2’, ’fontsize’,12,’Color’,[0,.5,.5]) text( 0, 13,’\bf 3’, ’fontsize’,12,’Color’,[1, 0, 0]) text( 0, 24,’\bf 4’, ’fontsize’,12,’Color’,[0,.5,.5]) text( 16, 0.6,’\bf 5’, ’fontsize’,12,’Color’,[0,.5,.5]) text( 28, 0.6,’\bf 6’, ’fontsize’,12,’Color’,[0,.5,.5]) text(12.5,0.6,’\bf 7’, ’fontsize’,12,’Color’,[1, 0, 0]) text(3.5,11.1,’\bf 8’, ’fontsize’,12,’Color’,[1, 0, 0]) text( 10, 4,’\bf 9’, ’fontsize’,12,’Color’,[1, 0, 0]) text( 8, 10,’\bf 10’,’fontsize’,12,’Color’,[0,.5,.5])
Chen CL
54
LP Terminology
Vertex (Extreme) Point: Feasible Solution:
Solution of constrained equations
satisfying nonnegativity conditions
Basic Solution: A solution of constrained equations obtained by setting n − m variables to zero. Variables set to zero are called nonbasic Remaining ones are called basic
Basic Feasible Solution: A basic solution satisfying nonnegativity conditions on variables
Degenerate Basic Solution: A solution with a zero-valued basic variable
Chen CL
Degenerate Basic Feasible Solution:
Optimum Solution:
55
A feasible solution with optimum cost function value
Optimum Basic Solution: A basic feasible solution with optimum cost function value
Convex Polyhedron: If the feasible region for an LP problem is bounded, it is called Convex Polyhedron
Basis: Columns of coefficient matrix A of constrained equations corresponding to basic variables are said to form a basis for the m−dimensional vector space. Any other m−dimensional vector can be expressed as a linear combination of the basis vectors.
Chen CL
56
Determination of Basic Solutions Max: z = 4x1 + 5x2 s.t. −x1 + x2 ≤ 4 x1 + x2 ≤ 6 x1, x2 ≥ 0 x1 x2 x3 x4
z
1
0
0
4
6
0 A
2
0
4
0
2 20 B
3
0
6 −2
0 − E (x)
4 −4
0
0 10 − F (x)
5
6
0 10
0 24 D
6
1
5
0 29 C
0
Max: z = 4x1 + 5x2
⇒
s.t. −x1 + x2 + x3 = 4 x1 + x2 + x4 = 6 x1, x2, x3, x4 ≥ 0
Chen CL
57
Optimum Solution for LP Problems
Theorem: Extreme points and basic feasible solutions The collection of feasible solutions for an LP problem constitutes a convex set whose extreme points correspond to basic feasible solutions.
Chen CL
58
Theorem: basic theorem of linear programming Let the m × n coefficient matrix A of constrained equations have full row rank, rank(A) = m. Then
If there is a feasible solution, there is a basic feasible solution (vertex), and If there is an optimum feasible solution, there is an optimum basic feasible solution. (one of the vertices of the convex polyhedron representing feasible soln)
Implications: optimum soln must be one of the basic feasible solns (vertices) ⇒ searching among finite basic feasible solns (at most m!(nn!−m)! vertices)
Chen CL
59
Basic Ideas of the Simplex Method
Last Theorem guarantees that one of the basic feasible solutions is an optimum for the LP problem
Basic ideas of the Simplex method is to proceed from one basic feasible solution to another in a way to continually decrease the cost function until the minimum is reached
A Simplex in n−dimensional space is a convex hull of any (n + 1) points which do not lie on one hyperplane. A convex hull of (n + 1) points is the smallest convex set containing all the points ⇒ the Simplex represents a convex set
Chen CL
60
Canonical Form
An m × n system of simultaneous equations with rank(A) = m is said to be in canonical form if each equation has a variable (with unit coefficient) that does NOT appear in any other equation x1
+a1,m+1xm+1 + a1,m+2xm+2 + · · · + a1,nxn
= b1
x2 ..
+a2,m+1xm+1 + a2,m+2xm+2 + · · · + a2,nxn ..
= b2 ..
xm +am,m+1xm+1 + am,m+2xm+2 + · · · + am,nxn = bm
or Note:
I (m)x(m) + Qx(n−m)
if x(n−m) = 0
then x(m)
=b =b
Chen CL
61
Tableau x1
+a1,m+1xm+1 + a1,m+2xm+2 + · · · + a1,nxn
= b1
x2 ..
+a2,m+1xm+1 + a2,m+2xm+2 + · · · + a2,nxn ..
= b2 ..
xm +am,m+1xm+1 + am,m+2xm+2 + · · · + am,nxn = bm
⇓ Basic x1 x2 · · · xm xm+1
···
xn RHS
x1
1 0 ···
0
a1,m+1 a1,m+2 · · · a1,n
b1
x2 ..
0 1 ···
0
a2,m+1 a2,m+2 · · · a2,n .. ..
b2 ..
xm
0 0 ···
···
1 am,m+1 am,m+2 · · · am,n bm
Chen CL
62
Example: canonical form and basic feasible solution Min: f = −2x1 − x2 s.t. 4x1 + 3x2 + x3 = 12 2x1 + x2 + x4 = 4 x1 + 2x2 + x5 = 4, Basic x1 x2 x3 x4 x5
xi ≥ 0
b basic solution
x3 4 3 1 0 0 12 x1 = x 2 = 0 x4 2 1 0 1 0 4 x3 = 12, x4 = 4, x5 = 4 x5 1 2 0 0 1 4 f = 0
One possible basic feasible solution x1 = x2 = 0, ⇒ x3 = 12, x4 = 4, x5 = 4; f = 0
Q: optimum solution ? We need to try another basic feasible solution!
Chen CL
63
Pivot Step: Interchange of Basic and Nonbasic Variables
Pivot Step: starting from a basic feasible solution, find another one to decrease cost by interchanging a current basic variable with a non-basic variable
Pivot Row: the row used for elimination process
Pivot Column: the column on which the elimination is performed
Chen CL
64
Pivot Operation
Inte Interc rcha hange nge of Basi Basicc and and Nonba Nonbasi sicc Va Variab riable less Min: f = −2x1 − x2 s.t. 4x1 + 3x2 + x3 = 12 2x1 + x2 + x4 = 4 x1 + 2x2 + x5 = 4, Basic x1 x2 x3 x4 x5
xi ≥ 0
b basic solution
x3 4 3 1
0 0 12 x1 = x2 = 0
x4 2 1 0
1 0 4 x3 = 12 12,, x4 = 4, x5 = 4
x5 1 2 0
0 1 4 f = 0
x3 0 1 1 −2 0 4 x2 = x4 = 0 x1 1 x5 0
1 2 3 2
0 0
1 2 − 12
0 2 x3 = 4, x1 = 2, x5 = 2 1 2 f = −4
Chen CL
65
Basic Steps of The Simplex Method
Three basic questions:
Is the current basic feasible solution optimal ? If not, How Ho w to choose a current nonbasic nonbasic variab variable le that should should beco become me basi basicc ? Which variable from the the current basic set should becom becomee nonb nonbas asic ic ?
Chen CL
66
Example:
steps
of
the
Simplex
method
Max: z = 2x1 + x2 = − f (min f ) f ) s.t. 4x1 + 3x2 ≤ 12 2x1 + x2 ≤ 4 x1 + 2x2 ≤ 4 x1, x2 ≥ 0
⇒z ∗ = 4 along C D
Chen CL
67
In standard LP form: Min:
f = −2x1 − x2
s.t. 4x1 +
3x2 + x3
= 12
2x1 +
x2
x1 +
2x2
xi ≥
0
⇒ NBs:
x1 =
0
x2 =
0
BVs:
x3 =
12
x4 =
4
f =
0
z =
0
2x1 − x2 =
0
Note: −f −
+ x4 +
=
4
x5 =
4
(A) x5 =
4
Chen CL
68
Basic −f
x1
x2 x3 x4 x5
b
x3
0
4
3
1
0
0 12
x4
0
2
1
0
1
0
4
x5
0
1
2
0
0
1
4
1 −2 −1
0
0
0
0
−f
bi/aic 12 4 4 2 4 1
=3 =2 =4
Cost row has nonzero entries only in nonbasic columns (x1, x2) If all nonzero entries are nonnegative ⇒ optimum soln (?) Currently, TWO negative entries ⇒ NOT optimum Select x1 to become basic (?) ⇒ elimination in x1 column
To keep cost fcn right: −f − 2x1 − x2 + 0x3 + 0x4 + 0x5 = 0 If letting x 1 = 0, x 2 = 0 → 1 then f = 0 → −1;
If x 1 = 0 → 1, x2 = 0, f = 0 → −2
Take ratios of RHS par.s with positive elements in x1 col. ⇒ select x4 to become nonbasic (smallest ratio) ⇒ pivot element is a21 = 2 Constraint: 2x1 + x2 + 0x3 + x4 + 0x5 = 4; If x1 = 0 → 1, x2 = 0, x4 = 4 → 2;
If x1 = 0 → 2, x2 = 0, x4 = 4 → 0
Chen CL
69
Basic −f
x1 x2 x3
x4 x5
b bi/aic
x3
0
0
1
1 −2
0 4
x1
0
1
0
0
0
0
1 2 − 12
0 2
x5
1 2 3 2
−f
1
0
0
0
1
0 4
NBs: x2 =
0
x4 = 0
BVs: x3 =
4
x1 = 2
f = −4
z = 4
1 2
(D) x5 = 2
All coefficients in last row are nonnegative ⇒ no further decrease of cost is possible ⇒ optimum Cost coefficient corresponding to nonbasic variable x2 is zero ⇒ multiple solutions
Chen CL
70
What happens if we do not select a row with the least ratio as the pivot row ? If interchange nonbasic var x1 with basic var x5 ⇒ not feasible !
Basic −f x1 x2 x3 x4 x5
b
x3
0
4
3 1 0
0 12
x4
0
2
1 0 1
0
4
x5
0
1
2 0 0
1
4
1 −2 −1 0 0
0
0
−f
bi/aic 12 4 4 2 4 1
=3 =2 =4
x3
0
0 −5 1 0 −4 −4 not feasible !
x4
0
0 −3 0 1 −2 −4 not feasible !
x1
0
1
2 0 0
1
4
−f
1
0
3 0 0
4
8
Chen CL
71
Basic Ideas and Procedures of the Simplex Method
The method needs an initial basic feasible solution (canonical form) to initiate the search for the optimum solution ≤ type ⇒ slack variable ≥, = type: ⇒ surplus variable ?? (⇒ artificial variable)
The cost function must be expressed in terms of only the NBs ⇒ last row in Simplex tableau to eliminate BVs during pivot step
Coefficients in last row corresponding to BVs are zero, and all those corresponding to NBs are nonzero. If any of the nonzero entries in last row is negative ⇒ not optimum Otherwise, an optimum solution has been reached
Chen CL
72
If optimum is not reached ⇒ interchange a current BV with a NB A NB with most negative coefficient is selected to become basic (⇒ pivot column) Take ratios of RHS values with positive elements in pivot column, identify the row with smallest ratio as the pivot row and the BV associated with it should become NB
If all entries in pivot column are negative ⇒ unbounded problem
After identifying pivot column and row ⇒ pivot step to obtain a new basic feasible solution
Repeat preceding steps until an answer is obtained
Chen CL
73
Derivation of the Simplex Method Selection of A Basic Variable to Become Nonbasic
Assume xc is a NB tapped to become a BV ⇒cth NB column replace some current basic column ⇒xc is to become a basic ⇒xc ≥ 0 (after interchange, all zero elements in cth column except unit element at one location)
x1
+a1,m+1xm+1 + · · · + a1cxc + · · · + a1,nxn
= b 1
x2
+a2,m+1xm+1 + · · · + a2cxc + · · · + a2,nxn
= b 2
···
···
···
···
xm +am,m+1xm+1 + · · · + amcxc + · · · + am,nxn = b m
Chen CL
74
Pivoting ⇒ new canonical form (still keep equality constraints): x1
+ a1,m+1xm+1 + · · · + a1,nxn
= b1 − a1cxc ≥ 0
x2
+ a2,m+1xm+1 + · · · + a2,nxn
= b2 − a2cxc ≥ 0
···
···
···
···
xm
+ am,m+1xm+1 + · · · + am,nxn
⇒
xi = bi − aicxc ≥ 0 if aic < 0 for all xc ≥ 0
⇒
= bm − amcxc ≥ 0
xi = bi − aicxc = 0 if aic > 0 and xc = abici br bi maximum allowable x c = min to keep all x i ≥ 0 arc aic aic > 0 i = 1 ∼ m
Select the row index r giving the least ratio of RHS parameter with positive element in c column If all aic are non-positive in the cth column, then xc can be increased indefinitely ⇒ unbounded problem !
Chen CL
75
Derivation of the Simplex Method Selection of A Nonbasic Variable to Become Basic n
xi = bi −
cixi +
cj xj
j =m+1
ci bi −
aij xj
j=m+1
n
bici +
i=1
j =m+1
f 0
n
cj xj
= f 0 +
j =m+1
n
n
i=1 m
=
n
i=1 m
=
i=1∼m
aij xj ;
j =m+1
m
⇒ f =
+
cj xj
j =m+1 m
cj −
aij ci xj
i=1 cj
Chen CL
76
Expressing cost function in terms of present NB ⇒cj : reduced cost coefficients (in last row of Simplex tableau)
For cj < 0 ⇒ increasing xj (to become a BV) can decrease f (?) Choose the NB associated with the most negative cj to decrease f
If a cj = 0 ⇒ associated NB can be made basic without affecting f
If all cj ≥ 0 ⇒ it is not possible to decrease f ⇒ current basic feasible solution is optimum
When all cj > 0 ⇒ unique optimum
If at least one cj = 0 ⇒ a possibility of alternate optima
If the NB associated with the negative reduced cost coefficient cj cannot be made basis (all aij in cj column are negative), then the feasible solution is unbounded
Chen CL
77
Theorem: improvement of basic feasible solution Given a nondegenerate basic feasible solution with corresponding cost function f 0, suppose cj < 0 for some j. Then there is a feasible solution with f < f 0. If the jth NB column associated with cj can be substituted for some column in the original basis, then the new basic feasible solution will have f < f 0. If the jth column cannot be substituted to yield a basic feasible solution, then the feasible region (constraint set) is unbounded and the cost function can be made arbitrarily small.
Theorem: optimum solution for LP problem If a basic feasible solution has reduced cost coefficients cj ≥ 0 for all j, then it is optimum
Chen CL
78
Ex: Solution by the Simplex Method Max: z = 4x1 + 5x2 (min f = −4x1 − 5x2) s.t. −x1 + x2 + x3 = 4 x1 + x2 + x4 = 6, xi ≥ 0 Basic −f x1 x2 x3 x4 b bi/aic x3 0 −1 1 1 0 4 41 = 4 x4 0 1 1 0 1 6 61 = 6 −f 1 −4 −5 0 0 0 x2 0 −1 1 1 0 4 x4 0 2 0 −1 1 2 22 = 1 −f 1 −9 0 5 0 20 x2 0 0 1 12 12 5 x1 0 1 0 − 12 12 1 −f 1 0 0 12 92 29
Chen CL
Ex: Solution by the Simplex Method Max: z = 400x1 + 600x2 = −f 1 1 s.t. x1 + x2 + x3 = 16, x + 1 28 14 x2 + x4 = 1 1 1 x + 1 14 24 x2 + x5 = 1 xi ≥ 0 Basic −f x1 x2 x3 x4 x5 b bi/aic x3 0 1 1 1 0 0 16 16 x4 0 1/28 1/14 0 1 0 1 14 x5 0 1/24 1/24 0 0 1 1 24 −f 1 −400 −600 0 0 0 0 x3 0 1/2 0 1 −14 0 2 4 x2 0 1/2 1 0 14 0 14 28 x5 0 17/336 0 0 7/12 1 5/12 140/17 0 0 8400 0 8400 −f 1 −100 − x1 0 1 0 2 −28 0 4 x2 0 0 1 −1 28 0 12 − x5 0 0 0 −17/168 2 1 3/14 − 0 0 200 5600 0 8800 −f 1
79
Chen CL
80
Ex: LP with Multiple Solutions Max: z = x 1 + 0.5x2 = −f (min f ) s.t. 2x1 + 3x2 ≤ 12 Basic x3 x4 −f x3 x1 −f x2 x1 −f
2x1 + x2 ≤ 8 x1, x2 ≥ 0 −f x1 x2 x3 x4 b bi/aic 0 2 3 1 0 12 12 2 =6 0 2 1 0 1 8 82 = 4 1 −1 − 12 0 0 0 0 0 2 1 −1 4 42 = 2 0 1 12 0 12 4 1/42 = 8 1 0 0 0 12 4 0 0 1 12 − 12 2 0 1 0 − 14 34 3 1 0 0 0 12 4
Chen CL
81
⇒ x(1) NBs: x2 = x4 = 0 BVs: x1 = 4, x3 = 4
f = −4
or x(2) NBs: x3 = x4 = 0 BVs: x1 = 3, x2 = 2
⇒
f = −4
x = αx(1) + (1 − α)x(2)
f (x) = −4 (z(x) = 4)
Chen CL
82
Example: Unbounded Problem Max: z = x1 − 2x2 = −f s.t. 2x1 − x2 ≥ 0
−2x1 + 3x2 ≤ 6 x1, x2 ≥ 0 Basic −f
x1 x2 x3 x4 b
x3
0 −2
1
1
0 0
x4
0 −2
3
0
1 6
−f
1 −1
2
0
0 0
Chen CL
83
Simplex Algorithm: Summary
Step 1: Start with an initial basic feasible solution
Step 2: The cost function must be in terms of only the NBs
Step 3: If all reduced cost coefficients for NBs are nonnegative ⇒ optimum
Step 4: If all elements in pivot column are negative ⇒ unbounded
Step 5: Complete the pivot step
Step 6: Identify basic and nonbasic variables, and their values. Identify cost function value and go to Step 3
Chen CL
84
Two-Phase Simplex Method
An initial canonical form (basic feasible point) is needed to initialize Simplex
To obtain standard LP problem as a canonical form:
≤ type: + slack variable (canonical form) = type: + artificial variable (no physical meaning) ≥ type: − surplus + artificial variable
Artificial variables ( AVs) augment the convex polyhedron of the original problem. Initial basic feasible solution corresponds to an extreme point (vertex) located in the new expanded space
Extreme pt in expanded space ⇒ extreme pt in original space ⇒ all AVs will be nonbasic (zero value) ⇒ further movements are only among extreme pts of original space
Chen CL
85
Artificial cost Function Min:
w = xn+1 + · · · + xn+m
=
xn+i
∀AV s
s.t.
xn+1 +a11x1 + · · · + a1nxn
= b1
xn+2 +a21x1 + · · · + a2nxn .. ··· ···
= b2
···
xn+m +am1x1 + · · · + amnxn = bm
m
⇒
w =
bi −
i=1
m
n
aij xj
=
j=1
n
bi −
i=1
+
−cj
bi
i=1
aij xj
j =1 i=1
m
= c1x1 + · · · + cnxn
m
Chen CL
86
Phase I:
to minimize w, original cost function is treated as a constraint and the elimination step also executed for it w is a sum of AVs, its minimum value is zero ( AVs become nonbasic at the end of Phase I) ∗ if w = 0⇒ iterations continued for minimizing f ∗ if w = 0⇒ no feasible solution exists for original problem
Phase II: same as before
Chen CL
87
Use AVs for ≥ Type Constraints y2 = y2+ − y2− ≡ x2 − x3;
Max: z = y1 + 2y2 = −f s.t. 3y1 + 2y2 ≤ 12 2y1 + 3y2 ≥ 6 y1 ≥ 0, y2 : free in sign
⇒
x4
: slack;
x5
: surplus;
x6
:
AV
Chen CL
88
Min: w = x6 = 6 − 2x1 − 3x2 + 3x3 + x5 s.t. 3x1 + 2x2 − 2x3 + x4 = 12 2x1 + 3x2 − 3x3 − x5 + x6 = 6 Basic −f x4 0 x6 0 −f 1 −w 0 x4 0 x2 0 −f 1 −w 0 x5 0 x2 0 −f 1
−f − x1 − 2x2 + 2x3 = 0, xi ≥ 0 −w x1 x2 x3 x4 x5 x6 b bi/aic 12 0 3 2 −2 1 0 0 12 2 =6 6 0 2 3 −3 0 −1 1 6 3 =2 0 −1 −2 2 0 0 0 0 1 −2 −3 3 0 1 0 −6 8 0 53 0 0 1 23 − 23 8 2/3 = 12 0 23 1 −1 0 − 13 13 2 − 0 13 0 0 0 − 23 23 4 1 0 0 0 0 0 1 0 Phase I END − 0 52 0 0 32 1 −1 12 0 32 1 −1 12 0 0 6 − 0 2 0 0 1 0 0 12 Phase II END
Chen CL
89
Use of AVs for Equality Constraints Max: z = x1 + 4x2 = −f s.t. x1 + 2x2 ≤ 5 2x1 + x2 = 4 x1 − x2 ≥ 0 (infeasible)
Chen CL
90
Min: f = − s.t.
Basic x3 x5 x6 −f −w x3 x1 x6 −f −w
x1 − 4x2
x1 + 2x2 + 2x1 +
x2
x1 −
x2
x3
= 5 + x5
− x4
= 4 + x6 = 3
xi ≥ 0 −f −w x1 x2 x3 x4 x5 x6 b bi/aic 5 0 0 1 2 1 0 0 0 5 1 =5 4 0 0 2 1 0 0 1 0 4 2 =2 3 0 0 1 −1 0 −1 0 1 3 1 =3 1 0 −1 −4 0 0 0 0 0 0 1 −3 0 0 1 1 0 −7 0 0 0 32 1 0 − 12 0 3 0 0 1 12 0 0 12 0 2 0 0 0 − 32 0 −1 − 12 1 1 1 0 0 − 72 0 0 12 0 2 0 1 0 32 0 1 32 0 1 Phase I END
Chen CL
91
Use of AVs: Unbounded Problems Min: f = −3x1 + 2x2 s.t. x1 − x2 ≥ 0 x1 + x2 ≥ 2 x1, x2 ≥ 0
Chen CL
92
Min:
f = −3x1
s.t. −x1 x1
+ +
Basic −f −w
x1
+ 2x2 x2 x2
+
x3
− x4 + x5
x2 x3
x4 x5
= 0 = 2
b
bi/aic
−
x3
0
0 −1
1
1
0
0
0
x5
0
0
1
1
0 −1
1
2
−f
1
0 −3
2
0
0
0
0
−w
0
1 −1 −1
0
1
0 −2
x3
0
0
0
2
1 −1
1
2
−
x1
0
0
1
1
0 −1
1
2
−
−f
1
0
0
5
0 −3
3
6
−w
0
1
0
0
0
1
0 Phase I,II END
0
2 1
=2
Chen CL
Initial tableau: BVs are x3 = 0, x5 = 2 ⇒ degenerate basic feasible soln (A) c1 = c2 = −1, if select x2 as pivot column ⇒ new BVs are x2 = 0, x5 = 2 (A again !) If select x1 as pivot column ⇒ w = 0, f = −6 at end of Phase I ⇒ reduced cost coefficient in x4 column is negative, and all elements in the pivot column are negative ⇒ no possibility of any further pivot steps ⇒ unbounded
93
Chen CL
94
Implication of Degenerate Basic Feasible Solution Max: z = s.t.
x1 +4x2
≤5
x1 +2x2 2x1
+x2
≤4
2x1
+x2
≥4
x1
−x2
≥1
⇓ Min: f = s.t.
−x1 −4x2
x1 +2x2 2x1
+x2
2x1
+x2
x1
−x2
xi
≥0
+x3
=5 +x4
=4
−x5
+x7
−x6
=4 +x8 = 1
Chen CL
95
Basic −f −w x1 x2 x3 x4 x5 x6 x7 x8
b bi/aic 5 1 4 2 4 2 1 1
x3
0
0
1
2
1
0
0
0
0
0
5
=5
x4
0
0
2
1
0
1
0
0
0
0
4
x7
0
0
2
1
0
0 −1
0
1
0
4
x8
0
0
1 −1
0
0
0 −1
0
1
1
−f
1
0 −1 −4
0
0
0
0
0
0
0
−w
0
1 −3
0
0
0
1
1
0
0 −5
x3
0
0
0
3
1
0
0
1
0 −1
4
x4
0
0
0
3
0
1
0
2
0 −2
2
x7
0
0
0
3
0
0 −1
2
1 −2
2
4 3 2 3 2 3
x1
0
0
1 −1
0
0
0 −1
0
1
1
−
−f
1
0
0 −5
0
0
0 −1
0
1
1
−w
0
1
0 −3
0
0
1 −2
0
3 −2
=2 =2 =1
Chen CL
96
Basic −f −w x1 x2 x3 x4 x5 x6 x7 x8
b
bi/aic
1
2
0 −1 − 23
0
2 1 0 1
x3
0
0
0
0
1
0
1 −1 −1
x4
0
0
0
0
0
1
1
x2
0
0
0
1
0
0 − 13
x1
0
0
1
0
0
0 − 13
−f
1
0
0
0
0
0 − 53
−w
0
1
0
0
0
0
x3
0
0
0
0
x5
0
0
0
x2
0
0
x1
0
−f
1
2 3 − 13 7 3
1 3 1 3 5 3
1
0
1
3
0 P-I END
1 −1
0 −1
0
1
2
0
0
1
1
0 −1
0
0
0
1
0
0
0
1
0
0
0
0
0
0
1 3 1 3 5 3
0
0 0
2 3 − 13 7 3
1 3
1
0 − 23 0 0
1 3 7 3
2 3 5 3 13 3
2 3 5 3 13 3 P-II
− −
END
Chen CL
97
Implication of Degenerate Basic Feasible Solution
x3, x4 : slack;
x5, x6 : surplus;
x7, x8 : artificial
3rd tableau: basic variable x4 has zero value ⇒ degenerate basic feasible solution
x5 should become basic ⇒x5 is pivot column
The element in pivot column (x5) and the degenerate variable row (x4, the 2nd row) is positive (1) ⇒ the (2nd) row must always be the pivot row (min ratio is zero) ⇒ 2nd row is pivot row (x4 will become a NB) ⇒ new basic feasible solution will be degenerate (final tableau)
Chen CL
98
Implication of Degenerate Basic Feasible Solution
The only way the new feasible solution can be nondegenerate is when the element in pivot column and the degenerate variable row is negative
The final solution: NBs: x4 = x6 = x 7 = x 8 = 0 BVs: x1 = 53 , x2 = 23 , x3 = 2, x5 = 0 f = − 13 3
z=
13 3
Chen CL
99
Alternate Simplex Method: The Big-M Method
For ”≥, = type” constraints, augment f with AVs having Big coeff.s Max: z = y1 + 2y2 s.t. 3y1 + 2y2 ≤ 12 2y1 + 3y2 ≥ 6 y1 ≥ 0, y2 : unrestricted in sign
⇒ Max: z = x1 + 2x2 − 2x3 s.t. 3x1 + 2x2 − 2x3 + x4 = 12 3x1 + 3x2 − 3x3 − x5 + x6 = 6,
xi ≥ 0
⇒ Min: f = −x1 − 2x2 + 2x3 + M x6 (M = 10?) = −x1 − 2x2 + 2x3 + 10(6 − 2x1 − 3x2 + 3x3 + x5) = 60 − 21x1 − 32x2 + 32x3 + 10x5
Chen CL
100
Basic −f x1 x2 x4 0 3 2 x6 0 2 3 −f 1 −21 −32 x4
0
x2 −f
0 1
x5 x2 −f
0 0 1
5 3 2 3 − 13 5 2 3 2
2
0
x3 x4 x5 x6 b −2 1 0 0 12 6 −3 0 −1 1 32 0 10 0 −60 0
1
1 −1 0 0
0 0
0 0 1 −1 0 0
3 2 1 2
1
2 3 − 13 − 23
− 23
8
1 3 32 3
2 4
1 −1 0 0 0 10
12 6 12
bi/aic 12 2 =6 6 3 =2 8 2/3
= 12
−
Chen CL
101
Simplex Method in Matrix Form
Min: s.t.
f = cT x Ax ≤ b x ≥
0
⇓ Min:
f = cT x
s.t. Ax + xs = b x ≥
⇓
0,
xs ≥
0
Chen CL
102
⇓
0
A I T
1 c
0
−f x xs
⇓
Basic −f
=
b
0
x
xs
RHS
xs
0
A
I
b
−f
1
cT
0
0
Chen CL
103
b =
=
A
I
B N
x
xs
xB
xN
= BxB + N xN
= BxB
=0
⇒ x
B
= B −1b
T x c xN f = cT + B B N
T −1 x c B b = cT = B B B
Chen CL
104
0
B
−f
T
xB
1 cB
⇒
−f xB
=
=
=
=
b
0
0
−1
B
1 cT B
b
0
−cT B −1 1 B
B −1
−cT B −1b B
B −1b
0
b
0
Chen CL
105
×
⇒
−cT B −1 1 B
B −1
A I
0
T
1 c
0
B −1A
Basic −f
−f x xs
b
=
0
0
−1 T −1 B A c B 1 cT − cT − B B
0
B −1
−f x xs
=
−cT B −1b B
B −1b
x
xs
RHS
B −1
B −1b
xB
0
B −1A
−f
1
−1 cT − cT B A B
−cT B −1 −c B −1b B
B
Chen CL
106
Example
x1 x2
Min: f = −6 −4 0 0 0
x3 x4 x5
s.t.
x1
9 4 1 0 0
x2
5 8 0 1 0
x3 = 400
1 1 0 0 1
x4 x5
360 55
Chen CL
107
If select xB =
B =
x1 x2 x3
−6
⇒ c = −4 B
9 4 1 5 8 0 1 1 0
0
360
b=
400 55
Chen CL
108
⇒ B −1 =
0 − 13 0 1
8 3 − 53 − 52 3
1 3 5 3
xB = B −1b =
0 − 13 0 1
1 3 5 3
8 3 − 53 − 52 3
xB = −6 −4 0 f = cT B
40 3 125 3 220 3
=
= −
740 3
360 400 55
40 3 125 3 220 3
Chen CL
109
Entering Variable and Leaving Variable b = BxB + N xN
⇒ x
B
= B −1b − B −1N xN = B
−1
b−
B −1aj xj
aj : jth column of A = [A I ]
j ∈N
f = cB xB + cN xN
= cB B −1b − B −1N xN + cN xN = cB B −1b +
cN − cB B −1N
xN
dN
= cB B −1b +
cj − cB B −1aj
j ∈N
dj
xj
Chen CL
110
if cj − dj ≥ 0 ∀ j ∈ N ⇒ optimum solution select xj with most negative dj − cj as the entering variable, xE xj = xE
⇒ x
B
xB1 xB2 .. xBm
:
N B(= 0) → B(xj > 0)
= B −1b − B −1aE xE
=
⇒ select xi
bk1 bk2 .. bkm
−
a1E
a2E xE .. amE
bki with minimum , aiE > 0 as leaving variable aiE xi = xV : B (xi > 0) → N B(xi = 0)
Chen CL
111
Procedures
Initialization: Initial canonical form
Improvement:
Compute cj − dj , select xE with most negative cj − dj
bk i
Select xV with least ratio min a , aiE > 0 iE Replace a of xV with aE of xE V find the new B new
Optimality Check:
compute new cj − dj by using B new stop if cj − dj ≥ 0 ∀ j ∈ N 1 ⇒ x∗B = B − f ∗ = cB x∗B new b,
Chen CL
112
Revised Simplex: Example
x1 x2
Min: f = −6 −4 0 0 0
x3 x4 x5
s.t.
x1
9 4 1 0 0
x2
5 8 0 1 0
x3 = 400
1 1 0 0 1
x4 x5
360 55
Chen CL
113
x3
⇒ x
B
=
x4
xN =
x5 0
⇒ c
B
=
0 0
cN =
1 0 0
⇒ B −1 =
0 1 0 0 0 1
6 4
x1 x2
B=
1 0 0 0 1 0 0 0 1
Chen CL
114
xN =
⇒ cT − cT B −1N = N
B
=
x1 x2
−6 −4 − 0 0 0 −6 −4 − 0 0
1 0 0
9 4
0 1 0
5 8
0 0 1
1 1
=
⇒ − 6 < −4 ⇒ select x1 as xE
−6 −4
Chen CL
115
xB =
x3 x4 x5
= B −1b − B −1aE xE =
=
(aE = a1)
1 0 0
360
0 1 0
400 − 0 1 0
5 xE
0 0 1
55
0 0 1
1
80, 55 1
360 − 9xE
1 0 0
9
400 − 5xE 55 − xE
if xE = min
360 9
=
40, 400 5
=
⇒ x3 = 0 (= xV , become a NB)
= 55 = 40
Chen CL
116
x1
⇒ x
B
=
x4
xN =
x5 6
⇒ c
B
=
0 0
⇒ B −1 =
1 9 − 59 − 19
cN =
0 0 1 0 0 1
4 0
x2 x3
B=
9 0 0 5 1 0 1 0 1
Chen CL
117
xN =
⇒ cT − cT B −1N = N
B
=
x2 x3
−4 0 − −6 0 0 −4 0 − − 83 − 23
⇒ − 43 < − −
1 9 − 59 − 19
=
⇒ select x2 as xE
0 0
4 1
1 0
8 0
0 1
1 0
− 43
2 3
Chen CL
118
x1
xB =
x4 x5
= B −1b − B −1aE xE =
1 9 − 59 − 19
0 0
360
1 0
400 −
0 1
55
40 − 49 xE
=
1 9 − 59 − 19
0 0
4
1 0
8 xE
0 1
1
200 − 52 9 x E 15 − 59 xE
if xE = min
40 4/9
200 15 = 90, 52 /9 , 5/9 = 27 = 27
⇒ x5 = 0 (= x V , become a NB)
Chen CL
119
⇒ x
B
⇒ c
B
=
=
⇒ B −1 =
x1 x4 x2
cN =
−4 1 5 3 5 − 15
x3
xN =
−6 0
0 − 45 1 − 32 5 0
9 5
x5
0 0
B=
9 0 4 5 1 8 1 0 1
Chen CL
120
xN =
⇒ cT − cT B −1N = N
B
=
x3 x5
0 0 − −6 0 −4 0 0 − − 25 − 12 5
1 5 3 5 − 15
0 − 45 1 − 32 5 9 5
0
=
2 5
12 5
1 0 0 0 0 1
Chen CL
121
⇒ x∗ = B −1b = B
=
28 44 27
=
1 5 3 5 − 15
0 − 45 1 − 32 5 0 x∗1 x∗4 x∗2
9 5
360 400 55
(x∗3 = x∗5 = 0)
∗ x f ∗ = cT = −6 0 −4 B B
28 44 27
=
− 276
Chen CL
122
Quadratic Programming Min:
f = cT x + 12 xT Qx
s.t. Ax ≤ b
⇒ Min:
x ≥
f = cT x + 12 xT Qx x ≥
s.t. Ax + s = b
⇒
0
0
L = cT x + 12 xT Qx + λT (Ax + s − b) − µT x
KKC: ∇L = c + Qx + AT λ − µ = 0
⇒
x
Q AT −I
0
A
I
0
0
λ
µ s
=
−c b
Chen CL
123
Add Artificial Variables, v , on these equality constraints, Use two-phase method to solve the problem: n
Min: w =
vi
i=1
s.t.
T
Q A A
0
x
−I
0
0
I
I 0
λ
µ s
v
=
−c b
Chen CL
124
QP: Example Min: f = −3x1 − x1x2 + x21 + 2x22 s.t. 3x1 + x2 ≤ 5 x1, x2 ≥ 0
⇓
Min: z = −3 0 s.t.
x1
3 1 x1 x2
x2
≥
0 0
x1 x2
≤ 5
+
1 2
x1 x2
2
−1
−1
4
x1 x2
Chen CL
125
Min: w = v1 + v2
s.t.
2
−1 3 −1
−1
4
1
0
3
1
0
0
0
0 1 0
−1 0 0 1 0
1 0 0
x1 x2 λ µ1 µ2 s v1 v2
3
= 0 5
⇒ w = v1 + v2 = −(summation of first 2 rows) = −x1 − 3x2 − 4λ + µ1 + µ2 + 3
−w v1 0 v2 0 s 0 −w 1
Chen CL Basic
x1
x2
λ
µ1
µ2
s
v1
v2
b
bi/a126 ic
2 −1 3
−1 4 1 −3
3 1 0
−1 0 0 1
0 −1 0
0 0 1
1 0 0
0 1 0
3 0 5
3 2
0
1
0
0
0
−3
(-3,-4 ?)
− 12 − 12
0 −1
0 0
0 1
1
1
0
0
3 44 5 − 44 9 − 44
1 5 − 75 2 5 7 5 13 44 7 − 44 5 44
5 44 9 44
3 2 3 2 1 2 3 2 8 5 4 5 1 5 − 45 17 11 1 11 4 11
−
0
1 2 1 2 − 32 1 2 1 5 13 5 − 35 − 85 1 44 13 44 3 − 44
0
0
1
0
−1
x1 v2
0 0
1 0
s
0
0
−w
1
0
7 2 5 2 − 72
x1
0
1
0
v2
0
0
0
x2
0
0
1
−w
1
0
0
3 2 5 2 − 92 − 52 3 5 44 5 − 95 − 44 5
x1 λ x2
0 0 0
1 0 0
0 0 1
0 1 0
3 2 1 2 − 15 − 13 5 3 5 13 5 1 − 44 − 13 44 3 44
−w 1
0
0
0
0
∗
− 12
−4
x1 = 17/11,
∗
x2 = 4/11,
−1 0 1
∗
∗
1
0 0 0 1 0 0 3 − 44
λ = 1/11 ⇒ f = −308/121
5 3
3/2 7/2 1/2 5/2 8/5 3/5 4/5 44/5
−
Chen CL
127
Duality: Start from Lagrangian and The Kuhn-Tucker Conditions (Min,≤) Min: s.t.
f (x) gj (x) ≤ 0 j = 1, · · · , m hk (x) = 0 k = 1, · · · , ; m
⇒
L(x, λ) = f (x)+
λj gj (x) +
j =1
KTC:
x≥0
λm+k hk (x)
k=1
gj (x∗) ≤ 0 j = 1, · · · , m (x∗ is feasible) hk (x∗) = 0 k = 1, · · · , λ∗j gj (x∗) = 0 j = 1, · · · , m m
∇x f (x∗) +
j =1
λ∗j ≥ 0;
λ∗j ∇x gj (x∗) +
λ∗m+k ∇x hk (x∗) = 0
k=1
λ∗m+k unrestricted in sign
Chen CL
128
Saddle Point Theorem (Min,≤) L(x∗, λ) ≤ L(x∗, λ∗) ≤ L(x, λ∗)
Proof: Min:
(x ≥ 0)
f (x)
gj (x) ≤ 0 j = 1, · · · , m (skip h now)
s.t.
m
⇒
L(x, λ) = f (x)+
λj gj (x)
j =1
NC on x: x≥0⇒
∂L ∂xi ∂L ∂xi
∗
x λ ∗,
∗
x λ ∗,
=
∂f ∂xi
≥ 0
∗
x λ ∗,
x∗i
(if x∗i = 0 ⇒
⇒
L(x∗, λ∗) ≤ L(x, λ∗)
+
λj
∀j
∂L ∂xi
(if x∗i > 0 ⇒
∗
= 0
∗
x λ ∗,
∂L ∂x i
x λ
∂L ∂x i
x∗,λ
∗,
∂gj = 0 ∗ ∂xi x∗,λ
∗
= 0)
∗
> 0)
Chen CL
129
∗
∗
0 ≤ df (x , λ ) =
∂f dxi ∗ ∂xi x∗,λ
∀i
=
∀j
λ∗j
= −
∀j
∂gj λj dxi ∗ ∂xi x∗,λ ∂gj dxi ∗ ∂xi x∗,λ ∗
−
∀i
∀i
λ∗j dg j (x∗, λ∗)
= −
∀j
⇒ NC:
(min prob)
≤0
λ∗j ≥ 0 ∀ j λ∗j ≥ 0
∂L ∂λj
∗
x λ ∗,
= gj ≤ 0 λ∗j
⇒
L(x∗, λ) ≤ L(x∗, λ∗)
⇒
L(x∗, λ) ≤ L(x∗, λ∗) ≤ L(x, λ∗)
∂L ∂λj
∗
x λ ∗,
= 0
Chen CL
130
Saddle Point and Properties (Min,≤)
∇xL(x∗, λ∗) = 0
∇λL(x∗, λ∗) = 0
∇xL(x, λ∗) ≥ 0
∇λL(x∗, λ) ≤ 0
Chen CL
131
The Max-Min Problem (Min,≤) L(x∗, λ) ≤ L(x∗, λ∗) ≤ L(x, λ∗) (x∗, λ∗)
defines a saddle pt of the Lagrangian
If define
the Lagrangian in terms of λ alone
⇒ L(λ) = min L(x, λ) = L(x∗, λ) x
since L(λ) is a maximum w.r.t. λ at the optimum
⇒ max L(λ) = max min L(x, λ) gives (x∗, λ∗) λ
λ
x
similary min L(x) = min max L(x, λ) gives (x∗, λ∗) x
x
λ
Chen CL
132
The Primal and Dual Problems (Min,≤)
Min: f (x) s.t. gj (x) ≤ 0 j = 1, · · · , m hk (x) = 0 k = 1, · · · , m
⇒ L(x, λ) = f (x)+
λj gj (x) +
j =1
k=1
Primal min max L(x, λ) = min L(x)
x ≥
max min L(x, λ) = max L(λ)
λ ≥
x
Dual
λ
λ
x
x
λ
0
0
λm+k hk
Chen CL
133
Duality (Min,≤) Min:
f (x)
s.t.
gj (x) ≤ 0 j = 1, · · · , m
⇒
m
L(x, λ) = f (x)+
λj gj (x)
j =1
L(x∗, λ) ≤ L(x∗, λ∗)
≤ L(x, λ∗)
=f (x∗)
max λ
min L(x, λ) ⇒ x∗, λ∗
x L(x∗,λ)≡φ(λ)
min max L(x, λ) ⇒ x∗, λ∗ x
λ ∗ L(x,λ )≡f (x)
φ(λ) ≤ f (x∗) ≤ f (x)
Chen CL
134
Duality in Linear Programming (Min,≤) Min: s.t.
⇒
f p(x) = cT x + f 0 Ax ≤ b
x ≥
0
L(x, λ) = cT x+λT (Ax − b) + f 0 = −λT b + xT (c + AT λ)+f 0
Note:
∇xL(x, λ) = c + AT λ ≥ 0
NC on x∗
∇xL(x∗, λ) = c + AT λ = 0
⇒ cT x + λT Ax = 0 ⇒ ⇒ Max: s.t. Note:
L(λ) = −bT λ + f 0 ≡ zd(λ) zd(λ) = −bT λ + f 0 AT λ ≥ −c
f (x∗) = L(λ∗)
λ ≥
0
AT λ ≥ −c
Chen CL
135
Notes:
x : primal variable;
λ : dual variable
Engineering problems have the feature that the number of constraints is usually far greater than the number of design variables, yet it is the number of constraints which determines the efficiency of the LP solution ⇒ if n << m then dual linear problem should be more efficient ∗ If evaluating ∇xL(λ ), then any component which is nonzero must correspond to a primal variable which is zero in order to satisfy cT x+λT Ax = 0
Chen CL
136
A Linear Programming Example (Min,≤)
Min: f p(x) = −4x1 − x2 + 50 s.t. g1(x) = x1 − x2 ≤ 2 g2(x) = x1 + 2x2 ≤ 8 g3(x) = x1 + x2 ≤ 10 g4(x) = −5x1 + x2 ≤ 5
c =
−4 −1
A =
1
−1
1
2
1
1
−5
1
b =
2 8
10 5
Chen CL
137
Dual Problem: Max: L(λ) = −2λ1 − 8λ2 − 10λ3 − 5λ4 + 50 s.t.
g˜1(λ) = λ1 + λ2 + λ3 − 5λ4 ≥ 4 g˜2(λ) = −λ1 + 2λ2 + λ3 + λ4 ≥ 1 λi ≥ 0 ∗
⇒
λ
∗
=
∗
⇒ ∇xL(x , λ ) =
7 3
−4 −1
5 3
0 0
+
1
⇒
x
=
4 2
L(λ∗) = 32
1 1 −5
−1 2 1
λ∗1, λ∗2 = 0 ⇒ x∗1 − x∗2 = 2 ∗
T
1
7/3 5/3 0 0
x∗1 + 2x∗2 = 8
f p(x∗) = 3 2
=
0 0
Chen CL
138
Duality for Linear Programming Another Approach Primal Min: s.t.
⇔ Dual
Max: s.t.
Suppose (1)
f p(x) = cT x + f 0 Ax ≤ b
x ≥
0
zd(λ) = −bT λ + f 0 AT λ ≥ −c
λ ≥
0
x0, λ0
are feasible solutions (for primal, dual)
x∗, λ∗
are optimal solutions (for primal, dual) T
Ax0 ≤ b ⇒ x0 Aλ0 ≤ bT λ0 T 0
A λ
0T
≥ −c ⇒ λ Ax0 ≥ −cT x0
⇒
bT λ0 ≥ −cT x0
(Weak Duality Property)
⇒
bT λ∗ = −cT x∗
(Strong Duality Property)
Chen CL
139
(2) Ax∗ AT λ∗
+ u∗ = b ⇒ x∗T Aλ∗ + u∗T λ∗ = bT λ∗ T − v ∗ = −c ⇒ λ∗ Ax∗ − v ∗T x∗ = −cT x∗
⇒ u∗T λ∗ + v∗T x∗ =
bT λ∗ + cT x∗
0
⇒ u∗T λ∗ + v∗T x∗ = 0 ⇒ u∗T λ∗ = 0, v ∗T x∗ = 0
⇒
(Complementary Slackness Cond.)
u∗i λ∗i = 0,
i = 1, · · · , m
vj∗x∗j = 0,
j = 1, · · · , n
Chen CL
140
Duality in Quadratic Programming Min: s.t.
⇒
f (x) =
1 T 2 x Qx
+ cT x
Ax ≤ b
L(x, λ) =
1 T 2 x Qx
+ cT x + λT (Ax − b)
NC on x ∇xL(x, λ) = Qx + c + AT λ = 0
⇒
x = −Q−1(c + AT λ)
⇒ Max: L(λ) =
− 12 λT Dλ
1 T −1 −d λ− c Q c 2 T
ignored
D = AQ−1AT
d = b + AQ−1c
Convert original QP problem with m inequality constraints and n design variables to the dual QP problem with only simple non-negative constraints (λ ≥ 0)
Chen CL
141
Duality in Separable Programming (I) n
Min:
f (x) =
1 2 aixi + bixi 2
i=1 n
s.t.
gj (x) =
j = 1, · · · , m
cjixi
i=1
⇒
Li(λ) = min xi
m
m
∇xi Li(λ) = ai + bixi +
⇒
⇒ Max: Li(λ)
1 2 aixi + bixi + λj cji xi 2 j =1
⇒
xi =
(separable obj)
− ai −
λj cji = 0
j =1 m j =1 λj cji
bi (xi ≤ xi ≤ xui ; xi = xi if bi = 0) with quadratic obj and linear constraints
Chen CL
142
Duality in Separable Programming (II) n
Min:
f (x) =
i=1 n
s.t.
gj (x) =
i=1
⇒ ⇒ ⇒
Li(λ) = min xi
1 2 aixi + bixi 2
1 cji xi + dji x2i 2
⇒ Max: Li(λ)
(separable obj)
j = 1, · · · , m m
1 2 1 aixi + bixi + λj cji xi + dji x2i 2 2 j =1 m
∇xi Li(λ) = ai + bixi + xi =
λj (cji + dji xi) = 0
j =1 m − ai − j =1 λj cji m bi + j =1 λj dji (xi ≤ xi ≤ xui ; xi =
xi if denominator = 0)
with quadratic obj and quadratic constraints
Chen CL
143
Duality in Linear Programming (A Simpler Approach Again) n
Primal Min: f p = c1x1 + · · · + cnxn =
cj xj = cT x
j =1
s.t. a11x1 + · · · + a1nxn ≤ b1
···
···
···
···
(Ax ≤ b)
am1x1 + · · · + amnxn ≤ bm
m
Dual Max: zd = −b1y1 − · · · − bmym = −
biyi = bT y
i=1
s.t. a11y1 + · · · + am1ym ≥ −c1
···
···
···
···
a1ny1 + · · · + amnym ≥ −cn
(AT y ≥ −c)
Chen CL
144
Example: Dual of an LP Problem Min: f p = −5x1 + 2x2 s.t. 2x1 + x2 ≤ 9 x1 − 2x2 ≤ 2
−3x1 + 2x2 ≤ 3 x1, x2 ≥ 0
⇓ Max: zd = −9y1 − 2y2 − 3y3 s.t. 2y1 + y2 − 3y3 ≥ 5 y1 − 2y2 + 2y3 ≥ −2 y1, y2, y3 ≥ 0
Chen CL
145
Treatment of Equality Constraints Min: f p = −x1 − 4x2 s.t. x1 + 2x2 ≤ 5 2x1 + x2 = 4 x1 − x2 ≥ 1,
x1, x2 ≥ 0
⇓ ⇒ Min: f p = −x1 − 4x2 s.t. x1 + 2x2 ≤ 5 2x1 + x2 ≤ 4
−2x1 − x2 ≤ −4 −x1 + x2 ≤ −1,
x1, x2 ≥ 0
⇒ Max: zd = −5y1 − 4y2 + 4y3 + y4 s.t. y1 + 2y2 − 2y3 − y4 ≥ 1 2y1 + y2 − y3 + y4 ≥ 4,
y1, y2, y3, y4 ≥ 0
Chen CL
y5 ≡ y2 − y3, unrestricted in sign
Equality primal constraint ⇒ unrestricted dual variable
Unrestricted primal variable ⇒ equality dual constraint
Theorem: the dual of the dual problem is the primal problem
146
Chen CL
147
Primal Solution from Dual Solution
Theorem: Relation between primal and dual Let x and y be in the constraint set (feasible points) of primal and dual problems, respectively. Then the following relations hold:
zd(y ) ≤ f p(x) If zd = f p , then x and y are solutions for primal and dual problems If primal is unbounded, the corresponding dual is infeasible, and vice versa If primal is feasible and dual is infeasible, then primal is unbounded and vice versa
Chen CL
a11y1 + · · · + am1ym ≥ −c1 ··· ··· ··· ··· a1ny1 + · · · + amnym ≥ −cn
× x1
148
× xn
⇓ x1(a11y1 + · · · + am1ym) + · · · + xn(a1ny1 + · · · + amnym) ≥ −c1x1 − · · · − cnxn
⇓ b1
y1 (a11x1 + · · · + a1nxn) + · · · +
ym (am1x1 + · · · + amnxn) ≥ −c1x1 − · · · − cnxn bm
⇓
−b1y1 − · · · − bmym ≤ c1x1 + · · · + cnxn zd: dual profit fcn
f p: primal cost fcn
zd ≤ f p⇒ x and y with f p = zd minimize f p while maximizing zd
⇒ maximum dual profit fcn is also the minimum primal cost fcn
Chen CL
149
Theorem: Primal and dual solutions Let both primal and dual have feasible points. Then both have solution in x and y respectively and zd(y ) = f p(x)
Theorem: Solution of primal from dual If the ith dual constraint is a strict inequality at optimum, then the corresponding ith primal variable is NB, i.e., it vanishes. Also, if the ith dual variable is basic, then the ith primal constraint is satisfied at equality. m
If
aij yi > −cj then
i=1
If
xj = 0 n
yi > 0 then
j =1
aij xj = −bi
Chen CL
150
Primal and Dual Solutions: Example
(f p∗ = −18)
Minx: f p = −5x1 + 2x2 s.t. 2x1 + x2 ≤ 9 x1 − 2x2 ≤ 2
−3x1 + 2x2 ≤ 3,
Basic −f p x1 x2
x3
x1, x2 ≥ 0
x4 x5
b bi/aic
x2
0
0
1 0.2 −0.4
0
1
x1
0
1
0 0.4
0.2
0
4
x5
0
0
0 0.8
1.4
1 13
−f p
1
0
0 1.6
1.8
0 18
Chen CL
151
Dual Dual:: Max: ax: zd = −9y1 − 2y2 − 3y3 s.t. 2y1 + y2 − 3y3 ≥ 5 y1 − 2y2 + 2y3 ≥ −2
⇓ Max: zd = −9y1 − 2y2 − 3y3 s.t. 2y1 + y2 − 3y3 − y4 + y6 = 5
−y1 + 2y2 − 2y3 + y5 = 2 y4: surplus, y5: slack, y6: artificial
Chen CL
152
Basic
zd
y6 y5
0 0
zd
1
−w
0
−w 0 0 0 1
y1 y5
0 0
zd
y1
y2
y3
y4
y5
y6
b
bi/aic
2 −1
1 2
1 0
5 2
5 2
2
0
0
0
−2
−1
−1 0 0 1
0 1
9
−3 −2 3 3
0
0
−5
0 0
1 0
0 .5 2 .5
0.5 0.5
2.5 4.5
2.5 0.5 4.5 2.5
0
0
0
−w
0
1
0
−2.5 0
−0.5 −0.5 4.5 0
0 1
1
−1.5 −3.5 16..5 16 0
0
−4.5 1
−22 22..5 0
I END
y1
0
0
1
0
0
0
1
0.2
1.8
zd
1
0
0
0
−0.2 0.4 1
1.6
0
−0.4 −0.2 4
0.4
y2
−0.8 −1.4 13 13
−4
−18
BVs: y1 = 1.6, y2 = 1.8 NBs: y3 = 0, y4 = 0, y5 = 0 Max: zd∗ = −18 (= f p∗)
−
II END
Chen CL
153
Note: y1, y2: basic ⇒ 1st, 2nd primal constraints are active 2x1 + x2 = 9 x1 − 2x2 = 2
⇒ x1 = 4, x2 = 1 ⇒ f p = −5x1 + 2x2 = −18
Chen CL
154
Use of Dual Tableau to Recover Primal Solution
Primal and Dual tables of previous example: Basic x2 x1 x5
−f p Basic
zd
y1
0
y2
0
zd
1
−w 0 0 0
−f p 0 0 0 1
x1
x2
x3
x4
x5
b
0
1
0 .2
0
1
1 0
0 0
0 .4 0 .8
0 1
4 13 13
0
0
1 .6
−0.4 0 .2 1 .4 1 .8
0
18 18
bi/aic
y1
y2
y3
y4
y5
y6
b
1
0
0 .2
1.8
0
0
−0.2 0.4 1
1.6
1
−0.4 −0.2 4
0 .4
0
−0.8 −1.4 13
−4
−18
bi/aic
II END
Chen CL
155
Some notes:
Elements in row of dual tableau match elements in last column of primal tableau Reduced cost coefficients in final primal tableau match the dual variables To recov ecover er primal imal var variabl iables es from from fina final dual dual tabl tablea eau u, we use use reduced cost coefficients in columns corresponding to slack or surplus variables Reduced cost coefficient in column y4 is precisely x1 and that in column y5 is precisely x2 Red Reduc uced ed profit rofit coeffic coefficie ient ntss co corr rres espon pondi ding ng to slac slackk and and surp surplu luss variables in final dual tableau give values of primal variables
Chen CL
156
Theorem Theorem:: recove recovery ry of primal rimal solution solution from dual tablea tableau u Let dual of the standard primal (min (min cT x s.t. Ax ≤ b) be solved by standard Simplex meth method. od. Then Then valu valuee of ith primal variable equals the reduced cost coefficient of the slack or surplus variable associated with the ith dual constraint in the final dual tableau. In addition, if a dual variable is nonbasic, then its reduced profit coeffic coefficie ient nt equa equals ls the the valu valuee of slac slackk or surp surplu luss vari variab able le for for the the corresponding primal constraint.
Chen CL
157
Use of Final Primal Tableau to Recover Dual Dual Solution: Solution: Exampl Example e Min: f p = −x1 − 4x2 s.t. x1 + 2x2 ≤ 5 2x1 + x2 = 4 x1 − x2 ≥ 1 x1, x2 ≥ 0 Min: f p = −x1 − 4x2 s.t. x1 + 2x2 2x1 + x2 2x1 + x2 x1 − x2
+ x3
= 5 + x4
= 4
− x5
+ x7
− x6
= 4 + x8 = 1
Chen CL
158
Basic x3 x5 x2 x1
−f p
−f p 0 0 0 0 1
x1
x2
x3
x4
x5
x6
x7
x8
b
0 0
0 0
1 0
−1 1
0 1
−1 0
0 −1
2 0
0 1
1 0
0 0
0 0
0
0
2 3 − 13 7 3
0 0
0
1 3 1 3 5 3
−1 0 − 23
0
0
1 3 7 3
bi/aic
2 3 5 3 13 3
slack: x3, x4 surplus: x5, x6 artif.: x8, x7 BVs: x1 = 53 , x2 = 23 , x3 = 2, x5 = 0 NBs: x4 = x6 = x7 = x8 = 0 Min: f p∗ =
− 13 3
Chen CL
159
y1 = 0, for 1st constraint (reduced cost coeff of x3, slack var.)
y2 = 53 , for 2nd constraint (reduced cost coeff of x4, slack var.)
y3 = 0, for 3rd constraint (reduced cost coeff of x5, surplus var.)
y4 = 73 , for 4th constraint (reduced cost coeff of x6, surplus var.)
dual variable for equality constraint 2x1 + x2 = 4 is y2 − y3 =
5 3
y4 = 73 is the dual variable for the 4th constraint written as −x1 + x2 ≤ −1 and NOT for x1 − x2 ≥ 1
Chen CL
160
Use of Final Primal Tableau to Recover Dual Solution: Example (2) Min: f p = −x1 − 4x2 s.t. x1 + 2x2 ≤ 5 2x1 + x2 = 4 x1 − x2 ≥ 1 x1, x2 ≥ 0 Min: f p = −x1 − 4x2 s.t.
x1 + 2x2 + x3
= 5
2x1 + x2 x1 − x2
+ x5
− x4
= 4 + x6 = 1
Chen CL
161
−f p −w
−f p 0 0 0 1 0
−w 0 0 0 0 1
x3 x5 x1
0 0 0
−f p −w
Basic
x1
x2
x3
x4
x5
x6
b
bi/aic
1 2
2 1
1 0
0 0
0 1
0 0
5 4
1
0
1
1
0
0
0
0
−1 0 1
0
−1 −3
−1 −4 0
5 1 4 2 1 1
0
0
−5
0 0 0
0 0 1
3 3 −1
1 0 0
1 2 −1
0 1 0
4 2 1
1
0
0
0
1
0
0
−1 −2
0
0
−5 −3
0
−1 −2 1 1 3
−2
x3
0
0
0
0
1
−1
−1
1
2
x2 x1
0 0
0 0
0 1
1 0
0 0
1
0
0
0
0
1 3 1 3 5 3
− 23
−f p −w
2 3 − 13 7 3
1 3 − 73
2 3 5 3 13 3
0
1
0
0
0
0
1
1
0
x3 x5 x6
0
4 3 2 3
−
1
Phase I,II END
Chen CL
162
slack: x3 surplus: x4 artif.: x5, x6 BVs: x1 = 53 , x2 = 23 , x3 = 2 NBs: x4 = x5 = x6 = 0 Min: f p∗ = − 13 3
(same result)
y1 = 0, for 1st constraint (reduced cost coeff of x3, slack var.)
y2 = 53 , for 2nd constraint (reduced cost coeff of x5, artif var.)
y3 = 73 , for 3rd constraint (reduced cost coeff of x4, surplus var.)
Same result ⇒ we do not have to replace an equality constraint by two inequalities in standard Simplex method
Reduced cost coefficient corresponding to the artificial variable associated with the equality constraint gives the value of dual variable for the constraint
Chen CL
163
Dual Variables as Lagrange Multipliers
Theorem: Dual Variables as Lagrange Multipliers Let x and y be optimal solutions for the primal and dual problems mentioned above. Then dual variable y are also Lagrange multipliers for primal constraints.
Proof: y, v
:
Lagrange multipliers
n
L =
m
cj xj +
j =1
n
yi
i=1
n
aij xj − bi
j =1
= cT x + y T (Ax − b) + v T x (a)
+
j =1
vj xj
Chen CL
164
m
NC: cj +
yiaij + vj
= 0 j = 1 ∼ n (b)
= 0 i = 1 ∼ m (c)
i=1
n
yi
aij xj − bi
j =1
vj xj = 0
xj
≥ 0 j = 1 ∼ n (d)
yi ≥ 0 i = 1 ∼ m (e) vj
≥ 0 j = 1 ∼ n (f )
m
(b) ⇒ cj +
yiaij
= −vj
yiaij
≤ −cj
i=1 m
⇒
(g)
i=1
yj ’s are feasible soln for dual constraints
Chen CL
165
m
(g) ⇒ vj > 0, xj = 0,
aij yi ≤ −cj
(h)
aij yi = −cj
(i)
i=1 m
vj = 0, xj > 0,
i=1 m
n
(c) ⇒
xj
j =1
m
aij yi =
i=1
m
(h,i,j) ⇒
m
xj
j =1
zd
( j)
i=1 n
yi(−bi) =
i=1
yibi
−
n
aij yi
i=1
≥cj
≥
cj xj
j =1
f p
x and y are feasible points for primal and dual problems, and
primal and dual functions have the same values ⇒ optimum solutions for the respective problems ⇒ the Lagrange multipliers y solve the dual problem
Chen CL
166
Post-Optimality Analysis
Sensitivity Analysis: the study of discrete parameter changes
Changes in the cost function coefficients, cj
Changes in the resource limits, bi
Changes in the constraint coefficients, aij
The effect of including additional constraints
The effect of including additional variables
Chen CL
167
Changes in Resource Limits
Theorem: Lagrange Multiplier Values In the final tableau, the Lagrange multiplier for the ith constraint equals the reduced cost coefficient in the slack or artificial variable column associated with the ith constraint For a minimization problem with ≤ type or equality constraints ei : RHS parameter, yi : Lagrange multiplier ∂z ⇒ ∂ei
= yi ≥ 0
Chen CL
168
Recovery of Lagrange Multipliers from Final Tableau
Max:
z = 5x1 − 2x2 (= −f )
s.t.
2x1 + x2 ≤ 9 x1 − 2x2 ≤ 2
−3x1 + 2x2 ≤ 3 x1, x2 ≥ 0
⇒
⇒
BV: x1 = 4, x2 = 1, x5 = 13 NB:
x3 = 0, x4 = 0 z ∗ = 18
Chen CL
169
Basic z
x1
x2
x3
x4
x5
x3 0
2
1
1
0
0
9
x4 0
1
−2
0
1
0
2
9 2 6 3
x5 0
−3
2
0
0
1
3
−
1
−5
2
0
0
0
0
x3 0
0
5
1
−2
0
5
5 5
x1 0
1
−2
0
1
0
2
−
x5 0
0
−4
0
3
1
9
−
1
0
−8
0
5
0 10
x2 0
0
1
0.2 −0.4
0
1
x1 0
1
0
0.4
0.2
0
4
x5 0
0
0
0.8
1.4
1 13
0
0
1.6
1.8
0 18
z
z
z
1
−c1 −c2 −c3
−c4 −c5
b bi/aic
Chen CL
170
1st constraint y1 = 1.6 (−c3 in slack variable col x3) 2nd constraint y2 = 1.8 (−c4 in slack variable col x4) 3rd constraint y3 = ∂z ⇒ = 1.6 ∂e1
0 (−c5 in slack variable col x5) ∂z = 1.8 ∂e2
∂z =0 ∂e3
If e1 : 9→10 ⇒ z : 18→18 + (1.6) × (1) = 19.6 (F )
Chen CL
171
Recovery of Lagrange Multipliers from Final Tableau
Max: z = x 1 + 4x2 (= −f ) x1 + 2x2 ≤ 5
s.t.
2x1 + x2 = 4 x1 − x2 ≥ 1 x1, x2 ≥ 0
⇓ Max: z = s.t.
⇓
⇓
x1 + 4x2 x1 + 2x2 + x3 2x1 +
x2
x1 −
x2
xi ≥
0
= 5 + x5
− x4
= 4 + x6 = 1
Chen CL
?⇓?
172
?⇓?
BV: x1 = 53 , x2 = 23 , x3 = 2 NB: x4 = 0, x5 = 0, x6 = 0 z∗ =
13 3
Chen CL
173
0
−w 0 0 0 0 1
x3 x5 x1
0 0 0
z
Basic
z
x1
x2
x3
x4
x5
x6
b
bi/aic
x3 x5
0 0
1 2
2 1
1 0
0 0
0 1
0 0
5 4
1
0
1
1
0
0
0
0
−1 0 1
0
−1 −3
−1 −4 0
5 1 4 2 1 1
x6
0
z
1
−w
0
0
−5
0 0 0
0 0 1
3 3 −1
1 0 0
1 2 −1
0 1 0
4 2 1
1
0
0
0
0
1
0
0
−1 −2
0
−w
−5 −3
0
−1 −2 1 1 3
−2
x3
0
0
0
0
1
−1
−1
1
2
x2 x1
0 0
0 0
0 1
1 0
0 0
1
0
0
0
0
1 3 1 3 5 3
− 23
z
2 3 − 13 7 3
1 3 − 73
2 3 5 3 13 3
−w
0
1
0
0
0
0
1
1
0
0
4 3 2 3
−
1
I,II END
Chen CL
174
0 (−c3 in slack var col x3)
1st constraint (• ≤ 5) y1 = 2nd constraint (• = 4) y2 = 3rd constraint (• ≥ 1) y3 = or 3rd constraint (• ≤ −1) y3 =
⇒
(−c5 in art var col x5) (−c6 in art var col x6)
∂z 5 = ∂e2 3
4 ⇒
z:
If e3 : −1 → −2 ⇒
z:
If e2 :
5 →
∂z =0 ∂e1
5 3 − 73 7 3
13 3 13 3
→ →
∂z 7 = ∂e3 3
13 3 13 3
+ ( 53 ) × (1)
= 6
+ ( 73 ) × (−1) = 2
Chen CL
175
Ranging Right-hand Side Parameters
When RHS of a constraint is changed ⇒ constrained boundary moves parallel to itself ⇒ changing feasible region (iso-cost lines do not change)
If the changes are within a certain range, the sets of basic and nonbasic variables do not change
Limits on changes in resources Let ∆k be possible change in RHS bk of kth constraint. If ∆k satisfies the following inequalities, then no more iterations of the Simplex method are required to obtain solution for the altered problem
bi max − ; aij > 0 i aij
bi ≤ ∆i ≤ min − ; aij < 0 i aij
i=1∼m
Chen CL
176
bi: RHS parameter for ith constraint in final tableau aij : parameters in jth column of final tableau; the jth column corresponds to xj which is the slack variable for a ”≤ type” constraint, or the artificial variable for an equality constraint, or ”≥ type” constraint ∆k : possible change in RHS of kth constraint; the slack or the artificial variable for kth constraint determines index j of the column whose elements are used in the above inequalities Note: new RHS parameters bi” due to a change of ∆k in bk
bi” = bi + ∆k aij
i=1∼m
Chen CL
177
Ranges for Resource Limits: ≤ type Max:
z = 5x1 − 2x2 (= −f )
s.t.
2x1 + x2 ≤ 9 x1 − 2x2 ≤ 2
−3x1 + 2x2 ≤ 3,
x1, x2 ≥ 0
⇓ Max: z = 5x1 − 2x2 s.t.
2x1 +
x2 + x3
x1 − 2x2
−3x1 + 2x2
+ x4
=
9
=
2
+ x5 = 3,
xi ≥ 0
Chen CL
178
Chen CL
179
Basic z
x3
x4 x5
b bi/aic
x2 0
0
1 0.2 −0.4
0
1
x1 0
1
0 0.4
0.2
0
4
x5 0
0
0 0.8
1.4
1 13
0
0 1.6
1.8
0 18
z
x1 x2
1
For 1st constraint, x3 is the slack variable ⇒ j for ∆1 is x3 (the third column)
No negative element in 3rd column ⇒ no upper limit on ∆1
Chen CL
180
1 4 13 max − , − , − ≤ ∆1 ≤ − 0.2 0.4 0.8 −5 ≤ ∆1 ≤ ∞
4 ≤
b1
≤ ∞
4 13 1 ≤ ∆2 ≤ min − max − , − −0.4 0.2 1.4 −9.286 ≤ ∆2 ≤ 2.5
−7.286 ≤ b2 ≤ 4.5 13 max − ≤ ∆3 ≤ − 1 −13 ≤ ∆3 ≤ ∞
−10 ≤ b1 ≤ ∞
Chen CL
181
New values for design variables if 2x1 + x2 ≤ 9⇒10 (∆1 = 1) x2 = b1” = b1 + ∆1a13 = 1 + (1)(0.2)
= 1.2
x1 = b2” = b2 + ∆1a23 = 4 + (1)(0.4)
= 4.4
x5 = b3” = b3 + ∆1a33 = 13 + (1)(0.8)
= 13.8 (F )
Note: other variables remain nonbasic (= 0)
Chen CL
182
New values for design variables if x1 − 2x2 ≤ 2⇒3 (∆2 = 1) x2 = b1” = b 1 + ∆2a14 = 1 + (1)(−0.4)
= 0.6
x1 = b2” = b 2 + ∆2a24 = 4 + (1)(0.2)
= 4.2
x5 = b3” = b 3 + ∆2a34 = 13 + (1)(1.4)
= 14.4 (G)
Chen CL
183
New values for design variables if ∆1 = 1 and ∆2 = 1: x2 = b1” = b1 + ∆1a13 + ∆2a14 = 1 + (1)(0.2) + (1)(−0.4)
= 0.8
x1 = b2” = b2 + ∆1a23 + ∆2a24 = 4 + (1)(0.4) + (1)(0.2)
= 4.6
x5 = b3” = b3 + ∆1a33 + ∆2a34 = 13 + (1)(0.8) + (1)(1.4)
= 15.2 (H )
Chen CL
184
Ranges for Resource Limits: =, ≥ type Max:
z = x 1 + 4x2
s.t.
x1 + 2x2 ≤ 5 2x1 + x2 = 4 x1 − x2 ≥ 1,
x1, x2 ≥ 0
Chen CL
185
Basic z
x1 x2 x3
x4
x5
x6 1
2
− 23
2 3 5 3 13 3
x3
0
0
0
1 −1 −1
x2
0
0
1
0
x1
0
1
0
0
z
1
0
0
0
2 3 − 13 7 3
1 3 1 3 5 3
1 3 − 73
b bi/aic
x3 : slack (1st constraint), x4 : surplus (3rd) x5, x6 : artificial variables (2nd and 3rd constraints)
Chen CL
186
−2 ≤ ∆1 ≤ ∞ 3 ≤ b1
max − 21//33 , − 51//33
≤ ∆2 ≤ min − −21
2 ≤ b2
max − 21 , − 51//33
≤ ∞
( j = 3)
≤ 6
≤ ∆3 ≤ min − −22//33
−1 ≤ b3 ≤ 2
( j = 5) ( j = 6)
Chen CL
187
New solution if 2x1 + x2 = 4⇒5 x3 = b1” = b1 + ∆2a15 = 2 + (1)(−1)
= 1
x2 = b2” = b2 + ∆2a25 =
2 3 +
(1)( 13 )
= 1
x1 = b3” = b3 + ∆2a35 =
5 3 +
(1)( 13 )
= 2
Chen CL
188
New solution if x1 − x2 ≥ 1⇒2 x3 = b1” = b 1 + ∆3a16 = 2 + (1)(1)
= 3
x2 = b2” = b 2 + ∆3a26 =
2 3 +
(1)(− 23 )
= 0
x1 = b3” = b 3 + ∆3a36 =
5 3 +
(1)( 13 )
= 2 (C )
Chen CL
189
Ranging cost Coefficients
ck ⇒ck + ∆ck : admissible range on ∆ck such that the optimum design variables are not changed
Limits on change ∆ck depend on whether or not xk is a basic variable at optimum
Note: feasible region for the problem does not change
Chen CL
190
Theorem: range for cost coefficient of NBs Let ck be such that xk is not a basic variable. If ck ⇒ ck + ∆ck , − ck ≤ ∆ck ≤ ∞, then the optimum solution (design variables and cost function) does not change (ck is the cost coefficient corresponding to xk in final tableau)
Chen CL
191
Theorem: range for cost coefficient of BVs Let ck be such that x∗k is a basic variable and x∗k = b r . Then the range on change ∆ck in ck for which the optimum design variables do not change is given as max j
cj ; arj < 0 arj
≤ ∆ck ≤ min j
cj ; arj > 0 arj
The new cost function is f ∗ + ∆ck x∗k
arj : element in rth row and jth column of final tableau. Index r is determined by the row that determines x∗k Index j corresponds to each of the nonbasic columns excluding artificial columns if no arj > 0 ⇒ no upper limit, if no arj < 0 ⇒ no lower limit cj : reduced cost coefficient
Chen CL
192
Ranges for Resource Limits: ≤ type Max:
z = 5x1 − 2x2 (= −f )
s.t.
2x1 + x2 ≤ 9 x1 − 2x2 ≤ 2
−3x1 + 2x2 ≤ 3,
x1, x2 ≥ 0
Basic
z
x1
x2
x3
x4
x5
b
x2 x1 x5
0 0 0
0 1 0
1 0 0
0.2 0.4 0.8
0 0 1
1 4 13
z
1
0 −c1
0 −c2
1.6 −c3
−0.4 0.2 1.4 1.8 −c4
0 −c5
18
bi/aic
Chen CL
193
Max: z = 5x1 − 2x2
(c1 = 5, c2 = −2)
2nd row determines BV x1⇒r = 2 3rd, 4th columns are NBs ⇒ j = 3, 4
−∞ ≤ ∆c1 ≤ min
1.6 1.8 0.4 , 0.2
=4
−∞ ≤
c1
≤ −1
∗ znew =
z∗
+ ∆c1x∗1 (c1 = 5⇒4)
=
18
+ (−1)(4) = 14
Chen CL
194
1rd row determines BV x2⇒r = 1 3rd, 4th columns are NBs ⇒ j = 3, 4 max
1.8 −0.4
= −4.5 ≤ ∆c2 ≤ min
1.6 0.2
=8
−2.5 ≤
c2
≤ 10
∗ znew =
z∗
+ ∆c2x∗2 (c2 = −2⇒ − 3)
=
18
+ (−1)(1) = 17
Chen CL
195
Ranges for Resource Limits: =, ≥ type Max:
z = x 1 + 4x2
s.t.
x1 + 2x2 ≤ 5 2x1 + x2 = 4 x1 − x2 ≥ 1,
x1, x2 ≥ 0
Basic z
x1
x2
x3
x4
x5
x6
x3
0
0
0
1
−1
−1
1
2
x2
0
0
1
0
0
1
0
0
z
1
0
0
0
1 3 1 3 5 3
− 23
x1
2 3 − 13 7 3
2 3 5 3 13 3
1 3 − 73
−c1 −c2 −c3 −c4 −c5 −c6
b bi/aic
Chen CL
196
3rd row determines x1 as a basic (r = 3, j = 4) max
7/3 −1/3
= −7 ≤ ∆c1 ≤ ∞
−8 ≤
c1
≤ ∞
∗ znew =
z∗
+ ∆c1x∗1 (c1 = 1⇒2)
=
13 3
+ (1)( 53 ) = 6
2nd row determines x2 as a basic (r = 2, j = 4)
−∞ ≤ ∆c2 ≤ 3.5 −∞ ≤
c2
≤ −0.5
∗ znew =
z∗
+ ∆c2x∗2 (c2 = 4⇒3)
=
13 3
+ (−1)( 23 ) =
11 3
Chen CL
197
Changes in the Coefficient Matrix
aij ⇒aij + ∆aij ⇒ feasible region changes ∗ Q: find znew with minor computations
Case 1: when the change is associated with a nonbasic variable Case 2: when the change is associated with a basic variable
Theorem: change associated with a NB Let j in aij be such that xj is not a BV, and k be the column index for the slack or artificial variable associated with the ith row. Define a vector T cB = cB1 cB2 · · · cBm
where cBi = cj if x∗j = b∗i , i = 1 ∼ m (index i corresponds to ith row that determines optimum value of variable xj ). Also define a scalar m
R =
r=1
cBr ark
Chen CL
198
With this notation, if ∆aij satisfies the following inequalities
∆ij
≥
cj R cj R
≤ ≤∞ ≥ −∞
when R
< >
≤ ≥
0
then the optimum solution (design variables and cost function) do not change when aij ⇒ aij + ∆aij . Also, if R = 0, then the solution does not change for any value of ∆aij
Note: re-solve the problem if the inequalities are not satisfied
Chen CL
199
Theorem: change associated with a BV Let j in aij be such that xj is a BV and let x∗j = bt (t is the row index determining optimum value of xj ). Let index k and scalar R be defined as in previous Theorem. Let ∆aij satisfy the following inequalities:
br max , Ar < 0 =t r Ar
br ≤ ∆aij ≤ min , Ar > 0 =t r Ar
with Ar = b tark − br atk , r = 1 ∼ m; r = t, and
cq max − , Bq > 0 q Bq
cq ≤ ∆aij ≤ min − , Bq < 0 r =t Bq
with Bq = c q atk + aiq R for all q not in the basis, and 1 + atk ∆aij > 0 The upper and lower limits on ∆aij do not exist if the corresponding denominators do not exist.
If ∆aij satisfies the above inequalities, then the
optimum solution of the changed problem can be obtained without any further iterations of the Simplex method.
Chen CL
200
Homework 1. Solve the LP problems and verify the solutions graphically (1) Max: z = x1 + 4x2 s.t. x1 + 2x2 ≤ 5 x1 + x2 = 4 x1 − x2 ≥ 3 x1, x2 ≥ 0 (2) Max: z = 4x1 + 2x2 s.t. −2x1 + x2 ≤ 4 x1 + 2x2 ≥ 2 x1, x2 ≥ 0