Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Lecture 3
Linear Programming
Standard form LP
Simplex Algorithm
Big-M method
Linear Programming 32
one-dimensional LP
maximize cx
subject to a1 x a2
Optimal solution x
c > 0: x = a2
c = 0: any x [a1 , a2 ] optimal ... in particular x = a1 , a2
c < 0: x = a1
Moral: Optimal solution x always at the boundary.
General LP
minimize cT x,
subject to x P (polytope)
Set of points x with cost cT x = z is a plane perpendicular to c (a
hyperplane)
Slide the hyperplane in the c direction until the plane is at the
boundary of the feasible region.
Example
minimize c1 x1 + c2 x2 ,
such that x1 + x2 1,
x R2+
i.e. n o
P = x : x1 + x2 0, x1 0, x2 0
Linear Programming 33
Results:
Possible outcomes :
n o
n mn
P = x R : Ax b, A R
n o
n
= x R : ai x bi , i = 1, . . . , m
x P and let I = i : ai x = bi , = active constraints at x
Simple example
2x1 + x2 = 3
PSfrag replacements
d
c x1 + 2x2 = 3
a b
Start at corner a
1. move towards corner b: Then dx1 > 0 and dx2 = 0, or
df = d(x1 + x2 ) = dx1 > 0.
The objective improves (this is a maximization problem) so move to
corner b
At corner b
1. move to corner a: This cannot improve matters
2. move to corner c: Then dx1 < 0 and 2dx1 + dx2 = 0, i.e.
dx2 = 2dx1 , or
df = d(x1 + x2 ) = dx1 > 0
The objective improves (this is a maximization problem) so move to
corner c
At corner c
1. move to corner b: This cannot improve matters
2. move to corner d: Then dx1 < 0 and dx1 + 2dx2 = 0, i.e.
dx2 = 12 dx1 , or
1
df = d(x1 + x2 ) = dx1 < 0
2
The objective does not improve so do not move to d
Does this mean c is optimal ? Answer: yes, but why ?
Linear Programming 37
Simplex skeleton:
min/max cT x,
such that Ax = b,
x 0,
where A Rmn , b Rm and x, c Rn .
called Standard form LP
Linear Programming 38
Standard form LP
maximize x 1 + x2 ,
such that x1 + 2x2 3,
2x1 + x2 3,
x1 0,
x2 0,
Standard form: introduce two new slack variables
maximize x 1 + x2 ,
such that x1 + 2x2 + s1 = 3,
2x1 + x2 + s2 = 3,
x1 0,
x2 0,
s1 0,
s2 0.
In matrix notation :
minimize 1100 z
1 2 1 0 3
such that z= ,
2 1 0 1 3
z 0,
T
where z = x1 x2 s1 s2
Linear Programming 39
Alternatively :
| {z } .
=AB x im
| {z }
=xB
Example (contd.):
min 1
1 0 0z
1 2 1 0 3
subject to z =
2 1 0 1 3
z 0
For this
example ... n = 4, m = 2 and any two columns are LI therefore
n
= 6 basic solutions ...
m
Can you associate each BFS with the appropriate corner of the feasible
region ?
Algorithm: Check all the extreme points and choose best ...
in general number of BFS is exponential in n : impossible to list them
Linear Programming 3 12
Simplex algorithm
Want to
move to a new adjacent BFS with higher value
check if current BFS as optimal
check if the problem is unbounded
Attack the first problem and others will be solved on the way.
Have to find feasible direction that change (i.e. increase) only one
non-basic variable keeping the rest set at zero.
d14
Linear Programming 3 13
cT z = cT z0 + (cT d1 ),
1
0
= c T z0 + 1 1 0 0
1
2
= c T z0 +
c1 = cT d1 = 1 is called the reduced cost with respect to the non-basic
variable 1.
Should one move along this vector d ? why ?
c2 = c2 + cTB dB = 1
Linear Programming 3 14
T
How far can one march along d1 = 1 0 2 1 until one leaves the
feasible region ?
Since Az = A(z0 + d1 ) = b, need ensure z0 + d1 0
d11 = 1 and d1k = 0 for all k NB, therefore zN B 0
Have only to ensure that zB = z0B + d1B 0.
New adjacent BFS ... B = {1,4} and NB = {2,3} ! Now repeat this until
optimum is reached or problem unbounded
Linear Programming 3 16
+ cTN xN = cTB b
In new formulation, the basic components of the objective vector are all 0s.
We will write this canonical formulation in the following manner
0 cTN cTB b
I B b
B NB
For the example, choose B = {3, 4}. Then AB = I and the canonical
formulation is given by
z1 z2 z3 z4
1 1 0 0 0
1 2 1 0 3
2 1 0 1 3
NB NB B B
Linear Programming 3 17
b
3. Let dj be the smallest positive value of dbl l=1,...,m
j l
z1 z2 z3 z4
0 0.5 0 0.5 1.5
0 1.5 1 0.5 1.5
1 0.5 0 0.5 1.5
B NB B NB
Linear Programming 3 18
Iteration 1:
1. c = 1 1 0 0 . Set k = 1
n o
bl
2. d = 31 , 23 . Set j = 2
l
3
3. Pivot on the (j = 2, k = 1) posi-
2 tion. New canonical form
PSfrag replacements z1 z2 z3 z4
1
0 0.5 0 0.5 1.5
z0 z1 0 1.5 1 0.5 1.5
1 2 3 1 0.5 0 0.5 1.5
B NB B NB
Iteration 2
1. c = 0 0.5 0 0.5 . Set k = 2
n o
bl 1.5 1.5
2. d = 1.5 , 0.5 . Set j = 1
l
3
3. Pivot on the (j = 1, k = 2) posi-
2
tion.
PSfrag replacements z1 z2 z3 z4
b2
1 0 0 0.33 0.167 2.0
z1
0 1 0.67 0.33 1.0
z0
1 2 3 1 0 0.33 2 1.0
B B NB NB
Linear Programming 3 19
Iteration 3
1. c = 0 0 0.33 0.167 . Basis optimal
2. Optimal value = (2.0)
3. Optimal basis B = {1, 2}
4. Optimal value of basic variables:
z1 1
=
z2 1
Linear Programming 3 20
Big-M method
Initial Tableau
x1 x2 x3 x4 x5 x6 x7
1 8M + 1 18M + 1 0 0 0 0 10M
1 2 3 0 1 0 0 3
1 2 6 0 1 0 0 2
0 4 9 0 0 0 1 5
0 0 3 1 0 0 0 1
N N N B B B B
x3 has the lowest reduced cost, so it enters and x4 leaves basis
Step 2
x1 x2 x3 x4 x5 x6 x7
1 8M + 1 0 6M 13 0 0 0 4M 31
1 2 0 1 1 0 0 2
1 2 0 2 0 1 0 0
0 4 0 3 0 0 1 2
1 1
0 0 1 3 0 0 0 3
N N B N B B B
2 0 0 1 1 1 0 2
1 1
2 1 0 1 0 2 0 0
2 0 0 1 0 2 1 2
1 1
0 0 1 3 0 0 0 3
N B B N B N B
c1 < 0 so it enters and x5 leaves
Linear Programming 3 23
Step 4
x1 x2 x3 x4 x5 x6 x7
1
0 0 0 12 0 4M 12 0 11
6
1 1 1
1 0 0 2 2 2 0 1
3 1 1 1
0 1 0 4 4 4 0 2
0 0 0 0 1 1 1 0
1 1
0 0 1 3 0 0 0 3
B B B N N N B
c4 < 0, so x4 enters and x3 leave.
Step 5
x1 x2 x3 x4 x5 x6 x7
1
0 0 4 0 0 2M 34 2M + 14 74
1 0 32 0 1
2 12 0 1
2
9 1 1 5
0 1 4 0 4 4 0 4
0 0 0 0 1 1 1 0
0 0 3 1 0 0 0 1
B B N B N N B
All reduced costs are non-negative ... optimal point
Linear Programming 3 24
Readings
Rardin
Chapter 5: Section 5.3, 5.4
Chapter 7: Section 7.1
Bertsimas
Chapter 3 : Sections 3.1, 3.2, 3.3, 3.4
Chapter 4 : Sections 4.1, 4.2, 4.3
Luenberger
Chapter 4: Sections 4.1, 4.2, 4.3
Linear Programming 3 25
Technical appendix
Assume the rows of the matrix [A b] are linearly independent.
Proof of Theorem : x corner x vertex x BFS
x BFS x vertex
P
Let I = {i : aTi x = bi } and set c = iI i ai , where i < 0
P T P
T T
For all y P, c y = iI i a i y iI i bi = c x.
Since i < 0 and aTi y bi , the above equation implies aTi y = bi for all
i I. Thus, x is not a unique solution, i.e. x is not a BFS. A
contradiction; therefore, x is a vertex.
x vertex x corner
Let c such that cT x < cT y for all y P
Suppose x is not a corner, i.e. there exists y, z P and 0 < < 1
such that x = y + (1 )z. Then
cT x = cT y+(1)z = cT y+(1)cT z > cT x+(1)cT x > cT x.
A contradiction; therefore, x is a corner.
x corner x BFS
Let I = {i : aTi x = bi }, then x unique solution of AI z = bI , i.e.
Rank(AI ) = n
Suppose not. Then there exists y such that AI y = 0.
Since aTi x < bi for all i 6 I, there exists > 0 such that
aTi (x y) > bi , for all i 6 I.
Then x = 21 (x + y) + 21 (x y). A contradiction; therefore x is a BFS.
cT (y z) = cT d
= cTB dB + cTN B dN B
X
= (cj cTB A1 j
B a )dj
jNB
X
= cj d j
jNB