Lecture 5 Simplex Method

Lecture 5
Simplex Method
September 2, 2009
Lecture 5
Outline:
• Re-cap blind search
• Simplex method in steps
• Simplex tableau
Operations Research Methods
1
Lecture 5
Determining an optimal solution by exhaustive search
• From the LP theory (if interested take course IE 411), the optimal value
of an LP problem is always attained at a corner point
• Thus, we can find the optimal value and an optimal solution by
• Generating a list of all basic solutions
• Crossing out infeasible solutions
• Computing the objective value for each feasible solution
• Choosing the basic feasible solutions with the best value (min or max)
Operations Research Methods
2
Lecture 5
Example: Reddy Mikks case
Basic Variables Basic Solution Feasibility Status Objective Value
x1 , x 2
3, 1.5
Feasible
21
x1 , x 3
6, −12
Infeasible
XXX
x1 , x 4
4, 0
Feasible
20
x2 , x 3
3, 12
Feasible
15
x2 , x 4
6, −6
Infeasible
XXX
x3 , x 4
24, 6
Feasible
0
• Thus, the optimal solution is x1 = 3, x2 = 1.5, x3 = 0, and x4 = 0
and the optimal value is z = 21.
• In this case, we have only one solution
Operations Research Methods
3
Lecture 5
Search Bottleneck: Large number of the basic solutions
• Blind search can be time consuming (inefficient)
• Given an LP in the standard form with m equations and n variables,
there are
n(n − 1)(n − 2) · · · (n − m + 1)
m!
many basic solutions
• Say m = 4 and n = 8, then there are 70 solutions
• It is hard to “manually” list them all and find the best
• We will use a more efficient method (simplex method) to perform a
“smarter” search (selectively moving to a better point)
Operations Research Methods
4
Lecture 5
Simplex method: started at a feasible basic solution
Illustrated on the Reddy Mikks problem
Original LP formulation
Standard LP form
maximize z = 5x1 + 4x2
subject to 6x1 + 4x2 ≤ 24
x1 + 2x2 ≤ 6
x1 , x 2 ≥ 0
maximize z = 5x1 + 4x2
subject to 6x1 + 4x2 + x3
= 24
x1 + 2x2
+ x4 = 6
x1 , x 2 , x 3 , x 4 ≥ 0
NOTE
The basic variables are also referred to as a basis.
Every basis has exactly m variables.
Operations Research Methods
5
Lecture 5
Initial iteration:
(1) Choose an initial basic feasible solution
(2) Check if it is optimal (if yes, we are done)
Suppose we choose x3 and x4 as basis
We solve the equations in terms of x1 and x2 to find the basic feasible
solution corresponding to this basis
Basis
Equations
(x3)
6x1 + 4x2 + x3
(x4)
x1 + 2x2
RHS Values
= 24
+ x4 = 6
When x1 = x2 = 0, we have the basic feasible solution “readily” available
x1 = 0
x2 = 0
x3 = 24
x4 = 6
Item 2: Is this optimal?
Operations Research Methods
6
Lecture 5
Check Optimality
We now check the optimality of the current basic solution (0,0,24,6)
Express the cost in terms of nonbasic variables
z = 5x1 + 4x2
In the basic solution (0, 0, 24, 6) the nonbasic variables are zero.
Would increasing any of these values increase the objective value (max)?
Operations Research Methods
7
Lecture 5
Yes, actually increasing either x1 or x2 would improve the cost.
Q: Why are we allowed to increase x1 or x2?
So we can choose any of these variables, say we select x1.
Checking optimality in another form:
Basis
(z) − row
Equations
z − 5x1 − 4x2
(x3)
6x1 + 4x2 + x3
(x4)
x1 + 2x2
RHS Values
=0
= 24
+ x4 = 6
There are negative coefficients in z -row (associated with x1 and x2)
The variables with negative coefficients indicate directions of improvement for the objective value (when maximizing)
Operations Research Methods
8
Lecture 5
Current basic solution (0,0,24,6) is not optimal: x1 or x2 can be increased
to improve the z -value
Next step: move to a better basic feasible solution by taking either x1 or
x2 in the basis
Suppose we choose x1
Operations Research Methods
9
Lecture 5
Next iteration:
(1) Perform basis change
(2) Determine its corresponding solution
(3) Check its optimality (if yes, we are done)
We have x3 and x4 as current basis and the nonoptimal solution (0, 0, 24, 6)
We selected variable x1 to enter the basis, but one of the current basic
variables, x3 or x4, has to leave the basis
x1 entering the basis means that x1 value is increasing from its current
value 0
Is there anything prohibiting us to increase x1 as much as we want?
The answer is the constraint equations
Operations Research Methods
10
Lecture 5
Basis
(z) − row
Equations
z − 5x1 − 4x2
(x3)
6x1 + 4x2 + x3
(x4)
x1 + 2x2
RHS Values
=0
= 24
+ x4 = 6
6x1 + 4x2 + x3 = 24 =⇒ x1 can be at most 24/6 = 4
x1 + 2x2 + x4 = 6
=⇒ x1 can be at most 6/1 =6
The variable corresponding to the smaller ratio leaves the basis.
Thus, x3 leaves the basis. The new basis is x1 and x4.
We have completed item 1 task.
Operations Research Methods
11
Lecture 5
Item 2: determine the basic feasible solution corresponding to this basis.
In other words, we need to resolve the relations to express the new basic
variables x1 and x4 in terms of nonbasic variables x2 and x3.
Old basis
Basis
(z) − row
Equations
z − 5x1 − 4x2
(x1) x3 left
6x1 + 4x2 + x3
(x4)
x1 + 2x2
RHS Values
=0
= 24
+ x4 = 6
Use Gauss-Jordan elimination
Operations Research Methods
12
Lecture 5
Gauss-Jordan: Divide the equation by 6 to have coeff. of x1 equal to 1
Basis
(z) − row
(x1)
(x4)
Equations
RHS Values
z − 5x1 − 4x2
=0
2
1
x1 + x2 + x3
=4
3
6
x1 + 2x2
+ x4 = 6
Gauss-Jordan: Eliminate x1 from the second equation
Basis
(z) − row
(x1)
(x4)
Equations
RHS Values
z − 5x1 − 4x2
=0
1
2
=4
x1 + x2 + x3
3
6
4
1
x2 − x3 + x4 = 2
3
6
The new basic feasible solution is (4,0,0,6)
Operations Research Methods
13
Lecture 5
Item 3: Is this optimal?
Gauss-Jordan: Eliminate x1 from the z -row in the last table
Basis
(z) − row
(x1)
(x4)
Equations
RHS Values
2
5
z − x2 + x3
= 20
3
6
2
1
x1 + x2 + x3
=4
3
6
4
1
x2 − x3 + x4 = 2
3
6
The current basic solution is not optimal! Why?
Thus, we have to perform another iteration.
Which of the currently nonbasic variables, x2 or x4, when increased will
result in increased z -value?
Operations Research Methods
14
Lecture 5
New iteration:
(1) Perform basis change
(2) Determine its corresponding solution
(3) Check its optimality (if yes, we are done)
We have x1 and x4 as current basis
We select variable x2 to enter the basis, but one of the current basic
variables, x1 or x4, has to leave the basis
Which variable will leave the current basis? Perform ratio test
Basis
(z) − row
(x1)
(x4)
Operations Research Methods
Equations
RHS Values
2
5
z − x2 + x3
= 20
3
6
2
1
x1 + x2 + x3
=4
3
6
4
1
x2 − x3 + x4 = 2
3
6
15
Lecture 5
1
2
x1 + x2 + x3 = 4
3
6
4
1
x2 − x3 + x4 = 2
3
6
=⇒ x2 can be at most
=⇒ x2 can be at most
4
2
3
2
4
3
=6
=
6
4
The variable corresponding to the smaller ratio leaves the basis.
Thus, x4 leaves the basis. The new basis is x1 and x2.
Operations Research Methods
16
Lecture 5
Item 2: Find the basic solution corresponding to the basis x1 and x2
Gauss-Jordan again
Old table
Basis
(z) − row
(x1)
(x2) x4 left
The number
4
3
Equations
RHS Values
2
5
z − x2 + x3
= 20
3
6
1
2
=4
x1 + x2 + x3
3
6
4
1
x2 − x3 + x4 = 2
3
6
is used to eliminate x2 from x2-row and z -row
This number is referred as pivot element
Operations Research Methods
17
Lecture 5
Gauss-Jordan elimination yields
Basis
(z) − row
(x1)
(x2)
Equations
RHS Values
11
1
+
x3 + x4 = 21
12
2
z
x1
1
1
+ x3 − x4 = 3
4
2
1
3
3
x2 − x3 + x4 =
8
4
2
What is the current basic solution (corresponding to the data above).
Item 3: Is this optimal? - Look at the coefficients of x3 and x4 in z -row.
They are nonnegative - so the current basic solution is optimal
What is the optimal objective value?
Operations Research Methods
18
Lecture 5
Simplex Path in Reddy Mikks Example
(0, 0) → (4, 0) →(3, 1.5)
Operations Research Methods
19