Professional Documents
Culture Documents
Linear Programming
Where
• A is (m x n) matrix,
• b and x are column vectors,
• y and c are row vectors.
3
Original and the Dual Problem
Original Problem Dual Problem
Max Z = 600x1 + 400x2 Min Y = 360y1 + 160y2 + 300y3
s.t. s.t.
4x1 + 3x2 <= 360; y1 4y1 + 2y2 + 2y3 >= 600; x1
2x1 + x2 <= 160; y2 3y1 + y2 + 3y3 >= 400; x2
2x1 + 3x2 <= 300; y3
4
Primal Solution: Simplex Optimal Table
Cj 600 400 0 0 0 Nomenclature
12
Primal and Dual Problem
Primal Problem Dual Problem
Maximize Z = x1 + 2x2 – x3 Minimize Y = 15y1 + 12y2 + 20y3
13
Another Example Problem
Find the dual of the following problem:
Maximize Z = x1 + 2x2 + 4x3
s.t 2x1 + x2 – 3x3 = 15
4x1 – x2 + x3 >= 22
x1 + 2 x2 <= 20
x1 >= 0; x2 >= 0; x3 <= 0;
14
Primal and Dual Problem
Primal Problem Dual Problem
Maximize Z = x1 + 2x2 + 4x3 Minimize Y = 15y1 + 22y2 + 20y3
15
Duality and
Complementary Slackness
Duality Theorem 1: Weak Duality Theorem
Primal Dual
Max Z = cx Min W = yb
s.t. Ax <= b s.t. yA >= c
x >= 0 y >= 0
Theorem 1: Weak Duality Theorem
For symmetric primal-dual linear programs, the value of the objective
function of the minimum problem (dual) for any feasible solution is always
greater than or equal to that of the maximum problem (primal): yb >= cx
17
Original and Dual Optimal Solutions
Original Problem Dual Problem
Max Z = 600x1 + 400x2 Min Y = 360y1 + 160y2 + 300y3
s.t. s.t.
4x1 + 3x2 <= 360; 4y1 + 2y2 + 2y3 >= 600;
2x1 + x2 <= 160; 3y1 + y2 + 3y3 >= 400;
2x1 + 3x2 <= 300; Non-negativity constraints
Non-negativity constraints y1 >= 0; y2 >= 0; y3 >= 0;
x1 >= 0; x2 >= 0
Optimal Solution: y1* = 100;
Optimal Solution: x1* = 60;
y2* = 100; y3* = 0; Z* = 52000;
x2* = 40; Z* = 52000;
18
x1 = 0 Graphical Solution
x2 axis
(0,160) G
• Solution Space is OABCD Objective Functon
• It is Feasible Max Z = 600x1 + 400x2
• It is Bounded O: (0,0); Z = 0;
(0,120) E
A: (0,100); Z = 40000;
B: (30,80); Z = 50000;
(0,100) A C: (60, 40; Z = 52000;
(45,70)
H D: (80,0); Z = 48000;
(30,80) B
C Optimal Solution is
(60,40) found at point C
x2 = 0 x1* = 60; x2* = 40;
O D F I x1 axis
(0,0) (80,0) (90,0) (150,0) Z* = 52000
19
Weak Duality Theorem
Theorem 1: Weak Duality Theorem
For symmetric primal-dual linear programs, the value of the objective
function of the minimum problem (dual) for any feasible solution is always
greater than or equal to that of the maximum problem (primal): yb >= cx
20
Weak Duality Theorem
Theorem 1: Weak Duality Theorem
For symmetric primal-dual linear programs, the value of the objective
function of the minimum problem (dual) for any feasible solution is always
greater than or equal to that of the maximum problem (primal): yb >= cx
21
Optimality Criteria Theorem
Theorem 2: Optimality Criteria Theorem
If there exist feasible solutions xo and yo for the symmetric
primal-dual linear programs, such that corresponding values of
their objective functions are equal, then these feasible solutions
are in fact optimal solutions to their respective problems.
22
Original and Dual Optimal Solutions
Original Problem Dual Problem
Max Z = 600x1 + 400x2 Min Y = 360y1 + 160y2 + 300y3
s.t. s.t.
4x1 + 3x2 <= 360; 4y1 + 2y2 + 2y3 >= 600;
2x1 + x2 <= 160; 3y1 + y2 + 3y3 >= 400;
2x1 + 3x2 <= 300; Non-negativity constraints
Non-negativity constraints y1 >= 0; y2 >= 0; y3 >= 0;
x1 >= 0; x2 >= 0
Optimal Solution: y1* = 100;
Optimal Solution: x1* = 60;
y2* = 100; y3* = 0; Z* = 52000;
x2* = 40; Z* = 52000;
23
Main Dual Theorem
Theorem 3: Main Dual Theorem
If both the primal and dual problems are feasible, then they both
have optimal solutions such that their optimal values of the
objective functions are equal.
24
Complementary Slackness Theorem
Primal Dual
Max Z = cx Min W = yb
s.t. Ax <= b s.t. yA >= c
x >= 0 y >= 0
Let xo and yo be feasible for the primal and the dual problems
respectively, then xo and yo are optimal to their respective
problem, if and only if:
(yoA – c)xo + yo(b – Axo) = 0
25
Complementary Slackness Theorem
Theorem 4: Complementary Slackness Theorem
Let xo and yo be feasible for the primal and the dual problems
respectively, then xo and yo are optimal to their respective
problem, if and only if:
(yoA – c)xo + yo(b – Axo) = 0
26
Complementary Slackness Theorem
Theorem 4: Complementary Slackness Theorem
Let xo and yo be feasible for the primal and the dual problems
respectively, then xo and yo are optimal to their respective
problem, if and only if: (yoA – c)xo + yo(b – Axo) = 0
uo = (b – Axo) and vo = (yoA – c) are slack variables;
So, we have: voxo + youo = 0;
Complementary Slackness Condition
vjoxjo = 0 for all j = 1…n and yiouio = 0 for all i = 1…m
27
Complementary Slackness Condition
A simple statement of the Complementary Slackness Condition is that
If at the optimal point, the primal slack vanishes, i.e. a primal constraint
turns to equality, then the corresponding dual variable exists in the basis.
In other words
If at the optimal point, the dual slack vanishes, i.e. a dual constraint turns
to equality, then the corresponding primal variable exists in the basis.
28
Original and Dual Optimal Solutions
Original Problem Dual Problem
Max Z = 600x1 + 400x2 Min Y = 360y1 + 160y2 + 300y3
s.t. s.t.
4x1 + 3x2 <= 360; 4y1 + 2y2 + 2y3 >= 600;
2x1 + x2 <= 160; 3y1 + y2 + 3y3 >= 400;
2x1 + 3x2 <= 300; Non-negativity constraints
Non-negativity constraints y1 >= 0; y2 >= 0; y3 >= 0;
x1 >= 0; x2 >= 0
Optimal Solution: y1* = 100;
Optimal Solution: x1* = 60;
y2* = 100; y3* = 0; Z* = 52000;
x2* = 40; Z* = 52000;
29
Complementary Slackness Condition
Primal Problem Dual Problem Note that
Max Z = 600x1 + 400x2 as the dual
Min Y = 360y1 + 160y2 + 300y3
variable
s.t. Dual s.t. Primal exists, the
4x1 + 3x2 = 360; y1 4y1 + 2y2 + 2y3 = 600; x1 primal
2x1 + x2 = 160; y2 3y1 + y2 + 3y3 = 400; x2 slack has
2x1 + 3x2 <= 300; y3 vanished
Non-negativity constraints and vice
Non-negativity constraints y1 >= 0; y2 >= 0; y3 >= 0; versa
x1 >= 0; x2 >= 0
Optimal Solution: x1* = 60; Optimal Solution: y1* = 100;
x2* = 40; Z* = 52000; y2* = 100; y3* = 0; Z* = 52000;
30
An Example Problem
Solve the following linear programming problem by only inspecting
its dual:
Maximize Z = x1 + 2x2 – x3
s.t 2x1 + x2 – 3x3 <= 5
– 4x1 – x2 + x3 <= 4
x 1 + 3 x2 <= 6
x1, x2, x3 are unrestricted in sign
31
Primal and Dual Problem
Primal Problem Dual Problem
Maximize Z = x1 + 2x2 – x3 Minimize Y = 5y1 + 4y2 + 6y3
32
Solving Dual by Inspection
Dual Problem • By 3 times (1) – (2), we get: 5y1 – 11 y2 = 1
Minimize Y = 5y1 + 4y2 + 6y3 • Also, 11 times (3), –33 y1 + 11y2 = –11
• Adding above, –28y1 = –10; so y1 = 5/14;
s.t 2y1 – 4y2 + y3 = 1
..(1) • Putting in (3): y2 = 3y1–1 = 15/14–1 = 1/14;
y1 – y2 + 3y3 = 2 • Putting in (2): 5/14–1/14+3y3 = 2
..(2) • so 3y3 = 2 – 4/14 = 24/14 so y3 = 8/14;
–3y1 + y2 = –1 • Hence, the Dual Optimal Solution will be:
..(3) • y1* = 5/14; y2* = 1/14; y3* = 8/14;
y1 >= 0, y2 >= 0, y3 >= 0, • Y* = 5*5/14 + 4*1/14 + 6*8/14 = 11/2;
33
Solving the Primal
Primal Problem Dual Optimal Solution:
• y1* = 5/14; y2* = 1/14; y3* = 8/14;
Maximize Z = x1 + 2x2 – x3
• Y* = 5*5/14 + 4*1/14 + 6*8/14 = 11/2;
s.t 2x1 + x2 – 3x3 <= 5 y1
Since, all the dual variables exist in the
– 4x1 – x2 + x3 <= 4 y2 optimal solution, we can infer by
x 1 + 3 x2 <= 6 y3 complementary slackness condition that
x1, x2, x3 are all the primal slack will vanish at the
unrestricted in sign optimal point.
i.e. At the optimal point, all the primal
constraints will turn to equality.
34
Solving the Primal
Primal Constraints at the • By (1) + 3 times (2), we get: –10x1 – 2x2 = 17
optimal point: • Also, 10 times (3), 10x1 + 30x2 = 60
37
Pictorial Representation
No. of items bought
by the person
Sell Buy Sell Buy Sell Buy
y1 x1 y2 x2 y3 x3 x1: In the 1st month
x2: in the 2nd month
200 500 500 500
x3: in the 3rd month
Month 1 Month 2 Month 3 No. of items sold by
the person
Pictorial Representation y1: In the 1st month
y2: in the 2nd month
y3: in the 3rd month
38
Selling Constraints
Sell Buy Sell Buy Sell Buy No. of items bought
y1 x1 y2 x2 y3 x3 by the person
x1: In the 1st month
500
x2: in the 2nd month
200 500 500
Month 3
x3: in the 3rd month
Month 1 Month 2
The picture reveals the following inequalities from No. of items sold by
selling considerations: the person
y1 <= 200; y1: In the 1st month
y1 + y2 – x1 <= 200; y2: in the 2nd month
y1 + y2 + y3 – x1 – x2 <= 200; y3: in the 3rd month
39
Buying Constraints
Sell Buy Sell Buy Sell Buy No. of items bought
y1 x1 y2 x2 y3 x3 by the person
x1: In the 1st month
500
x2: in the 2nd month
200 500 500
Month 3
x3: in the 3rd month
Month 1 Month 2
The picture reveals the following inequalities from No. of items sold by
buying considerations: x1 – y1 + 200 <= 500; the person
x1 – y1 <= 300; y1: In the 1st month
x1 + x2 – y1 – y2 <= 300; y2: in the 2nd month
x1 + x2 + x3 – y1 – y2 – y3 <= 300; y3: in the 3rd month
40
Objective Function
Month Item Cost Item Price No. of items bought
1 27 per unit 28 per unit by the person
2 24 per unit 25 per unit x1: In the 1st month
3 26 per unit 25 per unit x2: in the 2nd month
x3: in the 3rd month
The Objective Function will be: No. of items sold by
the person
Max Z = 28y1 + 25y2 + 25y3 –27x1 – 24x2 – 26x3; y1: In the 1st month
y2: in the 2nd month
y3: in the 3rd month
41
Formulation of the Primal Problem
Primal Problem No. of items bought
by the person
Max Z = 28y1 + 25y2 + 25y3–27x1 – 24x2 – 26x3 ;
s.t. y1 <= 200; x1: In the 1st month
x2: in the 2nd month
y1 + y2 – x1 <= 200;
x3: in the 3rd month
y1 + y2 + y3 – x1 – x2 <= 200;
x1 – y1 <= 300; No. of items sold by
the person
x1 + x2 – y1 – y2 <= 300;
x1 + x2 + x3 – y1 – y2 – y3 <= 300; y1: In the 1st month
y2: in the 2nd month
Non-negativity constraints
y3: in the 3rd month
x1 >= 0; x2 >= 0; x3 >= 0; y1 >= 0; y2 >= 0; y3 >= 0;
42
The Dual Variables
Primal Problem No. of items bought
by the person
Max Z = 28y1 + 25y2 + 25y3–27x1 – 24x2 – 26x3;
s.t. y1 <= 200; u1 x1: In the 1st month
x2: in the 2nd month
y1 + y2 – x1 <= 200; u2
x3: in the 3rd month
y1 + y2 + y3 – x1 – x2 <= 200; u3
x1 – y1 <= 300; v1 No. of items sold by
the person
x1 + x2 – y1 – y2 <= 300; v2
x1 + x2 + x3 – y1 – y2 – y3 <= 300; v3 y1: In the 1st month
y2: in the 2nd month
Non-negativity constraints
y3: in the 3rd month
x1 >= 0; x2 >= 0; x3 >= 0; y1 >= 0; y2 >= 0; y3 >= 0;
43
Formulation of the Dual Problem
Dual Problem Primal Problem
Min Y = 200*(u1 + u2 + u3) + 300*(v1 + v2 + v3); Max Z = 28y1 + 25y2 + 25y3–27x1
– 24x2 – 26x3;
s.t. u1 + u2 + u3 – v1 – v2 – v3 >= 28; y1
s.t. y1 <= 200; u1
u2 + u3 – v2 – v3 >= 25; y2
y1 + y2 – x1 <= 200; u2
u3 – v3 >= 25; y3
y1 + y2 + y3 – x1 – x2 <= 200; u3
– u2 – u3 + v1 + v2 + v3 >= –27; x1
x1 – y1 <= 300; v1
– u3 + v2 + v3 >= –24; x2
x1 + x2 – y1 – y2 <= 300; v2
v3 >= –26; x3
x1 + x2 + x3 –y1 –y2 –y3 <= 300; v3
Non-negativity constraints
Non-negativity constraints
u1 >= 0; u2 >= 0; u3 >= 0; x1 >= 0; x2 >= 0; x3 >= 0;
v1 >= 0; v2 >= 0; v3 >= 0; y1 >= 0; y2 >= 0; y3 >= 0;
44
Solving the Dual Problem
Dual Problem Dual Problem Solution
Min Y = 200*(u1 + u2 + u3) + 300*(v1 + v2 + v3); Minimization Problem + there are
non-negativity constraints.
s.t. u1 + u2 + u3 – v1 – v2 – v3 >= 28; …(1)
From (6), we have v3 = 0;
u2 + u3 – v2 – v3 >= 25; …(2)
From (3), we have u3 = 25;
u3 – v3 >= 25; …(3)
From (5), we have v2 = 1;
– u2 – u3 + v1 + v2 + v3 >= –27; …(4)
From (2), we have u2 = 1;
– u3 + v2 + v3 >= –24; …(5)
From (4), we have v1 = 0;
v3 >= –26; …(6)
From (1), we have u1 = 3;
Non-negativity constraints
So, the smallest solution is:
u1 >= 0; u2 >= 0; u3 >= 0;
u1 = 3; u2 = 1; u3 = 25;
v1 >= 0; v2 >= 0; v3 >= 0;
v1 = 0; v2 = 1; v3 = 0;
45
Solving the Dual Problem
Dual Problem Dual
Min Y = 200*(u1 + u2 + u3) + 300*(v1 + v2 + v3); Primal Solution
u1 = 3; u2 = 1;
s.t. u1 + u2 + u3 – v1 – v2 – v3 = 28; …(1) y1 u3 = 25; v1 = 0;
u2 + u3 – v2 – v3 = 25; …(2) y2 v2 = 1; v3 = 0;
u3 – v3 = 25; …(3) y3 Put them to
– u2 – u3 + v1 + v2 + v3 >= –27; …(4) x1 find that
Constraints
– u3 + v2 + v3 = –24; …(5) x2
(1), (2), (3),
v3 >= –26; …(6) x3 and (5) have
Non-negativity constraints turned to
equality
u1 >= 0; u2 >= 0; u3 >= 0; v1 >= 0; v2 >= 0; v3 >= 0;
46
Complementary Slackness Condition
A simple statement of the Complementary Slackness Condition is that
If at the optimal point, the primal slack vanishes, i.e. a primal constraint
turns to equality, then the corresponding dual variable exists in the basis.
In other words
If at the optimal point, the dual slack vanishes, i.e. a dual constraint turns
to equality, then the corresponding primal variable exists in the basis.
47
Complementary Slackness Condition
Dual Problem Dual Solution
Min Y = 200*(u1 + u2 + u3) + 300*(v1 + v2 + v3); Primal u1 = 3; u2 = 1; u3 = 25;
s.t. u1 + u2 + u3 – v1 – v2 – v3 = 28; …(1) y1 v1 = 0; v2 = 1; v3 = 0;
u2 + u3 – v2 – v3 = 25; …(2) y2 Putting them we find that
u3 – v3 = 25; …(3) y3 Constraints (1), (2), (3), &
(5) turned to equality
– u2 – u3 + v1 + v2 + v3 >= –27; …(4) x1 Hence, Primal variables
– u3 + v2 + v3 = –24; …(5) x2 y1, y2, y3 and x2 exist
v3 >= –26; …(6) x3 Also,
Non-negativity constraints Primal variables x1 and x3
u1 >= 0; u2 >= 0; u3 >= 0; v1 >= 0; v2 >= 0; v3 >= 0; will turn to zero! Why?
Because of dual slack.
48
Complementary Slackness Condition
Primal Problem Dual Solution
Max Z = 28y1 + 25y2 + 25y3–27x1 – 24x2 – 26x3; u1 = 3; u2 = 1; u3 = 25;
Dual v1 = 0; v2 = 1; v3 = 0;
s.t. y1 <= 200; (1) u1 We found that Primal
y1 + y2 – x1 <= 200; (2) u2 variables y1, y2, y3 and x2
y1 + y2 + y3 – x1 – x2 <= 200; (3) u3 exist and x1 and x3 will
x1 – y1 <= 300; (4) v1 turn to zero.
x1 + x2 – y1 – y2 <= 300; (5) v2 Now, What can we infer
x1 + x2 + x3 – y1 – y2 – y3 <= 300; (6) v3 from the values of the
Non-negativity constraints dual solutions in the
x1 >= 0; x2 >= 0; x3 >= 0; y1 >= 0; y2 >= 0; y3 >= 0 primal problem?
49
Solving the Primal
Primal Problem Dual Solution
Max Z = 28y1 + 25y2 + 25y3–27x1 – 24x2 – 26x3; u1 = 3; u2 = 1; u3 = 25;
Dual v1 = 0; v2 = 1; v3 = 0;
s.t. y1 = 200; (1) u1 We found that Primal
y1 + y2 – x1 = 200; (2) u2 variables y1, y2, y3 and x2
y1 + y2 + y3 – x1 – x2 = 200; (3) u3 exist and x1 and x3 will
x1 – y1 <= 300; (4) v1 turn to zero.
x1 + x2 – y1 – y2 = 300; (5) v2 Since, u1, u2, u3, and v2
x1 + x2 + x3 – y1 – y2 – y3 <= 300; (6) v3 exist, corresponding
Non-negativity constraints primal constraints will
x1 >= 0; x2 >= 0; x3 >= 0; y1 >= 0; y2 >= 0; y3 >= 0 turn to equality. This is
shown in red.
50
Solving the Primal
Primal Problem Primal Solution
Max Z = 28y1 + 25y2 + 25y3–27x1 – 24x2 – 26x3; We found that Primal
Dual variables y1, y2, y3 and x2
s.t. y1 = 200; (1) u1 exist and x1 and x3 will
y1 + y2 – x1 = 200; (2) u2 turn to zero.
y1 + y2 + y3 – x1 – x2 = 200; (3) u3
Now from the equality
x1 – y1 <= 300; (4) v1 constraints:
x1 + x2 – y1 – y2 = 300; (5) v2
y1 = 200; from (1)
x1 + x2 + x3 – y1 – y2 – y3 <= 300; (6) v3
y2 = 0; from (1) and (2)
Non-negativity constraints
x2 = 500; from (5)
x1 >= 0; x2 >= 0; x3 >= 0; y1 >= 0; y2 >= 0; y3 >= 0
y3 = 500; from (3)
51
Solving the Primal
Primal Problem Primal Solution
Max Z = 28y1 + 25y2 + 25y3–27x1 – 24x2 – 26x3; Selling Quantities
Dual y1* = 200;
s.t. y1 = 200; (1) u1
y1 + y2 – x1 = 200; (2) u2 y2* = 0;
y1 + y2 + y3 – x1 – x2 = 200; (3) u3 y3* = 500;
x1 – y1 <= 300; (4) v1 Buying Quantities
x1 + x2 – y1 – y2 = 300; (5) v2 x1* = 0;
x1 + x2 + x3 – y1 – y2 – y3 <= 300; (6) v3 x2* = 500;
Non-negativity constraints x3* = 0;
x1 >= 0; x2 >= 0; x3 >= 0; y1 >= 0; y2 >= 0; y3 >= 0 Z* = 28*200 + 25*500 –
24*500 = 6100
52
THANK YOU
53