Simplex Algorithm
Simplex Algorithm
Sys opt Sys opt Sys opt Sys opt Sys opt Sys opt Sys opt Sys opt Sys Opt Sys opt Sys opt Sys opt Sys opt Sys opt Sys opt Sys opt Sys opt
Lecture 4
The Simplex Method
Mohammad Miralinaghi
Illinois Institute of Technology
1
Introduction
When to use the geometric method to solve linear
programming?
Simplex method
Developed by George B. DANTZIG (1914-2005) in
1947 while on assignment with the U.S. Department of
the air force
1
Standard Linear Programming (max)
Standard maximization problem
Slack Variables
Definition of the slack variable
A mathematical representation of surplus resources.
Real-life implication
In real-life problems, it’s unlikely that all resources
will be used completely, so there usually are unused
resources.
2
Basic and Nonbasic Variables
Concept
Example
x1 2 x2 s1 32
3 x1 4 x2 s2 84
SIMPLEX METHOD
Step-1
Write the
standard Step 2 Step-5
Step 4
maximization Are there Select the
Step-3 Are there
problem in
standard form,
any
negative
Yes Select any Yes pivot
the
positive element and
introduce slack indicators elements
pivot perform the
variables to form in the in the pivot
bottom column pivot
the initial column? operation
system, and row?
write the initial
tableau.
No
No
STOP STOP
The optimal solution has been The linear programming problem
found. has no optimal solution
3
To solve a linear programming problem in standard form, use the following steps.
Pivot
Pivot Column: The column of the tableau
represents the variable to be entered into
the solution mix.
Pivot Row: The row of the tableau
representing the variable to be replaced in
the solution mix.
Pivot Number: The element in both the pivot
column and the pivot row.
4
Initial Simplex Tableau
All variables Solution
EXAMPLE 1
The Galaxy Company produces two types of water
pipes: Pipe A and Pipe B. Each pipe A takes four
hours of labor from the manufacturing department
and two hours of labor from the finishing
department. Each pipe B requires three hours of
manufacturing and one hour of finishing. During
the current week, 240 hours of manufacturing time
are available and 100 hours of finishing time. Each
pipe A produced gives a profit of $70 and each
pipe B a profit of $50. How many pipes A and
pipes B should be made?
10
10
5
STEP 1
All information about example
Objective Function P 70 x1 50 x2
Non-negativity conditions x1 , x2 0 11
11
P 70 x1 50 x2 0 s1 0s2
P 70 x1 50 x2 0 s1 0 s2 0
12
12
6
4 x1 3 x2 s1 0s2 240
2 x1 x2 0s1 s2 100
P 70 x1 50 x2 0 s1 0s2 0
13
13
STEP 2
Right
Basic
x1 x2 S1 S2 P Hand
Variables
Side
S1 4 3 1 0 0 240
S2 2 1 0 1 0 100
P -70 -50 0 0 1 0
x1 0, x2 0, s1 240, s2 100, P 0
The slack variables S1 and S2 form the initial solution mix. The initial
solution assumes that all avaliable hours are unused. i.e. The slack variables
take the largest possible values.
14
14
7
Variables in the solution mix are called basic variables.
Each basic variable has a column consisting of all 0’s
except for a single 1. All variables not in the solution mix
take the value 0.
15
15
STEP 3
Select the pivot column (determine which variable to enter into
the solution mix). Choose the column with the “most negative”
element in the objective function row.
Right
Basic
x1 x2 S1 S2 P hand
Variables
side
S1 4 3 1 0 0 240
S2 2 1 0 1 0 100
P -70 -50 0 0 1 0
Pivot column
X1 should enter into the solution mix because each unit of x1 (pipe
A) contributes a profit of $70 compared with only $50 for each unit
of pipe B 16
16
8
Step 4
Yes, There are positive elements in the pivot
column.
We can go on step 5
17
17
STEP 5
Select the pivot row (determine which variable to replace in
the solution mix). Divide the last element in each row by the
corresponding element in the pivot column. The pivot row is
the row with the smallest non-negative result.
Enter
Basic Right
Variabl x1 x2 S1 S2 P hand
es side
S1 4 3 1 0 0 240 240 / 4 60
Exit S2 2 1 0 1 0 100 100 / 2 50
P -70 -50 0 0 1 0
Pivot row
Pivot column
Pivot number 18
18
9
Right
Basic
x1 x2 S1 S2 P hand
Variables
side
S1 4 3 1 0 0 240
R2
x1 1 1/2 0 1/2 0 50
2
P -70 -50 0 0 1 0
19
19
Use row operations to make all numbers in the pivot column equal to 0 except
for the pivot number which remains as 1.
Right
Basic
x1 x2 S1 S2 P hand
Variables
side
S1 0 1 1 -2 0 40 4.R2 R1
x1 1 1/2 0 1/2 0 50
P 0 -15 0 35 1 3500 70.R2 R3
If 50 pipes A are made, then the unused manufacturing hours are reduced by
200 hours (4 h/pipe A multiplied by 50 pipes A); the value changes from 240
hours to 40 hours. Making 50 pipes A results in the profit being increased by
$3500; the value changes from $0 to $3500.
20
20
10
In this case, x1 50, x2 0, s1 40, s2 0, P 3500
Now repeat the steps until there are no negative numbers in
the last row.
Select the new pivot column. x2 should enter into the solution
mix.
Select the new pivot row. S1 should be replaced by x2 in the
solution mix.
Enter
Basic Right
Variabl x1 x2 S1 S2 P hand
es side
Exit S1 0 1 1 -2 0 40 40 /1 40
x1 1 1/2 0 1/2 0 50 50 / 0,5 100
P 0 -15 0 35 1 3500
New pivot row
New pivot column
21
Calculate new values for the pivot row. As the pivot number is already 1, there is
no need to calculate new values for the pivot row.
Use row operations to make all numbers in the pivot column equal except for the
pivot number.
Basic Right
Variabl x1 x2 S1 S2 P hand
es side
x2 0 1 1 -2 0 40
1
x1 1 0 -1/2 3/2 0 30 2 .R1 R2
P 0 0 15 5 1 4100 15.R1 R3
22
22
11
If 40 pipes B are made, then the number of pipes A
reduced by 20; the value changes from 50 pipes A to 30
pipes B. The replacement of 20 pipe A with 40 pipe B
results in the profit being increased by $600; the value
changes from $3500 to $4100.
23
23
Result
This simplex tableau represents the optimal
solution to the LP problem and is interpreted as:
x1 30, x2 40, s1 0, s2 0
24
24
12
Degeneracy
Enter
Basic Right
Variabl x1 x2 S1 S2 P hand
es side
S1 0 1 1 -2 0 40 40 /1 40
x1 1 2 0 1/2 0 80 80/2=40
P 0 -15 0 35 1 3500
New pivot row
New pivot column
25
25
Degeneracy
Enter
Basic Right
Variabl x1 x2 S1 S2 P hand
es side
S1 0 1 1 2 0 40 40 /1 40
x1 1 2 0 1/2 0 80 80/2=40
P 0 -15 0 35 1 3500
New pivot row
New pivot column
Row 1 40/1 40/2=20
Row 2 80/2 80/0.5=160
26
26
13
Opportunity cost
What is the effect of using an additional unit of a non-
optimal variable on the objective function?
Basic Right
Variabl x1 x2 S1 S2 hand
es side
x1 1 0.4 0 0.2 2
s1 0 3.8 1 -0.6 9
P 0 4 0 22 220
27
27
Shadow price
• What is the effect of relaxing a constraint by one unit
on the objective function?
Basic Right
Variabl x1 x2 S1 S2 hand
es side
x1 1 0.4 0 0.2 2
s1 0 3.8 1 -0.6 9
P 0 4 0 22 220
If we relax the second constraint by one unit,
then the objective function will be increased by? 28
28
14
EXAMPLE 2
29
29
EXAMPLE 3
30
30
15
A highway construction company aims to implement three
types of maintenance projects A, B, and C in a network
corridor. These projects need certain resources such as
workers, and small and large trucks. The characteristics of
the projects are presented in the following table:
Workers Small trucks Large trucks Profit
(per hour) (per hour) (per hour)
Project A 10 5 7 $100K
Project B 4 7 6 $200K
Project C 3 5 4 $150K
Available resource 100 200 200
per hour
31
31
EXAMPLE 4
Max:
Z = 5X1 + 7X2 + 6X3
Subject to:
10X1 + 2X2 + X3 <= 100
32
16
Questions?
33
33
17