You are on page 1of 43

CHAPTER 09

Linear Programming (LP)

1
Objectives
After completing this chapter, students will be able to:

 Setup a standard LP problem


 Solve LP with simplex method
 Understand sensitivity analysis with simplex
method.
 Understand special cases in LP

2
Gauss-Jordan Elimination
 Solve: 2 x1  3 x2  7
4 x1  5 x2  13
 We can perform the problem as matrix form:

2 3 7
 
 4 5 13
 Goal: reduce this to trivial form

1 0 a 1x1  0 x2  a
and read off answer
  from right column
0 x1  1x2  b
0 1 b

3
Gauss-Jordan Elimination (cont.)

2 3 7  row1 1 3
2
7 2
new= 1/2 * row1
   
4 5 13 4 5 13

1 3
2
7
2 1 3
2
7 2
   
0 1  1 row2new= (-1) * row2
0 1 1 

1 0 2
 
0 1 1  Read off solution: x1 = 2, x2 = 1
4
Simplex Method

 Developed by George Dantzig in 1947.


 The simplex method moves from one
extreme point to its neighboring extreme
point, stopping when the objective function
can no longer be improved.
The procedure ends when the optimal
solution is found or the problem has no
solution.

 Based on the Gauss-Jordan elimination


procedure. 5
The standard LP problem
 All constraints are equations.
 All variables are nonnegative
 The objective function may be maximization
or minimization.
 Constraints: with the type
 : add a slack variable to left side
 : subtract a surplus variable and add an Artificial
variable to left side
= : add an Artificial variable to left side.
 Example: 3x1 + 2x2  25 is converted to 3x1 + 2x2 + s = 25

 Objective function: Min. Z = - Max (- Z)


 Example: Min Z = 5x1 + 3x2 has the same solution
with Max (-Z) = - 5x1 - 3x2 6
Example Convert to:
x1 + x2 = 10 x1 + x2 + A1 = 10
2x1 + 2 x2  5 2x1 + 2 x2 + s1 = 5
4x1 + 3 x2  8 4x1 + 3 x2 - s2 + A2 = 8
Where S1: Slack var.,
S2: Surplus var.
A1: Artificial var.
Basic solutions
The constraints consist of m equations and n variables (with n>
m). So the basic solution gives
 m variables different from zero and
 (n-m) variables must be zero.
We call:
 m variables are basic solution and
 (n-m) variables are non-basic variables. 7
We consider the example: After converting:
Max. Z = $7x1 + $5x2 Max. Z = $7x1 + $5x2+ $0s1+ $0s2
Subject to: Subject to:
2x1 + 1x2  100 2x1 + 1x2 + 1s1 = 100
4x1 + 3x2  240 4x1 + 3x2 + 1s2 = 240

m = 2; n = 4 m = 2; n = 4
The initial solution: The final solution:
x1 = x2 = 0 :non-basic x1 = 30; x2 = 40
s1 = 240; s2 = 100: basic s1 = s2 = 0
We have m=2 basic We have m=2 basic
solution and 4-2 = 2 non- solution and 4-2 = 2
basic solution non-basic solution
8
Simplex Tableau

Example 9.1 (Refer example 6.1 )


The initial Simplex Tableau
Cj Solution $7 $5 $0 $0
X1 X2 S1 S2 Quantity
$0 S1 2 1 1 0 100 Constraint
rows
$0 S2 4 3 0 1 240
Zj $0 $0 $0 $0 $0 Gross Profit row
Cj - Zj $7 $5 $0 $0 Net Profit row
1
Basic solution Note: the value in S1 column contains 0
0
And the value in S2 column contains 1
Currently, X1 = X2 =0;
if we want to: increase 1 unit of X1 ,
we have to: decrease S1 by 2 and S2 by 4.
(Remember S1 and S2 is the available resources.) 9
Simplex Tableau- Step by Step
Max. Z = $7x1 + $5x2 + $0s1 + $0s2
Subject to:
2x1 + 1x2 + 1s1 = 100
4x1 + 3x2 + 1s2 = 240

Cj Solution $7 $5 $0 $0
X1 X2 S1 S2 Quantity
$0 S1 2 1 1 0 100
$0 S2 4 3 0 1 240
Zj $0 $0 $0 $0 $0
Cj - Zj $7 $5 $0 $0

10
Simplex Tableau- Step by Step
Max. Z = $7x1 + $5x2 + $0s1 + $0s2
Subject to:
2x1 + 1x2 + 1s1 = 100
4x1 + 3x2 + 1s2 = 240

Cj Solution $7 $5 $0 $0
X1 X2 S1 S2 Quantity
x
$0 S1 2 1 1 0 100
x +
$0 S2 4 3 0 1 240

Zj $0 $0 $0 $0 $0

Cj - Zj Obj. value 11
Simplex Tableau- Step by Step
Max. Z = $7x1 + $5x2 + $0s1 + $0s2
Subject to:
2x1 + 1x2 + 1s1 = 100
4x1 + 3x2 + 1s2 = 240

Cj Solution $7 $5 $0 $0
X1 X2 S1 S2 Quantity
-
$0 S1 2 1 1 0 100

$0 S2 4 3 0 1 240

Zj $0 $0 $0 $0 $0

Cj - Zj $7 $5 $0 $0 12
Simplex Tableau- Step by Step
Max. Z = $7x1 + $5x2 + $0s1 + $0s2
Subject to:
2x1 + 1x2 + 1s1 = 100
4x1 + 3x2 + 1s2 = 240
Completed Initial Tableau

Cj Solution $7 $5 $0 $0
X1 X2 S1 S2 Quantity

$0 S1 2 1 1 0 100

$0 S2 4 3 0 1 240

Zj $0 $0 $0 $0 $0

Cj - Zj $7 $5 $0 $0 13
Simplex Method for Maximization problem

1. Determine entering variable by select the largest positive number in


the (Cj - Zj) row. The column identified is called pivot column.

2. Determine leaving variable by dividing amount in RHS by the


corresponding number in the selected column, select smallest ratio,
take only positive number. This row is called pivot row, the
intersection called pivot number.

3. Compute the new value for pivot row: divide every number by the pivot
number. The purpose is to transform the pivot number to value 1.

4. Compute the new value for each remaining row: keep other number in
the pivot column ( pivot number) to be zero by matrix elementary
transformation

5. Compute Zj and (Cj - Zj) rows. If all numbers in the (Cj - Zj) are non-
positive, reach optimal. If not, return to step 1 14
Cj Solution $7 $5 $0 $0 Leaving
X1 X2 S1 S2 Quantity Variable
$0 S1 2 1 1 0 100 100/2 = 50
$0 S2 4 3 0 1 240 240/4 = 60
Zj $0 $0 $0 $0 $0
Cj - Zj $7
$7 $5 $0 $0
Pivot number
Entering Variable

The entering var. is X1: the most positive number in (Cj-Zj) row.

The leaving var. is S1: the smallest ratio (100/2) compare with
(240/4). So the basic var. will be X1 and S2.

15
Cj Solution $7 $5 $0 $0
X1 X2 S1 S2 Quantity
$7 X1 1 1/2 1/2 0 50 Row is
divided
$0 S2 4 3 0 1 240
by 2
Zj $0 $0 $0 $0 $0
Cj - Zj $7 $5 $0 $0
The second simplex tableau
Cj Solution $7 $5 $0 $0
X1 X2 S1 S2 Quantity
$7 X1 1 1/2 1/2 0 50
$0 S2 0 1 -2 1 40 Apply same
method for
Zj $7 $7/2 $7/2 $0 $350 all values in
Cj - Zj $0 $3/2 -$7/2 $0 Row

0 = 1* (- 4) + 4
16
Basic var.: X1 and S2, non-basic var.: X2 and S1.
Cj Solution $7 $5 $0 $0
X1 X2 S1 S2 Quantity
$7 X1 1 1/2 1/2 0 50 50/(1/2)= 100
$0 S2 0 1 -2 1 40 40/1 = 40
Zj $7 $7/2 $7/2 $0 $350
Leaving
Cj - Zj $0 $3/2 -$7/2 $0
Variable
Entering Variable Pivot number Become 0

The third simplex tableau - the final simplex tableau


Cj Solution $7 $5 $0 $0
X1 X2 S1 S2 Quantity
$7 X1 1 0 3/2 -1/2 30
$5 X2 0 1 -2 1 40
Zj $7 $5 $1/2 $3/2 $410
Cj - Zj $0 $0 -$1/2 -$3/2

All the (Cj - Zj) are non positive - stop. Reaches optimal solution
17
Itn. Cj Solution $7 $5 $0 $0
1 X1 X2 S1 S2 Qty.
$0 S1 2 1 1 0 100
$0 S2 4 3 0 1 240Transform the
Zj $0 $0 $0 $0 $0 row to get
pivot value 1
Cj - Zj $7 $5 $0 $0
2 $7 X1 1 1/2 1/2 0 50
$0 S2 0 1 -2 1 40
Zj $7 $7/2 $7/2 $0 $350
Cj - Zj $0 $3/2 -$7/2 $0
3 $7 X1 1 0 3/2 -1/2 30
$5 X2 0 1 -2 1 40
Zj $7 $5 $1/2 $3/2 $410
Cj - Zj $0 $0 -$1/2 -$3/2
This process ended because we got the optimal
18
(all elements of Cj-Zj ≤0)
Artificial variables

When dealing with equality (=) or  constraints, we need artificial


variables

We consider the example: After converting:


Max. Z = $7x1 + $5x2 Max. Z = $7x1 + $5x2+ $0s1+ $0s2 - MA1 - MA2
Subject to: Subject to:
4x1 + 3x2  240 4x1 + 3x2 + 1s1 = 240
2x1 + 1x2  100 2x1 + 1x2 - 1s2 + A1 = 100
5x1 + 3x2 = 400 5x1 + 3x2 + A2 = 400

Note: In objective function, the coefficients of :


• surplus and slack variables are 0
• artificial variables are very big number, M.
19
Example 7.2 (Minimization problem)

Solve the following Min. problem:


Min. Z = 5 X1 +6 X2 By graphical approach, we
St.: obtain:
X1 + X2 = 1000 X1 = 300
X1  300 X2 = 700
X2  150 Cost Z = 5700
X1, X2  0

To use Simplex method, we convert the original problem to


maximization form:
Min. Z = 5X1 +6X2  Max. (-Z) = -5X1 – 6X2
So, we have:
Max. T = (-Z) = -5X1 - 6X2 + 0S1 + 0S2 - MA1 - MA2
St.: (Why we use two more
X1 + X2 + A1 = 1000 variables in the last
X1 +S1 = 300 constraint ?) 20

X2 - S2 + A2 = 150
Initial Simplex tableau
Cj -5 -6 0 0 -M -M Quantity
Solution X1 X2 S1 S2 A1 A2
-M A1 1 1 0 0 1 0 1000
0 S1 1 0 1 0 0 0 300
-M A2 0 1 0 -1 0 1 150
Tj = -Zj -M -2M 0 +M -M -M -1150 M
Cj - Tj M-5 2M-6 0 -M 0 0

Second Simplex tableau


Cj -5 -6 0 0 -M -M Quantity
Solution X1 X2 S1 S2 A1 A2
-M A1 1 0 0 1 1 -1 850
0 S1 1 0 1 0 0 0 300
-6 X2 0 1 0 -1 0 1 150
Tj = -Zj -M -6 0 -M+6 -M M-6 -850M-900
C j - Tj M-5 0 0 M-6 0 -2M+6

21
The third Simplex tableau

Cj -5 -6 0 0 -M -M Quantity
Solution X1 X2 S1 S2 A1 A2
-M A1 0 0 -1 1 1 -1 550
-5 X1 1 0 1 0 0 0 300
-6 X2 0 1 0 -1 0 1 150
Tj = -Zj -5 -6 M-5 -M+6 -M M-6 -550M-2400
Cj - Tj 0 0 -M+5 M-6 0 -2M+6

The final Simplex tableau


Cj -5 -6 0 0 -M -M Quantity
Solution X1 X2 S1 S2 A1 A2
0 S2 0 0 -1 1 1 -1 550
-5 X1 1 0 1 0 0 0 300
-6 X2 0 1 -1 0 1 0 700
Tj = -Zj -5 -6 1 0 -6 0 -5700
Cj - Tj 0 0 -1 0 -M+6 -M

The optimal solution is: X1 = 300; X2 = 700; (The surplus S2 = 550)


T = -5700 => Cost Z = 5700 22
Special Cases
 Infeasible problems: when there is no solution that satisfies all of the
problem’s constraints
(in final simplex tableau: artificial variable(s) cannot be removed
from the basis.)

 Unbounded problem: describes linear programs that do not have


finite solutions
(in simplex tableau, we found a variable that enters the basis, but
no variable can be removed from the basis because none of the
values in the entering variable's column is positive.)

 Multiple optimal solutions: For one or more non-basic variables cj-


zj = 0.

 Degeneracy problem: develops when three constraints pass through


a single point
(there is a tie for smallest ratio to determine the leaving basic
variable.)
23
Multiple/alternative solutions

Note: S1 is non-basic variable but has value “0” for cj-zj

 Alternative solution is to consider the non-basic


variable that has cj-zj = 0 as the next pivot column and
repeat the simplex steps
24
Infeasible LP problem

Artificial variables appear in final solution representing infeasible solution

 Infeasible means the LP problem is not properly


formulated and that a feasible region cannot be
identified.
25
Unbound LP problem

 Cannot identifying the Pivot row


(i.e. leaving basic variable)

26
Degeneracy problem
Cj $5 $8 $2 $0 $0 $0
SOLUTION
X1 X2 X3 S1 S2 S3 QUANTITY
MIX
$8 X2 0.25 1 1 –2 0 0 10
$0 S2 4 0 0.33 –1 1 0 20 20/4 = 5
$0 S3 2 0 2 0.4 0 1 10 10/2 = 5
Zj $2 $8 $8 $16 $0 $0 $80
Cj - Zj $3 $0 –$6 –$16 $0 $0

 Degeneracy can lead to cycling situation.


=> Choose one and try to solve. If the cycling
situation occurs, go back and try the other one
27
Sensitivity Analysis in LP
Types of Sensitivity Analysis

 Changes in the objective function coefficients


 Changes in Right-hand-side values (RHS)
 Changes in the constraint coefficients
 Addition of a new constraint
 Addition of a new decision variable
Often involves a series of what-if question

28
Consider the following example:
The High Note Sound Company manufactures quality compact disc (CD) players
and stereo receivers. Each of these products requires a certain amount of skilled
artisanship, of which there is a limit weekly supply.

Maximize Profit = $50 X1 + $120 X2


Subject to:
2 X1 + 4 X2  80 (available electricians’ time) 60
3 X1 + X2  60 (avai. audio technicians’ time)
X1, X2  0

 Optimal solution at point A


 X1 = 0; X2 = 20; Profit = 2400
 Basic variables: X2=20 , S2 = 40 A 20
50 X1 + 120 X2 =2400
 Non-basic: X1= S1=0.

29

20 40 50
1. Changes in the objective function coefficients
Final simplex table:

Cj Basic 50 120 0 0 RHS-


Vars. X1 X2 S1 S2 Quantity
120 X2 1/2 1 1/4 0 20
0 S2 5/2 0 - 1/4 1 40
Zj 60 120 30 0 2400
Cj – Zj -10 0 - 30 0

a. Change coefficients of Nonbasic variables:


For nonbasic: (Cj – Zj ) ≤ 0  Cj ≤ Zj
 -∞ ≤ Cj (for X1) ≤ 60;
-∞ ≤ Cj (for S1) ≤ 30
30
b. Change coefficients of Basic Variables:
changes in coef.s of basic variables will affect to all variables. We use a
increment ∆, say (120 + ∆) for X2 and rework the simplex tableau.

Cj Basic 50 120+∆ 0 0 RHS-


Vars. X1 X2 S1 S2 Quantity
120+∆ X2 1/2 1 1/4 0 20
0 S2 5/2 0 - 1/4 1 40
Zj 60+ ∆/2 120+∆ 30+ ∆/4 0 2400+20∆
Cj – Zj -10- ∆/2 0 -30- ∆/4 0

The optimality will be unchanged if and only if Cj – Zj ≤ 0.


• With X1: -10- ∆/2 ≤ 0 ↔ ∆ ≥ -20.
• With S1: -30-∆/4 ≤ 0 ↔ ∆ ≥ -120.
• Combine both conditions, we use the condition ∆ ≥ -20.
Recall that Cj (X2) = 120+∆. Therefore, ∆ = Cj (X2)-120 ≥ –20
or 100 ≤ Cj (X2) ≤ +∞ 31
Assume that we change the coefficient of the X2 in the Obj. function
Maximize Profit = $50 X1 + $120 X2
Optimal solution at point A Subject to:
X1 = 0 CD players 2 X1 + 4 X2  80
X2 = 20 Receivers 3 X1 + X2  60
60 Profits = 2400$ X1, X2  0

Pass through point B: when Cj (X2) = 80


(50x1 + 80x2) = 1760$

Pass through point A


A (50x1 + 150x2) = 3000$
(0,20)
Pass through point A
B(16,12) (50x1 + 120x2) = 2400$

20 40 50 60

32
2. Changes in the Resources (RHS values)
 Shadow Price: is the change in obj. function value from
increasing of one unit of a scarce resource.
Maximize Profit = $50 X1 + $120 X2
Subject to:
2 X1 + 4 X2  80 (available electricians’ time)
3 X1 + X2  60 (avai. audio technicians’ time)
X1, X2  0
Look at the negative values at (Cj – Zj) row of slack variables, these values are
called shadow prices.

Cj Basic 50 120 0 0 RHS-


Vars. X1 X2 S1 S2 Quantity
120 X2 1/2 1 1/4 0 20
0 S2 5/2 0 - 1/4 1 40
Zj 60 120 30 0 2400
Cj – Zj -10 0 -30 0

Should the firm hire an extra electrician on Obj. function value will increase
part time basis with cost $22/hrs? 30 when increasing one unit of 33

Answer: yes. Why? resource associated with S1


Maximize Profit = $50 X1 + $120 X2
2. Changes in the RHS (cont.) Subject to:
2 X1 + 4 X2  80
3 X1 + X2  60
X1, X2  0

 RHS ranging: the process which determining number of


resources needed to add or to reduce so that we still have the
same shadow price.
 Take Quantity divide to corresponding columns in the final
tableau, get:
 For S1: The smallest positive ratio is 80. This is how
many hours of resource 1 can be reduced without
changing the current solution. Hence, we can
decrease RHS as much as 80, make minimum
RHS will be (80-80) = 0.
Quantity S1 Ratio
20 1/4 80
40 - 1/4 - 160
The smallest negative ratio is -160. So, 160 is
how many hours of resource 1 can be added
without changing the current solution. Maximum
value of RHS will be 80 + 160 =240
34
So, range of RHS of resource 1: (0, 240)
 For S2: With the same manner, we get smallest
positive ratio is 40. Hence, we can
Quantity S2 Ratio decrease RHS as much as 40, make
minimum RHS will be (60-40) = 20.
20 0 ∞ Maximum value of RHS will be ∞.

40 1 40
So, range of RHS of resource 2: (20, ∞)

 The audio technician resource is slightly different in that all 60 hours of time
originally available have not been used up.
o S2 = 40 hours in final tableau.
 Applying the ratio test, the number of audio technicians’ hours can be reduced
by only 40 (the smallest positive ratio = 40/1) before a shortage occurs.
 Since not all the hours currently available are being used, they can be
increased indefinitely without altering the problem’s solution.
o There are no negative substitution rates in the S2 column, so there are no
negative ratios.
 So, the valid range for this shadow price would be from 20 (= 60 - 40) hours to
an unbounded upper limit.
35
3. Computer output for ranging

Maximize Profit = $50 X1 + $120 X2


Subject to:
2 X1 + 4 X2  80
3 X1 + X2  60
X1, X2  0

Variable Value Reduced Cost Original Val Lower Bound Upper Bound
X1 0. 10 50. -Infinity 60.
X2 20. 0 120. 100. Infinity

Constraint Dual Value Slack/Surplus Original Val Lower Bound Upper Bound
Constraint 1 30 0 80 0. 240.
Constraint 2 0 40 60 20. Infinity

36
Sensitivity Analysis by Computer

 Solver in Excel has the capability of producing


sensitivity analysis that includes the shadow prices of
resources
 The following slides present the solution to the High
Note Sound problem and the sensitivity report
showing shadow prices and ranges

37
Sensitivity Analysis by Computer (cont.)

38
Sensitivity Analysis by Computer (cont.)

39
Terms Used in Different Books on Simplex method

Binding Tight
Non-binding Loose
Slack Slack
Excess Surplus
Reduced cost Opportunity cost
Shadow price Dual price

40
Signs of Shadow Prices for
maximization problems
 “ ≤ constraint” . The shadow price is non-negative.

 “ ≥ constraint” . The shadow price is non-positive.

 “ = constraint”. The shadow price could be zero


or positive or negative.

41
Reduced Cost
 Reduced cost of an unused activity is:
 The amount by which the profit contribution of
an activity (objective function coefficient)
needs to be increased before producing this
activity
 the amount by which the profit will decrease if
1 unit of this activity is forced into the solution

42
Brief summary on reduced costs
 The reduced cost of a non-basic variable xj
is the “increase” in the objective value of
requiring that xj >= 1.
 The reduced cost of a basic variable is 0.
 The reduced cost can be computed by
treating shadow prices as real prices. This
operation is known as “pricing out.”
 Pricing out can determine if a new variable
would be of value (and would enter the
basis).

43

You might also like