MS 04-1 LP Simplex
MS 04-1 LP Simplex
Management Science
Eunji Kim
eunjikim@cau.ac.kr
Complete Model:
x1 , x 2 0
▪ Feasible solution: A solution for which all of the constraints in the model are
satisfied
▪ Optimal solution: A feasible solution where the objective function reaches its
maximum (or minimum) value – for example, the most profit or the least cost.
Unbounded
▪ Quiz: Try to develop an LP with one or two variables for each of the
flowing three properties.
Limitation of Graphical
Methods 6
Graphical Solution of LP 7
▪ Decision variables?
▪ Objective function?
▪ Constraints?
What would be a good diet at McDonalds? 9
▪ A simpler problem
• Objective: Minimize the cost of a meal
• Constraints
• between 600 and 900 calories
• less than 50% of daily sodium (2300 mg per day)
• fewer than 40% of the calories are from fat
• at least 30 grams of protein.
• fractional meals permitted.
• Data
What would be a good diet at McDonalds? 10
▪ LP for McDonalds
• Decision variables: the number of menu
• H (Hamburger), B (Big Mac), M (McChicken), C (Caesar salad), R (French Fries)
• Formulation
Total cost
(variable definition)
Total calories
Fat calories
Protein
1170 Sodium
Non-negativity
What would be a good diet at McDonalds? 11
▪ This model has 5 decision variables. How can we solve this model?
• Graphical method?
• Simplex method?
Total cost
(variable definition)
Total calories
Fat calories
Protein
1170 Sodium
Non-negativity
Product 1
Product 2
Product 3
Pros and Cons of Graphical Method 14
▪ Pros
• Intuitive
▪ Cons
• Bothersome when the number of constraints increases
• Limited to the problems containing only two decision variables
▪ Simplex Method
• Mathematical procedure to solve LP
• Invented by George B. Dantzig
• One of the most important development in optimization
in the last 100 years
• It is based on Gaussian elimination operations.
Simplex Method 16
LP Model Formulation: A Maximization 17
xj = decision variables
cj = objective function coefficients
bi = resource levels
aij = constraint coefficients
Slack variables 20
▪ To apply the simplex method, the LP must satisfy all of the following:
LP tableau 21
LP tableau
-z x1 x2 s1 s2 RHS
-z +40x1+ 50x2 = 0 1 40 50 0 0 = 0
0 1 2 1 0 = 40
0 4 3 0 1 = 120
Terminologies 22
• Basic variables: the variables corresponding to the identity matrix. {-z, s1, s2}
• Non-basic variables: the remaining variables. {x1, x2}
• Basic feasible solution (BFS) is the unique solution obtained by setting the
non-basic variables to 0. z=0, x1=0, x2=0, s1=40, s2=120
Same problem, different basic variables 23
Basic -z x1 x2 s1 s2 RHS
Var.
-z 1 40 50 0 0 = 0
Initial BFS
s1 0 1 2 1 0 = 40
s2 0 4 3 0 1 = 120
z=0, x1=0, x2=0, s1=40, s2=120
Basic -z x1 x2 s1 s2 RHS
Var.
-z 1 15 0 -25 0 = -1000
Another BFS x2 0 1/2 1 1/2 0 = 20
s2 0 5/2 0 -3/2 1 = 60
z=1000, x1=0, x2=40, s1=0, s2=24
A. Find the pivot column 24
Basic -z x1 x2 s1 s2 RHS
Var.
-z 1 40 50 0 0 = 0
s1 0 1 2 1 0 = 40
s2 0 4 3 0 1 = 120
pivot column
B. Find the pivot row 25
pivot column
C. Pivoting 26
▪ Make the pivot column identical to the unit vector with 1 at the pivot
row by applying elementary row operations.
Basic -z x1 x2 s1 s2 RHS
Var. z=0,
x1=0,
-z 1 40 50 0 0 = 0
x2=0,
s1 0 1 2 1 0 = 40 s1=40,
s2 0 4 3 0 1 = 120 s2=120
Pivoting
Basic -z x1 x2 s1 s2 RHS
Var.
-z 1 40 50 0 0 = 0
s1 0 1 2 1 0 = 40
s2 0 4 3 0 1 = 120
Multiply
Basic -z x1 x2 s1 s2 RHS by 1/2
Var.
-z 1 40 50 0 0 = 0
0 1/2 1 1/2 0 = 20
s2 0 4 3 0 1 = 120
Pivoting: How to 28
2. To obtain zeros for all rest entries in the pivot column, add
multiples of the pivot row to the rest rows.
• Then, the pivot column becomes a unit vector.
Basic -z x1 x2 s1 s2 RHS
Var.
Subtract 50 times
-z 1 40 50 0 0 = 0
0 1/2 1 1/2 0 = 20
s2 0 4 3 0 1 = 120
Subtract 3 times
Basic -z x1 x2 s1 s2 RHS
Var.
-z 1 15 0 -25 0 = -1000 Pivoting
x2 0 1/2 1 1/2 0 = 20 finished
s2 0 5/2 0 -3/2 1 = 60
Entering and Exiting Variables 29
▪ After pivoting, the basic variable in the pivot row is changed from s1
to x2.
• s1 and x2 is called exiting and entering variables.
Basic -z x1 x2 s1 s2 RHS
Var.
-z 1 40 50 0 0 = 0
Exiting 0 1 2 1 0 = 40
s1
variable
s2 0 4 3 0 1 = 120
Pivoting
Basic -z x1 x2 s1 s2 RHS
Var.
-z 1 15 0 -25 0 = -1000
Entering x2 0 1/2 1 1/2 0 = 20
variable
s2 0 5/2 0 -3/2 1 = 60
LP tableau after pivoting 30
▪ Check if there are no more positive entries in the z-row (except -z)
• If yes, stop and read the results.
• If no, repeat steps A (select pivot column), B (select pivot row), and C
(pivoting) to the tableau.
Basic -z x1 x2 s1 s2 RHS
Var.
-z 1 15 0 -25 0 = -1000
x2 0 1/2 1 1/2 0 = 20
s2 0 5/2 0 -3/2 1 = 60
Basic -z x1 x2 s1 s2 RHS
Var.
-z 1 15 0 -25 0 = -1000
x2 0 1/2 1 1/2 0 = 20
s2 0 5/2 0 -3/2 1 = 60
pivot column
B. Find the pivot row 32
pivot column
C. Pivoting 33
▪ Make the pivot column identical to the unit vector with 1 at the pivot
row by applying elementary row operations.
Basic -z x1 x2 s1 s2 RHS
Var. z=1000,
x1=0,
-z 1 15 0 -25 0 = -1000
x2=20,
x2 0 1/2 1 1/2 0 = 20 s1=0,
s2 0 5/2 0 -3/2 1 = 60 s2=60
Pivoting
▪ There are no more positive entries in the z-row (except -z), in which
case we would have reached the optimal solution.
Basic -z x1 x2 s1 s2 RHS
Var.
-z 1 0 0 -16 -6 = -1360
x2 0 0 1 4/5 -1/5 = 8
x1 0 1 0 -3/5 2/5 = 24
Optimal solution:
z=1360, x1=24, x2=8, s1=0, s2=0
Simplex Method: How to 35
▪ LP model formulation
Solution 38
▪ LP in standard form
Solution 39
Basic -z x1 x2 s1 s2 s3 RHS
Var.
-z 1 4 6 0 0 0 = 0
s1 0 0.5 1 1 0 0 = 600
s2 0 12.5 10 0 1 0 = 10000
s3 0 1 0 0 0 1 = 700
Initial BFS:
z=0, x1=0, x2=0, s1=600, s2=10000, s3=700
Solution 40
Basic -z x1 x2 s1 s2 s3 RHS
Var.
-z 1 0 0 -4.67 -0.13 0 = -4130
x2 0 0 1 1.67 -0.067 0 = 333
x1 0 1 0 -1.33 0.13 0 = 533
s3 0 0 0 1.33 -0.13 1 = 167
Optimal solution:
z=4130, x1=533, x2=333, s1=0, s2=0, s3=167
Geometry and visualization of
LPs 41
Feasible Region of LP 42
Max Z=4x+3y
s.t.
2x+4y ≤ 40
4x+2y ≤ 36
3x-1y ≤ 20
1x+0y ≤ 8
x, y ≥ 0
Z=4x+3y
Corner points 45
▪ Visual examples
Polyhedron of simplex
algorithm in 3D
Example: Corner points in Pottery example 48
Basic -z x1 x2 s1 s2 RHS
Var.
-z 1 40 50 0 0 = 0
s1 0 1 2 1 0 = 40
s2 0 4 3 0 1 = 120
Basic -z x1 x2 s1 s2 RHS
Var.
-z 1 15 0 -25 0 = -1000
x2 0 1/2 1 1/2 0 = 20
s2 0 5/2 0 -3/2 1 = 60
Basic -z x1 x2 s1 s2 RHS
Var.
-z 1 0 0 -16 -6 = -1360
x2 0 0 1 4/5 0 = 8
x1 0 1 0 -3/5 2/5 = 24
maximize z = 4x + 3y
(1)
Feasible region 56
(2)
(1)
Feasible region 57
(2)
(1)
(3)
Feasible region 58
(4)
(2)
(1)
(3)
Terminology 59
(4)
(2)
A constraint is called
(1) redundant if deleting the
constraint does not increase
the size of the feasible region.
Feasible region
4x+3y=z
Exercise 61
maximize
Feasible region
4x+3y=z
QnA