Chapter 5 Linear Programming
Chapter 5 Linear Programming
OPTIMIZATION
Linear Programming
CONTENT
• Linear Programs
• Geometric approach
• Simplex method
Linear Programs
Standard form
f(x) = c1x1 + c2x2 + . . . + cnxn → max
a1,1x1 + a1,2x2 + . . . + a1,nxn ≤ b1
a2,1x1 + a2,2x2 + . . . + a2,nxn ≤ b2
...
am,1x1 + am,2x2 + . . . + am,nxn ≤ bm
x1, x2, . . . xn R, x1, x2, . . . xn 0
Linear Programs
• Convert general linear program forms into standard form
• f(x) → min -f(x) → max
• g(x) b -g(x) ≤ -b
• A = B (A ≤ B) and (A B)
• A variable xj R can be represented by xj = 𝑥𝑗+ - 𝑥𝑗− where 𝑥𝑗+ , 𝑥𝑗− 0
Linear Programs
• Example: Convert general linear program forms into standard form
2x1 + x2 ≤ 7
x1 + 2x2 ≤ 8
x1 - x2 ≤ 2
x1, x2 0
Geometric approach
2x1 + x2 ≤ 7
x1 + 2x2 ≤ 8
x1 - x2 ≤ 2
x1, x2 0
Geometric approach
• Special cases
• Problem does not have optimal solutions
• Problem does not have feasible solutions
f(x1, x2) = 3x1 + 2x2 → max f(x1, x2) = 3x1 + 2x2 → max
-2x1 - x2 ≤ -7 2x1 + x2 ≤ 7
x1 - x2 ≤ 2 -4x1 - 2x2 ≤ -16
x1, x2 R, x1, x2 0 x1, x2 R, x1, x2 0
Example
• A company must decide to make a plan to produce 2 products P1, P2.
• The revenue received when selling 1 unit of P1 and P2 are
respectively 5$ and 7$
• The manufacturing cost when producing P1 and P2 are
respectively 5$ and 3$
• The storage cost in warehouses for 1 unit of P1 and P2 are
respectively 2$ and 3$
• Compute the production plan so that
• Total manufacturing cost is less than or equal to 200$
• Total storage cost is less than or equal to 150$
• Total revenue is maximal
Simplex method
f(x1, x2,…, xn) = c1x1 + c2x2 + . . . + cnxn → max
a1,1x1 + a1,2x2 + . . . + a1,nxn ≤ b1
a2,1x1 + a2,2x2 + . . . + a2,nxn ≤ b2
. . .
am,1x1 + am,2x2 + . . . + am,nxn ≤ bm
x1, x2, …, xn 0
Simplex method
Add slack variables s1, s2, …, sm 0
f(x1, x2,…, xn, s1, s2, …, sm) = c1x1 + c2x2 + . . . + cnxn → max
a1,1x1 + a1,2x2 + . . . + a1,nxn + s1 = b1
a2,1x1 + a2,2x2 + . . . + a2,nxn + 0 + s2 + . . . = b2
. . .
am,1x1 + am,2x2 + . . . + am,nxn + 0 + . . . + sm = bm
x1, x2, …, xn, s1, s2, …, sm 0
Simplex method
B = 1 0 0 N = 2 1
xB = x3 = 7 xN = x1 = 0
x2 0 0 1 0 1 2
x4 8
x5 2 0 0 1 1 -1
f(x) = 0
Simplex method
B = 2 1 0 N = 1 0
xB = x1 = 2 xN = x2 = 0
x5 0 1 0 1 2 0
x3 3
x4 6 1 0 0 -1 1
B-1 = 0 0 1
f(x) = 6
1 0 -2
0 1 -1
Simplex method
B = 2 1 0 N = 1 0
xB = x1 = 3 xN = x3 = 0
x5 0 1 2 1 0 0
x2 1
x4 3 1 -1 0 0 1
B = 2 1 0 N = 1 0
xB = x1 = 2 xN = x3 = 0
x4 0 1 2 0 0 1
x2 3
x5 3 1 -1 1 0 0
xB = x1 = 2 xN = x3 = 0
x2 3 x4 0
x5 3
f(x) = 12
Simplex method: Tabular form
cB B xB c1 ... cp ... cn
A1 ... Ap ... An
cq Ai0 xq x q ,1 x q, p x q ,n q
1 ... p ... n
Simplex method: Tabular form
cB B xB c1 ... cp ... cn
A1 ... Ap ... An
cq Ai0 xq x q ,1 x q, p x q ,n q
1 ... p ... n
Simplex method: Tabular form
Update schema
Update xi,j: x’i,j = xi,j – (xq,j * xi,p)/ xq,p, i JB \ {q}, j J \ {p}
’j = j – (xq,j * p) / xq,p, j J \ {p}
JB = JB \ {q} {p}
x’q = xq / xq,p
On row q: x’q,j = xq,j / xq,p, j J
On column p: x’q,p = 1, x’i,p = 0, i JB \ {q}
p = 0
Simplex method: Tabular form
0 A3 7 2 1 1 0 0
0 A4 8 1 2 0 1 0
0 A5 2 1 -1 0 0 1
-3 -2 0 0 0
Simplex method: Tabular form
cB B xB 3 2 0 0 0
A1 A2 A3 A4 A5
0 A3 7 2 1 1 0 0
0 A4 8 1 2 0 1 0
0 A5 2 1 -1 0 0 1
-3 -2 0 0 0
Select p = 1
Simplex method: Tabular form
cB B xB 3 2 0 0 0
A1 A2 A3 A4 A5
0 A3 7 2 1 1 0 0 7/2
0 A4 8 1 2 0 1 0 8
0 A5 2 1 -1 0 0 1 2
-3 -2 0 0 0
Select p = 1
Simplex method: Tabular form
cB B xB 3 2 0 0 0
A1 A2 A3 A4 A5
0 A3 7 2 1 1 0 0 7/2
0 A4 8 1 2 0 1 0 8
0 A5 2 1 -1 0 0 1 2
-3 -2 0 0 0
Select p = 1 Select q = 5
Simplex method: Tabular form
cB B xB 3 2 0 0 0
A1 A2 A3 A4 A5
0 A3 3 2 3 1 0 -2
0 A4 6 1 3 0 1 -1
0 A5 2 1 -1 0 0 1
-3 -5 0 0 3
0 A3 3 0 3 1 0 -2
0 A4 6 0 3 0 1 -1
3 A1 2 1 -1 0 0 1
0 -5 0 0 3
0 A3 3 0 3 1 0 -2
0 A4 6 0 3 0 1 -1
3 A1 2 1 -1 0 0 1
0 -5 0 0 3
Select p = 2
Simplex method: Tabular form
cB B xB 3 2 0 0 0
A1 A2 A3 A4 A5
0 A3 3 0 3 1 0 -2 1
0 A4 6 0 3 0 1 -1 2
3 A1 2 1 -1 0 0 1 +
0 -5 0 0 3
Select p = 2 Select q = 3
Simplex method: Tabular form
cB B xB 3 2 0 0 0
A1 A2 A3 A4 A5
0 A3 3 0 3 1 0 -2
0 A4 3 0 3 -1 1 1
3 A1 3 1 -1 1/3 0 1/3
0 -5 5/3 0 -1/3
2 A2 1 0 1 1/3 0 -2/3
0 A4 3 0 0 -1 1 1
3 A1 3 1 0 1/3 0 1/3
0 0 5/3 0 -1/3
2 A2 1 0 1 1/3 0 -2/3 +
0 A4 3 0 0 -1 1 1 3
3 A1 3 1 0 1/3 0 1/3 9
0 0 5/3 0 -1/3
Select p = 5
Simplex method: Tabular form
cB B xB 3 2 0 0 0
A1 A2 A3 A4 A5
2 A2 1 0 1 1/3 0 -2/3 +
0 A4 3 0 0 -1 1 1 3
3 A1 3 1 0 1/3 0 1/3 9
0 0 5/3 0 -1/3
Select p = 5
Select q = 4
Simplex method: Tabular form
cB B xB 3 2 0 0 0
A1 A2 A3 A4 A5
2 A2 3 0 1 -1 2/3 -2/3
0 A4 3 0 0 -1 1 1
2 A2 3 0 1 -1/3 2/3 0
0 A5 3 0 0 -1 1 1
3 A1 2 1 0 2/3 -1/3 0
0 0 4/3 1/3 0