8/11/2019 4 Linear Programming.pdf
1/202
Linear Programming
Cheng-Liang ChenPSELABORATORY
Department of Chemical EngineeringNational TAIWAN University
8/11/2019 4 Linear Programming.pdf
2/202
Chen CL 1
Refinery SchedulingThe Refinery Process
8/11/2019 4 Linear Programming.pdf
3/202
Chen CL 2
Refinery SchedulingProblem Data
Product Yields bbl/bbl crude Product Maximum
Fuel Process Lube Value Demand
Products/Crudes 1 2 3 4 4 $/bbl kbbl/wk
Gasoline 0.6 0.5 0.3 0.4 0.4 45.00 170
Heating Oil 0.2 0.2 0.3 0.3 0.1 30.00 85
Jet Fuel 0.1 0.2 0.3 0.2 0.2 15.00 85
Lube Oil 0.0 0.0 0.0 0.0 0.2 60.00 20
Operating Losses 0.1 0.1 0.1 0.1 0.1
Crude Cost $/bbl 15. 15. 15. 25. 25.Operating Cost $/bbl 5.0 8.5 7.5 3.0 2.5
Crude Supply kbbl/wk 100 100 100 200
8/11/2019 4 Linear Programming.pdf
4/202
Chen CL 3
Refinery SchedulingProblem Analysis
For 1 kbbl/wk of crude 1, one can produce 0.6 kbbl/wk of
gasoline,
0.2 kbbl/wk of heating oil,
0.1 kbbl/wk of jet fuel,
with production cost of20 k$ per kbbl/wk.Values of products produced:
45(0.6) + 30(0.2) + 15(0.1) = 34.5 k$
Profit for 1 kbbl/wk of crude 1: 34.5 (15 + 5) = 14.5 k$
Similarly: profits of8.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
8/11/2019 4 Linear Programming.pdf
5/202
Chen CL 4
Refinery SchedulingProblem 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 100kbbl/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 nextmost profitable crude (crude 4 in lube process)
C C
8/11/2019 4 Linear Programming.pdf
6/202
Chen CL 5
Refinery SchedulingProblem Analysis
Use nextmost profitable crude (crude 4 in lube process):
Using 100kbbl/wk of crude 4 produces (accumulated value)
60 + 40 = 100kbbl/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)
Use3rd most profitable crude (crude 2) as much as we can
Ch CL 6
8/11/2019 4 Linear Programming.pdf
7/202
Chen CL 6
Refinery SchedulingProblem Analysis
Use3rd most profitable crude (crude 2) as much as we can:
Using 100kbbl/wk of crude 2 produces
60 + 40 + 50 = 150 kbbl/wk of gasoline,20 + 10 + 20 = 50kbbl/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)
Use4th most profitable crude (crude 3) as much as we can
Ch CL 7
8/11/2019 4 Linear Programming.pdf
8/202
Chen CL 7
Refinery SchedulingProblem Analysis
Use4th most profitable crude (crude 3) as much as we can:
Using 66.67kbbl/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)
Ch CL 8
8/11/2019 4 Linear Programming.pdf
9/202
Chen CL 8
Refinery SchedulingProblem 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
Ch CL 9
8/11/2019 4 Linear Programming.pdf
10/202
Chen CL 9
Refinery SchedulingLinear Programming Formulation
Max J =
product sales 4
p=1 vpQp production cost 5
r=1 Crxrs.t. xr Sr r= 1, 2, 3
x4+ x5 S4
Qp = ap1x1+ ap2x2+ ap3x3+ ap4x4+ ap5x5Qp Dp p= 1, . . . , 4
Qp 0 p= 1, . . . , 4
xr 0 r= 1, . . . , 5
Chen CL 10
8/11/2019 4 Linear Programming.pdf
11/202
Chen CL 10
Refinery SchedulingGAMS Formulation
set C crudesset P products
data Sc CSUPPLY(C)
Dp PDEMAND(P)
vp PVALUE(P)
Cc TCOST(C)
apc YIELDs(P,C)
TCOST(C) sum of CCOST(C) and OCOST(C)(costs of crude c and operating cost)
PROFIT objective functionPRODUCTION(P) Qp equations
X4 total crude 4 usage
X4.UP = CSUPPLY(4-fuel), upper bound
X.UP(C) supply constraints onxc
Q.UP = PDEMAND(P)
Chen CL 11
8/11/2019 4 Linear Programming.pdf
12/202
Chen CL 11
Refinery SchedulingGAMS 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
8/11/2019 4 Linear Programming.pdf
13/202
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
8/11/2019 4 Linear Programming.pdf
14/202
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 demaQ.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 solveMODEL SCHEDULE /ALL/;
SOLVE SCHEDULE USING LP MAXIMIZING PROFIT;
DISPLAY X.L, Q.L, PROFIT.L;
Chen CL 14
8/11/2019 4 Linear Programming.pdf
15/202
Chen CL 14
Refinery SchedulingGAMS 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
8/11/2019 4 Linear Programming.pdf
16/202
Chen CL 15
Refinery SchedulingLinear Programming Formulation: Rearranged for MATLAB
Max J =
product sales 4
p=1vpQp
production cost 5
r=1Crxr
=
product sales 4
p=1
vp
5r=1
aprxr
Qp
production cost 5
r=1
Crxr
=5
r=1
(vpapr Cr) xr =5
r=1
frxr
Max J = vtA CT x = fTx
Chen CL 16
8/11/2019 4 Linear Programming.pdf
17/202
Chen CL 16
s.t. xr Sr r= 1, 2, 3; x4+ x5 S4
Qp Dp 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
x1
x2
x3
x4
x5
x
S1
S2
S3
S4
D1
D2
D3
D4
B
Chen CL 17
8/11/2019 4 Linear Programming.pdf
18/202
Chen CL 17
Refinery SchedulingMATLAB Code
YIELDS = [ 0.6 0.5 0.3 0.4 0.4 ;
0.2 0.2 0.3 0.3 0.1 ;
0.1 0.2 0.3 0.2 0.2 ;
0.0 0.0 0.0 0.0 0.2];
CSUPPLY = [100, 100, 100, 200 ];
PDEMAND = [170, 85, 85, 20 ];
PVALUE = [ 45, 30, 15, 60 ];
CCOST = [ 15, 15, 15, 25, 25];OCOST = [ 5, 8.5, 7.5, 3, 2.5];
TCOST = CCOST + OCOST ;
f = [- PVALUE*YIELDS + TCOST];
A = [1 0 0 0 0 ;
0 1 0 0 0 ;
0 0 1 0 0 ;0 0 0 1 1 ; YIELDS ] ;
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);
x, Q = YIELDS*x, PROFIT = - NPROFIT
x =
100.0000100.0000
66.6667
0.0000
100.0000
Q =170.0000
70.0000
70.0000
20.0000
PROFIT =
3.4000e+003
Chen CL 18
8/11/2019 4 Linear Programming.pdf
19/202
Chen CL 18
A Heat Exchange Network Design ProblemStream F Cp (kW/K) Tin (K) Tout (K)
H1 20 700 410
H2 40 600 310H3 70 460 310
H4 94 360 310
C1 50 350 650
C2 180 300 400
Utility Temp. (K) Cost ($/KW-yr) Max available (kW)
Fuel 750 120
HP steam 510 90 1000
LP steam 410 70 500
Cooling water 300 325 15
min. temperature approach = 10 KH1 is not to be allowed to exchange any heat with C1
Chen CL 19
8/11/2019 4 Linear Programming.pdf
20/202
Chen CL 19
Transshipment LP ModelHeat Contents of Process Streams
Interval Thot Tcold Heat Contents
H1 H2 H3 H4 C1 C2
700 6900 800 - - - - -
660 6501 1200 - - - 3000 -
600 5902 1800 3600 - - 4500 -
510 5003 1000 2000 - - 2500 -
460 4504 1000 2000 3500 - 2500 -
410 4005 - 2000 3500 - 2500 9000
360 3506 - 2000 3500 4700 - 9000
310 300
Chen CL 20
8/11/2019 4 Linear Programming.pdf
21/202
Chen CL 20
Heat Exchanger Network DesignTransshipment Model for Heat Flows
Chen CL 21
8/11/2019 4 Linear Programming.pdf
22/202
Condensed Transshipment LP ModelNotations
Assume : any pair of heat/cold streams can exchange heat
R15 heat residuals
Qfuel, QHP, QLP, QW : heating and cooling loads
Hk = {i| hot stream i supplies heat to interval k}
Ck = {j| cold stream j demands heat from interval k}
Sk = {m| hot utility msupplies heat to interval k}
Wk = {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
8/11/2019 4 Linear Programming.pdf
23/202
Condensed Transshipment LP ModelHeat Flows in Interval k
Par.s QHik heat contents of hot streami in interval k
QCjk heat contents of hot streami in interval k
cm, cn unit costs of hot streamm and cold streamn
Var.s QSm, QWn heat loads of hot (cold) utility m(n)Rk heat residual exiting intervalk
Chen CL 23
8/11/2019 4 Linear Programming.pdf
24/202
Condensed Transshipment LP ModelLP Formulation
minmS
cmQSm +
nW
cnQWn
s.t. Rk1+
iHkQHik+
mSkQSm=Rk+
jCkQCjk +
nWkQWn
QSm 0, QWn 0, k= 1, , K 1
Rk 0, R0=RK= 0
Chen CL 24
8/11/2019 4 Linear Programming.pdf
25/202
Expanded Transshipment LP ModelHeat Exchange Between Hot and Cold Streams
Chen CL 25
8/11/2019 4 Linear Programming.pdf
26/202
Expanded Transshipment LP ModelHeat 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 msupplies 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 kRik=heat residual of hot stream i exiting interval k
Rmk=heat residual of hot utility m exiting interval k
Chen CL 26
8/11/2019 4 Linear Programming.pdf
27/202
Expanded Transshipment LP ModelLP Formulation
min mS
cmQSm +
nWcnQ
Wn
s.t. Ri,k1+ QHik=Rik+
jCk
Qijk+
nWk
Qink k K, i H
k
Rm,k1+ QSm=Rmk+ jCk Qmjk k K, m S
kiH
k
Qijk +
mS
k
Qmjk=QCjk k K, j Ck
iHkQink=Q
Wn k K, n Wk
Rik, Rmk, Qijk, Qmjk, Qink, QSm, Q
Wn 0 Ri0=RiK= 0
Qijk= 0 fori= 1, j = 1, k K (forbidden match)
QLij K
k=1
Qijk QUij i, j (lower/upper bound
Chen CL 27
8/11/2019 4 Linear Programming.pdf
28/202
Expanded Transshipment LP ModelGAMS 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 hot streams /1*4/
C cold streams /1*2/
S hot utilities /1*3/
W cold utilities /1*1/K 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 28
8/11/2019 4 Linear Programming.pdf
29/202
/ 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 /;
Chen CL 29
8/11/2019 4 Linear Programming.pdf
30/202
PARAMETER CW(W) cold utility cost
/ 1 15 /;
PARAMETER 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) = 0 ;
QUHC(H,C) = INF ; QUHC(1,1) = 0 ;
QLHW(H,w) = 0 ;
QUHW(H,W) = INF ;
QLCS(C,S) = 0 ;
QUCS(C,S) = INF ;
* these could also be inserted in table format ...
* imposed matches
* table QLHC(H,C)
* 1 2 3 4
* 1
* 2
* 3
Chen CL 30
8/11/2019 4 Linear Programming.pdf
31/202
* 4
* 5 ;
*================= 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) - existenceSK(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 31
8/11/2019 4 Linear Programming.pdf
32/202
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),
Chen CL 32
8/11/2019 4 Linear Programming.pdf
33/202
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 KQHC(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 objective function for minimum utility consumption
HBAL(H,K) hot stream HEAT BALANCES
CBAL(C,K) cold stream HEAT BALANCES
SBAL(S,K) hot utility HEAT BALANCES
WBAL(W,K) cold utility HEAT BALANCES
hcIMPOSE(H,C) imposed match between hot and cold stream
Chen CL 33
8/11/2019 4 Linear Programming.pdf
34/202
hcRESTRICT(H,C) restriction between hot and cold stream
hwIMPOSE(H,W) imposed match between hot stream and cold utility
hwRESTRICT(H,W) restriction between hot stream and cold utility
csIMPOSE(C,S) imposed match between cold stream and hot utility
csRESTRICT(C,S) 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 34
8/11/2019 4 Linear Programming.pdf
35/202
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 ;
Chen CL 35
8/11/2019 4 Linear Programming.pdf
36/202
Expanded Transshipment LP ModelResults (H1-C1 is Forbidden)
fuel 3900 kW
high pressure steam 500 kW
cold utility 3800 kW
min utility cost 570, 000 $/year
Chen CL 36
8/11/2019 4 Linear Programming.pdf
37/202
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
S
8/11/2019 4 Linear Programming.pdf
38/202
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
Li P i Si l E l
8/11/2019 4 Linear Programming.pdf
39/202
Linear Programming: Simple Examples
Case 3:
unbounded
solution
Min f= 4x1 x2+ 50
s.t. x1 x2 2
x1, x2 0
Chen CL 39
Li P i Si l E l
8/11/2019 4 Linear Programming.pdf
40/202
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 Pl f C 1
8/11/2019 4 Linear Programming.pdf
41/202
MATLAB Plot for Case 1% LP: Case 1 - Single solution
[x1,x2] = meshgrid(0:0.1:6, 0:0.1:6);
f = -4*x1-2*x2+50;g1 = x1-x2-2; g2 = x1+2*x2-8;
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])
Min f= 4x1 x2+ 50
s.t. x1 x2 2x1+ 2x2 8
x1, x2 0
Chen CL 41
8/11/2019 4 Linear Programming.pdf
42/202
hold on
cv = [0 0];
fv = [25, 30, 35, 40, 45];
const1 = contour(x1,x2,g1,cv,r,LineWidth,3);const2 = contour(x1,x2,g2,cv,b,LineWidth,3);
const3 = contour(x1,x2,g3,cv,k,LineWidth,3);
const4 = contour(x1,x2,g4,cv,k,LineWidth,3);
fs = 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
Min f= 4x1 x2+ 50
s.t. x1 x2 2
x1+ 2x2 8x1, x2 0
8/11/2019 4 Linear Programming.pdf
43/202
Chen CL 43
MATLAB S l ti f C 2
8/11/2019 4 Linear Programming.pdf
44/202
MATLAB Solution for Case 2% Linear programming:
% Multiple solutions (Case 2)
%f = [-1 1];
A = [ 1 -1 ;
1 2];
B = [ 2; 8];
lb = zeros(2,1);
x0 = [ 0; 0];
%x0 = [ 0; 4];
options = optimset(LargeScale,off)
[x,fval,exitflag,output,lambda] =...linprog(f,A,B,[],[],lb,[],x0,options)
x0, x, fval = fval + 30
Min f= x1+ x2+ 30
s.t. x1 x2 2
x1+ 2x2 8x1, x2 0
x0 =
0
0
x =
2
0
fval =
28
x0 =
0
4
x =
3
1
fval =
28
Chen CL 44
A St d d Li P i P bl
8/11/2019 4 Linear Programming.pdf
45/202
A Standard Linear Programming Problem
Min: f(x) =c1x1+ + cnxn =n
j=1
cjxj (f=cTx)
s.t. a11x1+ + a1nxn=b1 =
nj=1
a1jxj
(Ax=b)
am1x1+ + amnxn=bm =
nj=1
amjxj
xj 0, bj 0; (x 0 b 0)
Chen CL 45
8/11/2019 4 Linear Programming.pdf
46/202
2y1+ y2 4 2y1 y2 4
2y1 y24 2y1 y2 s1= 4, s1: surplus variable
2y1 y24 2y1 y2+ s2= 4, s2: slack variable
2y1 y2= 4, y2:unrestricted in sign 2y1 (y
+2 y
2) = 4, y
+2, y
2 0
max z min f= z
8/11/2019 4 Linear Programming.pdf
47/202
Chen CL 47
8/11/2019 4 Linear Programming.pdf
48/202
Max: z= 2y1+ 5(y+2 y
2)
s.t. 3y1+ 2(y+2 y2) + s1= 12
2y1+ 3(y+2 y
2) s2= 6
y1, y+2, y
2, 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 Co ce ts Related to Li ea
8/11/2019 4 Linear Programming.pdf
49/202
Basic Concepts Related to LinearProgramming 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)
8/11/2019 4 Linear Programming.pdf
50/202
Chen CL 50
8/11/2019 4 Linear Programming.pdf
51/202
Max: z= 400x1+ 600x2
s.t. x1+ x2+ x3= 16
128
x1+ 114x2+ x4= 11
14x1+
124
x2+ x5= 1
xi 0
x3 = 16 x1 x2
x4 = 1 128
x1 114
x2
x5 = 1 114
x1 124
x2
z = 400x1+ 600x2
(xi 0) Infinite number of solutionswith different z values
8/11/2019 4 Linear Programming.pdf
52/202
Chen CL 52
MATLAB Code
8/11/2019 4 Linear Programming.pdf
53/202
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
8/11/2019 4 Linear Programming.pdf
54/202
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
8/11/2019 4 Linear Programming.pdf
55/202
LP Terminology Vertex (Extreme) Point:
Feasible Solution: Solution of constrained equationssatisfying 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 55
Degenerate Basic Feasible Solution:
8/11/2019 4 Linear Programming.pdf
56/202
Degenerate Basic Feasible Solution:
Optimum Solution:
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 Aof constrained equationscorresponding to basic variables are said to form a basis for the
mdimensional vector space. Any other mdimensional vector
can be expressed as a linear combination of the basis vectors.
Chen CL 56
Determination of Basic Solutions
8/11/2019 4 Linear Programming.pdf
57/202
Determination of Basic Solutions
Max: z= 4x1
+ 5x2
s.t. x1+ x2 4
x1+ x2 6
x1, x2 0
Max: z= 4x1
+ 5x2
s.t. x1+ x2+ x3= 4
x1+ x2+ x4= 6
x1, x2, x3, x4 0
x1 x2 x3 x4 z
1 0 0 4 6 0 A
2 0 4 0 2 20 B3 0 6 2 0 E (x)
4 4 0 0 10 F (x)
5 6 0 10 0 24 D
6 1 5 0 0 29 C
Chen CL 57
Optimum Solution for LP Problems
8/11/2019 4 Linear Programming.pdf
58/202
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
8/11/2019 4 Linear Programming.pdf
59/202
Theorem: basic theorem of linear programming
Let the m n coefficient matrix A of constrainedequations 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 n!m!(nm)! vertices)
8/11/2019 4 Linear Programming.pdf
60/202
Chen CL 60
Canonical Form
8/11/2019 4 Linear Programming.pdf
61/202
Canonical Form
An m
n system of simultaneous equations withrank(A) = m is said to be in canonical form if eachequation has a variable (with unit coefficient) that doesNOT 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+1
xm+1
+ am,m+2
xm+2
+
+ am,n
xn
=bm
or I(m)x(m)+ Qx(nm) =b
Note: if x(nm)= 0 then x(m) =b
Chen CL 61
Tableau
8/11/2019 4 Linear Programming.pdf
62/202
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
8/11/2019 4 Linear Programming.pdf
63/202
Example: canonical form and basic feasible solutionMin: f= 2x1 x2
s.t. 4x1+ 3x2+ x3= 12
2x1+ x2+ x4= 4
x1+ 2x2+ x5= 4, xi 0
Basic x1 x2 x3 x4 x5 b basic solution
x3 4 3 1 0 0 12 x1=x2= 0x4 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 solutionx1=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
8/11/2019 4 Linear Programming.pdf
64/202
Pivot Step: Interchange of Basic andNonbasic 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
8/11/2019 4 Linear Programming.pdf
65/202
Pivot OperationInterchange of Basic and Nonbasic Variables
Min: f= 2x1 x2
s.t. 4x1+ 3x2+ x3= 12
2x1+ x2+ x4= 4
x1+ 2x2+ x5= 4, xi 0
Basic x1 x2 x3 x4 x5 b basic solutionx3 4 3 1 0 0 12 x1=x2= 0
x4 2 1 0 1 0 4 x3= 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 1
2 0 1
2 0 2 x3= 4, x1= 2, x5= 2
x5 0 3
2 0 12 1 2 f= 4
Chen CL 65
Basic Steps of The Simplex Method
8/11/2019 4 Linear Programming.pdf
66/202
Basic Steps of The Simplex Method
Three basic questions: Is the current basic feasible solution optimal ?
If not,
How to choose a current nonbasic variable that should
become basic ?
Which variable from the current basic set should
become nonbasic ?
Chen CL 66
Example: steps of the Simplex method
8/11/2019 4 Linear Programming.pdf
67/202
p p p
Max: z= 2x1+ x2 = f (min f)
s.t. 4x1+ 3x2 122x1+ x2 4
x1+ 2x2 4 x1, x2 0
z = 4 along CD
Chen CL 67
In standard LP form:
8/11/2019 4 Linear Programming.pdf
68/202
Min: f = 2x1 x2
s.t. 4x1 + 3x2 + x3 = 122x1 + x2 + x4 = 4
x1 + 2x2 + x5 = 4
xi 0
NBs: x1 = 0 x2 = 0 (A)
BVs: x3 = 12 x4 = 4 x5 = 4f = 0 z = 0
Note: f 2x1 x2 = 0
Chen CL 68
Basic f x1 x2 x3 x4 x5 b bi/ai
8/11/2019 4 Linear Programming.pdf
69/202
Basic f x1 x2 x3 x4 x5 b bi/aic
x3 0 4 3 1 0 0 12 12
4 = 3
x4 0 2 1 0 1 0 4 4
2
= 2
x5 0 1 2 0 0 1 4 4
1= 4
f 1 2 1 0 0 0 0
Cost row has nonzero entries only in nonbasic columns (x1, x2)
If all nonzero entries are nonnegative optimum soln (?)Currently, TWO negative entriesNOT optimum
Select x1 to become basic (?) elimination in x1 columnTo keep cost fcn right: f 2x1 x2+ 0x3+ 0x4+ 0x5 = 0
If letting x1 = 0, x2 = 0 1 thenf = 0 1; Ifx1 = 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;Ifx1 = 0 1, x2 = 0, x4 = 4 2; Ifx1 = 0 2, x2 = 0, x4 = 4 0
Chen CL 69
Basic f x1 x2 x3 x4 x5 b bi/ai
8/11/2019 4 Linear Programming.pdf
70/202
Basic f x1 x2 x3 x4 x5 b bi/aic
x3 0 0 1 1 2 0 4
x1 0 1 1
2
0 1
2
0 2
x5 0 0 3
2 0 12 1 2
f 1 0 0 0 1 0 4
NBs: x2 = 0 x4 = 0 (D)BVs: x3 = 4 x1 = 2 x5 = 2
f = 4 z = 4
All coefficients in last row are nonnegativeno 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
8/11/2019 4 Linear Programming.pdf
71/202
the pivot row ?
If interchange nonbasic var x1 with basic varx5 not feasible !
Basic f x1 x2 x3 x4 x5 b bi/aic
x3 0 4 3 1 0 0 12 12
4 = 3
x4
0 2 1 0 1 0 4 42
= 2
x5 0 1 2 0 0 1 4 4
1= 4
f 1 2 1 0 0 0 0
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
8/11/2019 4 Linear Programming.pdf
72/202
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, andall those corresponding to NBs are nonzero.
If any of the nonzero entries in last row is negative not optimumOtherwise, an optimum solution has been reached
Chen CL 72
If optimum is not reachedinterchange a current BV with a NB
8/11/2019 4 Linear Programming.pdf
73/202
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
8/11/2019 4 Linear Programming.pdf
74/202
pSelection of A Basic Variable to Become Nonbasic
Assumexc is a NB tapped to become a BVcth NB column replace some current basic column
xcis to become a basic xc 0 (after interchange, allzero elements in cth column except unit element at one location)
x1 +a1,m+1xm+1+ + a1cxc+ + a1,nxn =b1
x2 +a2,m+1xm+1+ + a2cxc+ + a2,nxn =b2
xm +am,m+1xm+1+ + amcxc+ + am,nxn =bm
Chen CL 74
Pivoting new canonical form (still keep equality constraints):
8/11/2019 4 Linear Programming.pdf
75/202
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 =bm amcxc 0
xi = bi aicxc 0 if aic0 and xc= biaic
br
arc= min
aic >0i = 1 m
bi
aic
maximum allowable xc
to keep all xi 0
Select the row index r giving the least ratio of RHS parameter
with positive element inc column
If all aic are non-positive in the cth column, then xc can be
increased indefinitelyunbounded problem !
Chen CL 75
Derivation of the Simplex Method
8/11/2019 4 Linear Programming.pdf
76/202
pSelection of A Nonbasic Variable to Become Basic
xi = bi n
j=m+1
aijxj; i= 1 m
f =m
i=1 cixi+n
j=m+1 cjxj=
mi=1
ci
bi n
j=m+1
aijxj
+ n
j=m+1
cjxj
=m
i=1
bici f0
+n
j=m+1
cj m
i=1
aijci cj
xj
= f0+
n
j=m+1cjxj
Chen CL 76
Expressing cost function in terms of present NB
8/11/2019 4 Linear Programming.pdf
77/202
cj: reduced cost coefficients (in last row ofSimplex tableau)
Forcj 0 unique optimum
If at least one cj = 0 a possibility of alternate optima
If the NB associated with the negative reduced cost coefficient cjcannot be made basis (all aij in c
j column are negative),
then the feasible solution is unbounded
Chen CL 77
Theorem: improvement of basic feasible solution
8/11/2019 4 Linear Programming.pdf
78/202
Given a nondegenerate basic feasible solution with corresponding
cost function f0, suppose cj
8/11/2019 4 Linear Programming.pdf
79/202
y pMax: 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/aicx3 0 1 1 1 0 4
41= 4
x4 0 1 1 0 1 6 6
1= 6
f 1 4 5 0 0 0x2 0 1 1 1 0 4x4 0 2 0 1 1 2
22= 1
f 1 9 0 5 0 20
x2
0 0 1 12
1
2 5
x1 0 1 0 12
12 1
f 1 0 0 1292 29
Chen CL 79
Ex: Solution by the Simplex Method
8/11/2019 4 Linear Programming.pdf
80/202
y
Max: z= 400x1+ 600x2 = f
s.t. x1+ x2+ x3= 16, 1
28
x1+ 1
14
x2+ x4= 11
14x1+ 124x2+ x5= 1 xi 0
Basic f x1 x2 x3 x4 x5 b bi/aicx3 0 1 1 1 0 0 16 16x4 0 1/28 1/14 0 1 0 1 14
x5 0 1/24 1/24 0 0 1 1 24f 1 400 600 0 0 0 0x3 0 1/2 0 1 14 0 2 4x2 0 1/2 1 0 14 0 14 28x5 0 17/336 0 0 7/12 1 5/12 140/17
f 1 100 0 0 8400 0 8400x1 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
f 1 0 0 200 5600 0 8800
8/11/2019 4 Linear Programming.pdf
81/202
Chen CL 81
x(1) NBs: x2 = x4 = 0
8/11/2019 4 Linear Programming.pdf
82/202
x( ) 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
8/11/2019 4 Linear Programming.pdf
83/202
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
8/11/2019 4 Linear Programming.pdf
84/202
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
8/11/2019 4 Linear Programming.pdf
85/202
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 anextreme point (vertex) located in the new expanded space
Extreme pt in expanded space extreme pt in original spaceall AVs will be nonbasic (zero value)
further movements are only among extreme pts of original space
Chen CL 85
Artificial cost Function
8/11/2019 4 Linear Programming.pdf
86/202
Min: w =xn+1+ + xn+m = AV sxn+i
s.t. xn+1 +a11x1+ + a1nxn =b1
xn+2 +a21x1+ + a2nxn =b2...
xn+m +am1x1+ + amnxn =bm
w =m
i=1
bi n
j=1aijxj
=
m
i=1bi
n
j=1m
i=1aij
cj
xj
= c1x1 + + cnxn +
mi=1
bi
Chen CL 86
Phase I:
8/11/2019 4 Linear Programming.pdf
87/202
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)
ifw = 0iterations continued for minimizing f ifw = 0no feasible solution exists for original problem
Phase II: same as before
Chen CL 87
Use AVs for Type Constraints
8/11/2019 4 Linear Programming.pdf
88/202
Max: z=y1+ 2y2 = f
s.t. 3y1+ 2y2 12
2y1+ 3y2 6
y1 0, y2:free in sign
y2 = y+2 y
2 x2 x3;
x4 : slack;
x5 : surplus;
x6 : AV
Chen CL 88
Min: w=x6= 6 2x1 3x2+ 3x3+ x5
8/11/2019 4 Linear Programming.pdf
89/202
s.t. 3x1+ 2x2 2x3+ x4= 12
2x1+ 3x2 3x3 x5+ x6= 6
f x1 2x2+ 2x3= 0, xi 0
Basic f w x1 x2 x3 x4 x5 x6 b bi/aicx4 0 0 3 2 2 1 0 0 12
122 = 6
x6 0 0 2 3 3 0 1 1 6 6
3= 2
f 1 0 1 2 2 0 0 0 0w 0 1 2 3 3 0 1 0 6
x4 0 0 5
3 0 0 1 2
3 23 8
82/3= 12
x2 0 0 2
3 1 1 0 13
13 2
f 1 0 13
0 0 0 23
2
3 4
w 0 1 0 0 0 0 0 1 0 Phase I ENDx5 0 0
52 0 0
32 1 1 12
x2 0 0 3
2 1 1 1
2 0 0 6 f 1 0 2 0 0 1 0 0 12 Phase II END
Chen CL 89
Use of AVs for Equality Constraints
8/11/2019 4 Linear Programming.pdf
90/202
Max: z=x1+ 4x2 = f
s.t. x1+ 2x2 5
2x1+ x2= 4
x1 x2 0 (infeasible)
Chen CL 90
Min: f= x1 4x2
8/11/2019 4 Linear Programming.pdf
91/202
s.t. x1 + 2x2 + x3 = 5
2x1 + x2 + x5 = 4
x1 x2 x4 + x6 = 3
xi 0
Basic f w x1 x2 x3 x4 x5 x6 b bi/aicx3 0 0 1 2 1 0 0 0 5
51= 5
x5 0 0 2 1 0 0 1 0 4 42= 2x6 0 0 1 1 0 1 0 1 3
31= 3
f 1 0 1 4 0 0 0 0 0w 0 1 3 0 0 1 1 0 7
x3 0 0 0 3
2 1 0 12 0 3
x1 0 0 1 1
2 0 0 1
2 0 2x6 0 0 0
32 0 1
12 1 1
f 1 0 0 72 0 0 1
2 0 2w 0 1 0 32 0 1
32 0 1 Phase I END
Chen CL 91
Use of AVs: Unbounded Problems
8/11/2019 4 Linear Programming.pdf
92/202
Min: f= 3x1+ 2x2
s.t. x1 x2 0
x1+ x2 2 x1, x2 0
8/11/2019 4 Linear Programming.pdf
93/202
8/11/2019 4 Linear Programming.pdf
94/202
Chen CL 94
Implication of Degenerate Basic Feasible Solution
8/11/2019 4 Linear Programming.pdf
95/202
Max: z= x1 +4x2
s.t. x1 +2x2 5
2x1 +x2 4
2x1 +x2 4
x1 x2 1
Min: f= x1 4x2
s.t. x1 +2x2 +x3 = 5
2x1 +x2 +x4 = 4
2x1 +x2 x5 +x7 = 4
x1 x2 x6 +x8 = 1
xi 0
Chen CL 95
Basic f w x1 x2 x3 x4 x5 x6 x7 x8 b bi/aic
8/11/2019 4 Linear Programming.pdf
96/202
x3 0 0 1 2 1 0 0 0 0 0 5 5
1= 5
x4 0 0 2 1 0 1 0 0 0 0 4 4
2= 2
x7 0 0 2 1 0 0 1 0 1 0 4 4
2= 2
x8 0 0 1 1 0 0 0 1 0 1 1 1
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 5x3 0 0 0 3 1 0 0 1 0 1 4
43
x4 0 0 0 3 0 1 0 2 0 2 2 2
3
x7 0 0 0 3 0 0 1 2 1 2 2 2
3x1 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
8/11/2019 4 Linear Programming.pdf
97/202
Chen CL 97
Implication of Degenerate Basic Feasible Solution
8/11/2019 4 Linear Programming.pdf
98/202
x3, x4: slack; x5, x6: surplus; x7, x8: artificial
3rd tableau: basic variablex4 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
8/11/2019 4 Linear Programming.pdf
99/202
The only way the new feasible solution can be nondegenerate is
when the element in pivot column and the degenerate variable rowis negative
The final solution:
NBs: x4=x6=x7=x8= 0
BVs: x1= 53, x2=
23, x3= 2, x5= 0
f= 133 z= 13
3
Chen CL 99
Alternate Simplex Method:Th Bi M M th d
8/11/2019 4 Linear Programming.pdf
100/202
The Big-M MethodFor , = type constraints, augment fwith 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 x3 x4 x5 x6 b bi/aic12
8/11/2019 4 Linear Programming.pdf
101/202
x4 0 3 2 2 1 0 0 12 12
2 = 6
x6 0 2 3 3 0 1 1 6 6
3= 2
f 1 21 32 32 0 10 0 60x4 0
53 0 0 1
23
23 8
82/3= 12
x2 0 2
3 1 1 0 13
13 2
f 1 13 0 0 0 23
323 4
x5 0 5
2 0 0 3
2 1 1 12
x2 0 3
2 1 1 1
2 0 0 6
f 1 2 0 0 1 0 10 12
Chen CL 101
Simplex Method in Matrix Form
8/11/2019 4 Linear Programming.pdf
102/202
Min: f = cTx
s.t. Ax b
x 0
Min: f = cTxs.t. Ax + xs = b
x 0, xs 0
Chen CL 102
8/11/2019 4 Linear Programming.pdf
103/202
0 A I
1 cT 0
f
x
xs
=
b
0
Basic f x xs RHS
xs 0 A I b
f 1 cT 0 0
Chen CL 103
8/11/2019 4 Linear Programming.pdf
104/202
b =
A I
xxs
=
B N
xBxN
= Bx
B+ N x
N=0 = BxB x
B = B1b
f = cTB
xB
+ cTN
xN
= cTB
xB
= cTB
B1b
Chen CL 1040 B
f
=
b
8/11/2019 4 Linear Programming.pdf
105/202
1 cT
B
xB
0
fxB
= 0 B1 cT
B
1b0
= cTBB1 1
B1 0b
0
= cT
BB1b
B1b
Chen CL 105
f
8/11/2019 4 Linear Programming.pdf
106/202
0 A I
1 cT
0
f
x
xs
=
b
0
cT
BB1 1
B1 0
1 cT cTBB1A cTBB10 B1A B1
fxxs
=cTBB1b
B1b
Basic f x xs RHS
xB
0 B1A B1 B1b
f 1 cT cTB
B1A cTB
B1 cB
B1b
Chen CL 106
Example
8/11/2019 4 Linear Programming.pdf
107/202
Min: f= 6 4 0 0 0
x1
x2
x3
x4
x5
s.t.9 4 1 0 05 8 0 1 0
1 1 0 0 1
x1
x2x3
x4
x5
=360400
55
8/11/2019 4 Linear Programming.pdf
108/202
Chen CL 108
0 1 8
8/11/2019 4 Linear Programming.pdf
109/202
B1 =
0 1383
0 13 53
1 53 523
xB
= B1b =
0 13
83
0 13 53
1 5
3 52
3
360
400
55
=
403
1253
220
3
f = cT
BxB
=
6 4 0
403
1253
2203
= 740
3
8/11/2019 4 Linear Programming.pdf
110/202
8/11/2019 4 Linear Programming.pdf
111/202
Chen CL 111
Procedures
8/11/2019 4 Linear Programming.pdf
112/202
Initialization:
Initial canonical form
Improvement:
Compute cj dj, select xEwith most negative cj dj
Select xV
with least ratio min bki
aiE
, aiE
>0
Replace aV
ofxV
with aE
ofxE
find the new Bnew
Optimality Check:
compute new cj dj by using Bnew stop ifcj dj 0 j N
xB
=B1newb, f =c
BxB
8/11/2019 4 Linear Programming.pdf
113/202
Chen CL 113
8/11/2019 4 Linear Programming.pdf
114/202
xB
=
x3
x4
x5
xN =
x1
x2 c
B =
0
0
0
cN
=
6
4
B=
1 0 0
0 1 0
0 0 1
B1 =
1 0 0
0 1 0
0 0 1
8/11/2019 4 Linear Programming.pdf
115/202
8/11/2019 4 Linear Programming.pdf
116/202
8/11/2019 4 Linear Programming.pdf
117/202
Chen CL 117
8/11/2019 4 Linear Programming.pdf
118/202
xN
= x2x3
cT
N cT
BB
1
N = 4 0 6 0 019 0 0
5
9 1 019 0 1
4 1
8 01 0
=
4 0
83 23
=
43
23
43 < select x2 as xE
Chen CL 118
8/11/2019 4 Linear Programming.pdf
119/202
xB = x1
x4x5
= B1b B1a
Ex
E
= 19 0 0
59 1 0
19 0 1
360
400
55
19 0 0
59 1 0
19 0 1
4
8
1
xE
= 40 49xE
200 52
9xE15 59xE
ifx
E = min
40
4/9= 90, 20052/9,
155/9 = 27
= 27
x5 = 0 (=xV, become a NB)
Chen CL 119
8/11/2019 4 Linear Programming.pdf
120/202
xB
=
x1
x4
x2
xN =
x3
x5 c
B =
6
0
4
cN
=
0
0
B=
9 0 4
5 1 8
1 0 1
B1 =
15 0
45
35 1
325
15 0 9
5
Chen CL 120
8/11/2019 4 Linear Programming.pdf
121/202
xN
=x3
x5
cTN
cTB
B1N =
0 0
6 0 4
1
5 0 4
535 1
325
15 0 9
5
1 00 00 1
= 0 0 25 125 = 25 125
Chen CL 121
B1b
15 0 45
3 1 32
360
400
8/11/2019 4 Linear Programming.pdf
122/202
xB
= B 1b=
35 1
325
15 0 9
5
400
55
=
28
44
27
=
x1
x4
x2
(x3=x5= 0)
f = cTB
xB
=
6 0 42844
27
= 276
Chen CL 122
Quadratic Programming
8/11/2019 4 Linear Programming.pdf
123/202
Min: f = cTx + 12xTQx
s.t. Ax b x 0 Min: f = cTx + 12x
TQx
s.t. Ax + s = b x 0
L = cTx + 12xTQx + T(Ax + s b) Tx
KKC: L = c + Qx + AT = 0
Q AT I 0A 0 0 I
x
s
=
cb
Chen CL 123
Add Artificial Variables, v, on these equality constraints,
Use two-phase method to solve the problem:
8/11/2019 4 Linear Programming.pdf
124/202
Min: w=n
i=1
vi
s.t. Q AT I 0 I
A 0 0 I 0
x
s
v
=cb
Chen CL 124
QP: Example
8/11/2019 4 Linear Programming.pdf
125/202
Min: f= 3x1 x1x2+ x21+ 2x
22
s.t. 3x1+ x2 5
x1, x2 0
Min: z=
3 0x1
x2
+ 12 x1 x2 2 1
1 4
x1x2
s.t. 3 1x1
x2 5
x1
x2
0
0
8/11/2019 4 Linear Programming.pdf
126/202
8/11/2019 4 Linear Programming.pdf
127/202
Chen CL 127
Duality: Start from Lagrangian andThe Kuhn-Tucker Conditions (Min,)
8/11/2019 4 Linear Programming.pdf
128/202
The Kuhn Tucker Conditions (Min,)
Min: f(x)s.t. gj(x) 0 j = 1, , m
hk(x) = 0 k= 1, , ; x 0
L(x, ) = f(x)+
mj=1
jgj(x) +
k=1
m+khk(x)
KTC: gj(x) 0 j = 1, , m (x is feasible)
hk(x) = 0 k= 1, ,
jgj(x
) = 0 j = 1, , m
xf(x) +
mj=1
jxgj(x) +
k=1
m+kxhk(x) = 0
j 0; m+k unrestricted in sign
Chen CL 128
Saddle Point Theorem (Min,)
L( ) L( ) L( )
8/11/2019 4 Linear Programming.pdf
129/202
L(x, ) L(x, ) L(x, )
Proof:
Min: f(x) (x 0)
s.t. gj(x) 0 j = 1, , m (skip h now)
L(x, ) = f(x)+m
j=1 jgj(x)NC on x:
Lxi
x,
=
fxi
x,
+j
j
gjxi
x,
= 0
x 0 Lxix, 0 xi Lxix, = 0
(ifxi >0
Lxi
x,
= 0)
(ifxi = 0
Lxi
x,
>0)
L(x, ) L(x, )
Chen CL 129
0 df(x, ) =i
f
xi
x,
dxi (min prob)
8/11/2019 4 Linear Programming.pdf
130/202
i x ,
= i j j gj
xix, dxi=
j
ji
gjxi
x,
dxi
= j jdgj(x,
) 0
j 0 j
NC: j 0 Ljx,
=gj 0 j Ljx,
= 0
L(x, ) L(x, ) L(x, ) L(x, ) L(x, )
Chen CL 130
Saddle Point and Properties (Min,)
8/11/2019 4 Linear Programming.pdf
131/202
xL(x, ) = 0 L(x
, ) = 0
xL(x, ) 0 L(x
, ) 0
Chen CL 131
The Max-Min Problem (Min,)
8/11/2019 4 Linear Programming.pdf
132/202
L(x
, ) L(x
,
) L(x,
)(x, ) defines a saddle pt of the Lagrangian
If define the Lagrangian in terms of alone
L() = minx
L(x, ) = L(x, )
sinceL() is a maximum w.r.t. at the optimum
max
L() = max
minx
L(x, ) gives (x, )
similary min
x
L(x) = min
x
max
L(x, ) gives (x, )
Chen CL 132
The Primal and Dual Problems (Min,)
8/11/2019 4 Linear Programming.pdf
133/202
Min:f(x)
s.t. gj(x) 0 j = 1, , m
hk(x) = 0 k= 1, ,
L(x, ) = f(x)+
mj=1
jgj(x) +
k=1
m+khk
Primal minx
max
L(x, ) = minx
L(x) x 0
Dual max
minx
L(x, ) = max
L() 0
Chen CL 133
Duality (Min,)
8/11/2019 4 Linear Programming.pdf
134/202
Min: f(x)s.t. gj(x) 0 j = 1, , m
L(x, ) = f(x)+m
j=1jgj(x)
L(x, ) L(x, ) =f(x)
L(x, )
max
minx
L(x, )
L(x,)() x,
minx
max
L(x, ) L(x,
)f(x)
x,
() f(x) f(x)
8/11/2019 4 Linear Programming.pdf
135/202
8/11/2019 4 Linear Programming.pdf
136/202
Chen CL 136
A Linear Programming Example (Min,)
8/11/2019 4 Linear Programming.pdf
137/202
Min: fp(x) = 4x1 x2+ 50
s.t. g1(x) = x1 x2 2
g2(x) = x1+ 2x2 8
g3(x) = x1+ x2 10g4(x) = 5x1+ x2 5
c = 41 A =
1 1
1 2
1 1
5 1
b =
2
8
10
5
Chen CL 137
Dual Problem:
Max: L() = 21 82 103 54+ 50
( )
8/11/2019 4 Linear Programming.pdf
138/202
s.t. g1() = 1+ 2+ 3 54 4
g2() = 1+ 22+ 3+ 4 1i 0
=
73
53 0 0
TL() = 32
xL(x, ) =
41
+ 1 1 1 51 2 1 1
7/3
5/3
0
0
=
00
1,
2= 0 x
1 x
2 = 2 x
1+ 2x
2 = 8
x =
4
2
fp(x) = 3 2
8/11/2019 4 Linear Programming.pdf
139/202
8/11/2019 4 Linear Programming.pdf
140/202
8/11/2019 4 Linear Programming.pdf
141/202
Chen CL 141
Duality in Separable Programming (I)
8/11/2019 4 Linear Programming.pdf
142/202
Min: f(x) =
n
i=1 aixi+1
2
bix2i (separable obj)
s.t. gj(x) =n
i=1
cjixi j = 1, , m
Li() = minxi aixi+12bix2i +m
j=1jcjixi
xiLi() = ai+ bixi+m
j=1
jcji = 0
xi = ai mj=1 jcjibi
(xi xi xui; xi = x
i ifbi= 0)
Max: Li() with quadratic obj and linear constraints
Chen CL 142
Duality in Separable Programming (II)
8/11/2019 4 Linear Programming.pdf
143/202
Min: f(x) =
n
i=1 aixi+1
2
bix2i (separable obj)
s.t. gj(x) =n
i=1
cjixi+
1
2djix
2i
j = 1, , m
Li() = minxi aixi+12bix2i +m
j=1j cjixi+12djix2i
xiLi() = ai+ bixi+m
j=1
j(cji+ djixi) = 0
xi = ai mj=1 jcjibi+
mj=1 jdji
(xi xi xui; xi = x
i if denominator = 0)
Max: Li() with quadratic obj and quadratic constraints
Chen CL 143
Duality in Linear Programming(A Simpler Approach Again)
8/11/2019 4 Linear Programming.pdf
144/202
Primal Min: fp=c1x1+ + cnxn=n
j=1
cjxj =cTx
s.t. a11x1+ + a1nxn b1
(Ax b)
am1x1+ + amnxn bm
Dual Max: zd= b1y1 bmym= m
i=1 biyi=bTy
s.t. a11y1+ + am1ym c1
(ATy c)
a1ny1+ + amnym cn
Chen CL 144
Example: Dual of an LP Problem
Min: fp= 5x1+ 2x2
8/11/2019 4 Linear Programming.pdf
145/202
fp 1 + 2
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 ConstraintsMin: fp= x1 4x2
s t x1 + 2x2 5
8/11/2019 4 Linear Programming.pdf
146/202
s.t. x1+ 2x2 5
2x1+ x2= 4
x1 x2 1, x1, x2 0
Min: fp= x1 4x2
s.t. x1+ 2x2 52x1+ 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
8/11/2019 4 Linear Programming.pdf
147/202
Chen CL 147
Primal Solution from Dual Solution
8/11/2019 4 Linear Programming.pdf
148/202
Theorem: Relation between primal and dual
Letxandy be in the constraint set (feasible points) of primal anddual problems, respectively. Then the following relations hold:
zd(y) fp(x) If zd = fp, 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 148
a11y1+ + am1ym c1 x1 a1ny1+ + amnym cn xn
8/11/2019 4 Linear Programming.pdf
149/202
x1(a11y1+ + am1ym) + +xn(a1ny1+ + amnym) c1x1 cnxn
y1
b1 (a11x1+ + a1nxn) + +ym (am1x1+ + amnxn)
bm
c1x1 cnxn
b1y1 bmym zd: dual profit fcn
c1x1+ + cnxn fp: primal cost fcn
zd fp x and y with fp=zd minimize fp 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) =fp(x)
8/11/2019 4 Linear Programming.pdf
150/202
y (y) p( )
Theorem: Solution of primal from dualIf theith 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.
Ifmi=1
aijyi > cj then xj = 0
If yi > 0 then
nj=1
aijxj = bi
Chen CL 150
Primal and Dual Solutions: Example
8/11/2019 4 Linear Programming.pdf
151/202
Minx: fp= 5x1+ 2x2 (fp = 18)
s.t. 2x1+ x2 9
x1 2x2 2
3x1+ 2x2 3, x1, x2 0
Basic fp x1 x2 x3 x4 x5 b bi/aic
x2 0 0 1 0.2 0.4 0 1x1 0 1 0 0.4 0.2 0 4
x5 0 0 0 0.8 1.4 1 13
fp 1 0 0 1.6 1.8 0 18
Chen CL 151
8/11/2019 4 Linear Programming.pdf
152/202
Dual: Max: zd= 9y1 2y2 3y3
s.t. 2y1+ y2 3y3 5
y1 2y2+ 2y3 2
Max: zd= 9y1 2y2 3y3s.t. 2y1+ y2 3y3 y4+ y6= 5
y1+ 2y2 2y3+ y5= 2
y4: surplus, y5: slack, y6: artificial
Chen CL 152
Basic zd w y1 y2 y3 y4 y5 y6 b bi/aic
y6 0 0 2 1 3 1 0 1 5 5
2
y5 0 0 1 2 2 0 1 0 2
8/11/2019 4 Linear Programming.pdf
153/202
y5
zd 1 0 9 2 3 0 0 0 0
w 0 1 2 1 3 1 0 0 5
y1 0 0 1 0.5 1.5 0.5 0 0.5 2.5 2.5
0.5
y5 0 0 0 2.5 3.5 0.5 1 0.5 4.5 4.5
2.5
zd 1 0 0 2.5 16.5 4.5 0 4.5 22.5
w 0 1 0 0 0 0 0 1 0 I ENDy1 0 0 1 0 0.8 0.4 0.2 0.4 1.6
y2 0 0 0 1 1.4 0.2 0.4 0.2 1.8
zd 1 0 0 0 13 4 1 4 18 II END
BVs: y1= 1.6, y2= 1.8
NBs: y3= 0, y4= 0, y5= 0
Max: zd = 18 (= fp )
8/11/2019 4 Linear Programming.pdf
154/202
Chen CL 154
Use of Dual Tableau to Recover PrimalSolution
8/11/2019 4 Linear Programming.pdf
155/202
Primal and Dual tables of previous example:
Basic fp x1 x2 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 13fp 1 0 0 1.6 1.8 0 18
Basic zd w y1 y2 y3 y4 y5 y6 b bi/aic
y1 0 0 1 0 0.8 0.4 0.2 0.4 1.6
y2 0 0 0 1 1.4 0.2 0.4 0.2 1.8
zd 1 0 0 0 13 4 1 4 18 II END
Chen CL 155
Some notes:
Elements in row of dual tableau match elements in last column
of primal tableau
8/11/2019 4 Linear Programming.pdf
156/202
of primal tableau
Reduced cost coefficients in final primal tableau match the dual
variables
To recover primal variables from final dual tableau, we use
reduced cost coefficients in columns corresponding to slack or
surplus variables
Reduced cost coefficient in column y4 is precisely x1 and that incolumny5 is precisely x2
Reduced profit coefficients corresponding to slack and surplus
variables in final dual tableau give values of primal variables
Chen CL 156
Theorem: recovery of primal solution from dual tableauLet dual of the standard primal (min cTx s.t. Ax b) be solvedby standard Simplex method. Then value of ith primal variable
8/11/2019 4 Linear Programming.pdf
157/202
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
coefficient equals the value of slack or surplus variable for the
corresponding primal constraint.
Chen CL 157
Use of Final Primal Tableau to RecoverDual Solution: Example
8/11/2019 4 Linear Programming.pdf
158/202
Min: fp= x1 4x2s.t. x1+ 2x2 5
2x1+ x2= 4
x1 x2 1
x1, x2 0
Min:fp = x1 4x2
s.t. x1 + 2x2 + x3 = 5
2x1 + x2 + x4 = 4
2x1 + x2 x5 + x7 = 4
x1 x2 x6 + x8 = 1
8/11/2019 4 Linear Programming.pdf
159/202
Chen CL 159
y1= 0, for 1st constraint (reduced cost coeff ofx3, slack var.)
y2= 53, for 2nd constraint (reduced cost coeff ofx4, slack var.)
8/11/2019 4 Linear Programming.pdf
160/202
y3= 0, for 3rd constraint (reduced cost coeff ofx5, surplus var.)
y4= 73, for 4th constraint (reduced cost coeff ofx6, surplus var.)
dual variable for equality constraint 2x1+ x2= 4 is y2 y3= 53
y4 = 7
3 is the dual variable for the 4th constraint written as
x1+ x2 1 and NOT forx1 x2 1
Chen CL 160
Use of Final Primal Tableau to RecoverDual Solution: Example (2)
8/11/2019 4 Linear Programming.pdf
161/202
Min: fp= x1 4x2
s.t. x1+ 2x2 5
2x1+ x2= 4
x1 x2 1x1, x2 0
Min: fp
= x1
4x2
s.t. x1 + 2x2 + x3 = 5
2x1 + x2 + x5 = 4
x1 x2 x4 + x6 = 1
8/11/2019 4 Linear Programming.pdf
162/202
Chen CL 162
slack: x3 surplus: x4 artif.: x5, x6
BVs: x1= 53, x2=
23, x3= 2
8/11/2019 4 Linear Programming.pdf
163/202
NBs: x4 = x5 = x6 = 0
Min: fp = 133 (same result)
y1= 0, for 1st constraint (reduced cost coeff ofx3, slack var.)
y2= 53, for 2nd constraint (reduced cost coeff ofx5, artif var.)
y3= 73, for 3rd constraint (reduced cost coeff ofx4, surplus var.)
Same resultwe do not have to replace an equality constraint bytwo 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
8/11/2019 4 Linear Programming.pdf
164/202
Chen CL 164
NC: cj+mi 1
yiaij+ vj = 0 j = 1 n (b)
8/11/2019 4 Linear Programming.pdf
165/202
i=1
yi n
j=1
aijxj bi = 0 i= 1 m (c)
vjxj = 0 xj 0 j = 1 n (d)
yi 0 i= 1 m (e)
vj 0 j = 1 n (f)
(b) cj+mi=1
yiaij = vj
mi=1
yiaij cj (g)
yjs are feasible soln for dual constraints
8/11/2019 4 Linear Programming.pdf
166/202
Chen CL 166
Post-Optimality Analysis
8/11/2019 4 Linear Programming.pdf
167/202
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
8/11/2019 4 Linear Programming.pdf
168/202
Theorem: Lagrange Multiplier Values
In the final tableau, the Lagrange multiplierfor theith constraintequals the reduced cost coefficient in the slack or artificial
variable column associated with the ith constraint
For a minimization problem with type or equality constraintsei: RHS parameter, yi: Lagrange multiplier
z
ei= yi 0
Chen CL 168
Recovery of Lagrange Multipliers from Final Tableau
8/11/2019 4 Linear Programming.pdf
169/202
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 b bi/aic
x3 0 2 1 1 0 0 9 9
2
x 0 1 2 0 1 0 2 6
8/11/2019 4 Linear Programming.pdf
170/202
x4 0 1 2 0 1 0 2 3
x5 0 3 2 0 0 1 3 z 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
z 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
z 1 0 0 1.6 1.8 0 18
c
1 c
2 c
3 c
4 c
5
8/11/2019 4 Linear Programming.pdf
171/202
Chen CL 171
Recovery of Lagrange Multipliers from Final Tableau
8/11/2019 4 Linear Programming.pdf
172/202
Max: z =x1+ 4x2 (= f)
s.t. x1+ 2x2 5
2x1+ x2= 4
x1 x2 1
x1, x2 0
Max: z= x1 + 4x2
s.t. x1 + 2x2 + x3 = 52x1 + x2 + x5 = 4
x1 x2 x4 + x6 = 1
xi 0
Chen CL 172
8/11/2019 4 Linear Programming.pdf
173/202
?? ??
BV: x1= 53, x2= 23, x3= 2
NB: x4= 0, x5= 0, x6= 0
z = 133
Chen CL 173
Basic z w x1 x2 x3 x4 x5 x6 b bi/aic
x3 0 0 1 2 1 0 0 0 5 5
1
x5 0 0 2 1 0 0 1 0 4 4
2
0 0 1 1 0 1 0 1 1 1
8/11/2019 4 Linear Programming.pdf
174/202
x6 0 0 1 1 0 1 0 1 1 1
1
z 1 0 1 4 0 0 0 0 0w 0 1 3 0 0 1 0 0 5
x3 0 0 0 3 1 1 0 1 4 4
3
x5 0 0 0 3 0 2 1 2 2 2
3
x1 0 0 1 1 0 1 0 1 1 z 1 0 0 5 0 1 0 1 1
w 0 1 0 3 0 2 0 3 2
x3 0 0 0 0 1 1 1 1 2
x2 0 0 0 1 0 2
313
23
23
x1 0 0 1 0 0 1313
13
53
z 1 0 0 0 0 7353
73
133
w 0 1 0 0 0 0 1 1 0 I,II END
Chen CL 174
1st constraint ( 5) y1 = 0 (c3 in slack var col x3)
2nd constraint ( = 4) y2 = 5 (c5 in art var col x5)
8/11/2019 4 Linear Programming.pdf
175/202
2nd constraint ( = 4) y2 = 3 ( c5 in art var colx5)
3rd constraint ( 1) y3 = 73 (c6 in art var colx6)or3rd constraint ( 1) y3 =
73
z
e1 = 0
z
e2 =
5
3
z
e3 =
7
3
Ife2: 5 4 z: 13
3 13
3 + (53) (1) = 6
Ife3: 1 2 z: 133 13
3 + (73) (1) = 2
Chen CL 175
Ranging Right-hand Side Parameters
When RHS of a constraint is changed
8/11/2019 4 Linear Programming.pdf
176/202
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 ksatisfies the following inequalities, then no more iterations of the
Simplex method are required to obtain solution for the alteredproblem
maxi
bi
aij; aij >0
i mini
bi
aij; aij
8/11/2019 4 Linear Programming.pdf
177/202
a type constraint,
or the artificial variable for an equality constraint, or typeconstraint
k: possible change in RHS ofkth 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 ofk in bk
bi =bi+ ka
ij i= 1 m
Chen CL 177
Ranges for Resource Limits: type
8/11/2019 4 Linear Programming.pdf
178/202
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 = 9x1 2x2 + x4 = 2
3x1 + 2x2 + x5 = 3, xi 0
Chen CL 178
8/11/2019 4 Linear Programming.pdf
179/202
Chen CL 179
Basic z x1 x2 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
8/11/2019 4 Linear Programming.pdf
180/202
x1 0 1 0 0.4 0.2 0 4
x5 0 0 0 0.8 1.4 1 13z 1 0 0 1.6 1.8 0 18
For 1st constraint, x3 is the slack variable
j for1 is x3 (the third column)
No negative element in 3rd column
no upper limit on 1
Chen CL 180
max
1
0.2,
4
0.4,
13
0.8
1
5 1
8/11/2019 4 Linear Programming.pdf
181/202
4 b1 max
4
0.2,
13
1.4
2 min
1
0.4
9.286 2 2.5
7.286 b2 4.5max
13
1
3
13 3
10 b1
Chen CL 181
New values for design variables if2x1+ x2 910 (1= 1)
x2 = b1 =b1+ 1a
13
1 + (1)(0 2) 1 2
8/11/2019 4 Linear Programming.pdf
182/202
= 1 + (1)(0.2) = 1.2
x1 = b2 =b2+ 1a23
= 4 + (1)(0.4) = 4.4
x5 = b3 =b3+ 1a
33
= 13 + (1)(0.8) = 13.8 (F)
Note: other variables remain nonbasic (= 0)
8/11/2019 4 Linear Programming.pdf
183/202
Chen CL 183
New values for design variables if1= 1 and 2= 1:
x2 = b1 =b1+ 1a
13+ 2a
14
= 1 + (1)(0 2) + (1)( 0 4) = 0 8
8/11/2019 4 Linear Programming.pdf
184/202
= 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+ 1a
33+ 2a
34
= 13 + (1)(0.8) + (1)(1.4) = 15.2 (H)
Chen CL 184
Ranges for Resource Limits: =, type
Max: z =x1+ 4x2
t + 2 5
8/11/2019 4 Linear Programming.pdf
185/202
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 b bi/aic
x3 0 0 0 1 1 1 1 2
x2 0 0 1 0 2
313
23
23
8/11/2019 4 Linear Programming.pdf
186/202
2 3 3 3 3
x1 0 1 0 0 13 13 13 53z 1 0 0 0 73
53
73
133
x3: slack (1st constraint), x4: surplus (3rd)
x5, x6: artificial variables (2nd and 3rd constraints)
Chen CL 186
2 1 (j = 3)
3 b1
8/11/2019 4 Linear Programming.pdf
187/202
max2/31/3, 5/31/3 2 min 21 (j = 5)2 b2 6
max
21, 5/31/3
3 min
2/32/3
(j = 6)
1 b3 2
Chen CL 187
New solution if2x1+ x2= 45
x3 = b1 =b1+ 2a
15
= 2 + (1)(1) = 1
8/11/2019 4 Linear Programming.pdf
188/202
= 2 + (1)( 1) = 1
x2 = b2 =b2+ 2a25
= 23+ (1)(13) = 1
x1 = b3 =b3+ 2a
35
=
5
3+ (1)(
1
3) = 2
Chen CL 188
New solution ifx1 x2 12
x3 = b1 =b1+ 3a
16
= 2 + (1)(1) = 3
8/11/2019 4 Linear Programming.pdf
189/202
= 2 + (1)(1) = 3
x2 = b2 =b2+ 3a26
= 23+ (1)(23) = 0
x1 = b3 =b3+ 3a
36
=
5
3+ (1)(
1
3) = 2 (C)
Chen CL 189
Ranging cost Coefficients
ckck + ck : admissible range on ck such that the optimum
8/11/2019 4 Linear Programming.pdf
190/202
ckck+ 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 NBsLetck be such that xk is not a basic variable.
Ifck ck+ ck, ck ck ,then the optimum solution (design variables and cost function)
8/11/2019 4 Linear Programming.pdf
191/202
( g )
does not change(ck is the cost coefficient corresponding to xk in final tableau)
Chen CL 191
Theorem: range for cost coefficient of BVsLetck be such that x
k is a basic variable and x
k=b
r.
Then the range on changeck inck for which the optimum design
variables do not change is given as
8/11/2019 4 Linear Programming.pdf
192/202
maxj
cj
arj; arj 0
The new cost function is f + ckxk
arj : element in rth row and jth column of final tableau.
Index r is determined by the row that determines xkIndex j corresponds to each of the nonbasic columns excluding
artificial columns
if no arj >0 no upper limit,if no arj
8/11/2019 4 Linear Programming.pdf
193/202
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 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
z 1 0 0 1.6 1.8 0 18c1 c
2 c
3 c
4 c
5
Chen CL 193
Max: z= 5x1 2x2 (c1= 5, c2= 2)
2nd row determines BV x1r= 23rd, 4th columns are NBsj = 3, 4
8/11/2019 4 Linear Programming.pdf
194/202
c1 min
1.60.4,
1.80.2
= 4
c1 1
znew = z + c1x
1 (c1= 54)
= 18 + (1)(4) = 14
Chen CL 194
1rd row determines BV x2r= 13rd, 4th columns are NBsj = 3, 4
max 1.80.4 = 4.5 c2 min
1.60.2 = 8
8/11/2019 4 Linear Programming.pdf
195/202
0.4 0.22.5 c2 10znew = z
+ c2x2 (c2= 2 3)
= 18 + (1)(1) = 17
Chen CL 195
Ranges for Resource Limits: =, type
Max: z = x1 + 4x2
8/11/2019 4 Linear Programming.pdf
196/202
Max: z =x1+ 4x2
s.t. x1+ 2x2 5
2x1+ x2= 4
x1 x2 1, x1, x2 0
Basic z x1 x2 x3 x4 x5 x6 b bi/aic
x3 0 0 0 1 1 1 1 2
x2 0 0 1 0 2
313
23
23
x1 0 1 0 0 13
13
13
53
z 1 0 0 0 7353
73
133
c1 c2 c
3 c
4 c
5 c
6
Chen CL 196
3rd row determines x1 as a basic (r= 3, j = 4)
max
7/31/3
= 7 c1
8 c1
8/11/2019 4 Linear Programming.pdf
197/202
8 c1
znew = z + c1x
1 (c1= 12)
= 133 + (1)(53) = 6
2nd row determines x2 as a basic (r= 2, j = 4)
c2 3.5
c2 0.5
znew = z
+ c2x2 (c2= 43)
= 133 + (1)(23) =
113
Chen CL 197
Changes in the Coefficient Matrix
aijaij+ aij feasible region changes
8/11/2019 4 Linear Programming.pdf
198/202
j j j
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 NBLet j in aij be such that xj is not a BV, and k be the column index for theslack or artificial variable associated with the ith row.Define a vector
cB =
cB1 cB2 cBm
T
where cBi = cj if x
j = b
i , i = 1 m (index i corresponds to ith row thatdetermines optimum value of variable xj). Also define a scalar
R=
mr=1
cBrark
Chen CL 198
With this notation, if aij satisfies the following inequalities
ij
cjR
cjR
when R
0
8/11/2019 4 Linear Programming.pdf
199/202
ij when R
0
then the optimum solution (design variables and cost function) do not change
whenaij aij+ aij.
Also, ifR= 0, then the solution does not change for any value ofaij
Note: re-solve the problem if the inequalities are not satisfied
Chen CL 199
Theorem: change associated with a BVLet j in aij be such that xj is a BV and let x
j = b
t (t is the row index
determining optimum value ofxj). Let index k and scalar R be defined as inprevious Theorem. Let aij satisfy the following inequalities:
8/11/2019 4 Linear Programming.pdf
200/202
maxr=t
brAr , Ar 0withAr =b
tark b
ratk, r= 1 m; r=t, and
maxq cq
Bq , Bq >0 aij minr=t cq
Bq , Bq 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
8/11/2019 4 Linear Programming.pdf
201/202
(1) Max: z=x1+ 4x2s.t. x1+ 2x2 5
x1+ x2= 4
x1 x2 3
x1, x2 0
(2) Max: z= 4x1+ 2x2
s.t. 2x1+ x2 4x1+ 2x2 2
x1, x2 0
8/11/2019 4 Linear Programming.pdf
202/202