Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 59

Chapter 4

The Simplex Algorithm


PART 2
Prof. Dr. M. Arslan ÖRNEK

1
2
ISE203/IE251 3
ISE203/IE251 4
ISE203/IE251 5
ISE203/IE251 6
ISE203/IE251 7
ISE203/IE251 8
ISE203/IE251 9
ISE203/IE251 10
ISE203/IE251 11
ISE203/IE251 12
ISE203/IE251 13
ISE203/IE251 14
ISE203/IE251 15
ISE203/IE251 16
ISE203/IE251 17
ISE203/IE251 18
4.6 – The Simplex Algorithm (min LPs)

Two different ways the simplex method can be used to solve


minimization problems.

Method 1

min z = 2x1 – 3x2 max -z = -2x1 + 3x2


s.t. x1 + x2 ≤ 4 s.t. x1 + x2 ≤ 4
x1 – x 2 ≤ 6 x1 – x 2 ≤ 6
x1 , x 2 ≥ 0 x1 , x 2 ≥ 0

19
4.6 – The Simplex Algorithm (min LPs)
Use –z as the basic variable in row 0.

Initial Tableau
Row -z x1 x2 s1 s2 rhs BVs
0 1 2 -3 0 0 0 -z=0
1 0 1 1 1 0 4 s1 =4
2 0 1 -1 0 1 6 s2 = 6

ero1 -z x1 x2 s1 s2 rhs
0 1 2 -3 0 0 0
1 0 1 1 1 0 4
2 0 2 0 1 1 10
ero 2 -z x1 x2 s1 s2 rhs BVs
0 1 5 0 3 0 12 - z = 12
1 0 1 1 1 0 4 x2 = 4
2 0 2 0 1 1 10 s2 = 10

20
4.6 – The Simplex Algorithm (min LPs)

The optimal solution (to the max problem) is


-z = 12, x2 = 4, s2 = 10, x1 = s1 = 0.
Then the optimal solution to the min problem is
z = -12, x2=4, s2 = 10, x1 = s2 = 0.  z = 2x1-3x2 =2(0) – 3 (4) = -12.

In summary, multiply the objective function for the min problem by -1 and
solve the problem as a maximization problem with the objective function –z.

(optimal z-value for the min problem) = - (optimal z-value for the max
problem).

21
4.6 – The Simplex Algorithm (min LPs)
Method 2
A simple modification of the simplex algorithm can be used to
solve min problems directly.

Modify Step 3 of the simplex algorithm as follows:


If all nonbasic variables (NBV) in row 0 have nonpositive
coefficients, the current bfs is optimal.
If any nonbasic variable has a positive coefficient, choose the
variable with the “most positive” coefficient in row 0 as the
entering variable.

22
4.7 – Alternative Optimal solutions

If an LP has more than one optimal solution, it has multiple


optimal solutions.

If all nonbasic variables (NBV) have nonzero coefficients in row


0 of the optimal tableau, the LP has a unique optimal solution.

Otherwise, the LP may have alternative optimal solutions.

23
ISE203/IE251 24
25
4.8 – Unbounded LPs

An unbounded LP occurs in a max problem if


 There is a nonbasic variable with a negative coefficient in row 0
and
 There is no constraint that limits how large we can make this
NBV.

An unbounded LP for a max problem occurs when a variable with


a negative coefficient in row 0 has a nonpositive coefficient in
each constraint.

26
ISE203/IE251 27
Example 3: Breadco Bakeries-An Unbounded LP

28
Solution:

29
30
31
4.11 Degeneracy and the Convergence of the
Simplex Algorithm
 Theoretically, the simplex algorithm can fail to find an
optimal solution to an LP.
 The following are facts (for Max LP):
– If (value of entering variable in new bfs) > 0, then (z-value for
new bfs) > (z-value for current bfs).
– If (value of entering variable in new bfs) = 0, then (z-value for
new bfs) = (z-value for current bfs).
 Up to now, we have seen that in each of the LP’s BFS, all
basic variables are positive.

32
 An LP with this property is a nondegenerate LP.
 An LP is degenerate if it has at least one bfs in which
a basic variable is equal to zero.
 Any bfs that has at least one basic variable equal to
zero is a degenerate bfs.
 When the same bfs is encountered twice it is called
cycling (looping).
– If cycling occurs, then we will loop, or cycle, forever among
a set of basic feasible solutions and never get to an optimal
solution.

33
ISE203/IE251 34
4.12 The Big M Method

 The simplex algorithm requires a starting (initial) bfs.

 Previous problems have found starting bfs by using


the slack variables as our basic variables.
– If an LP have ≥ or = constraints, however, a starting bfs
cannot be found easily.
 In such a case, the Big M method is used to obtain a
starting bfs and solve the problem.

35
Example 4: Bevco (A Blending Problem)

 Bevco manufactures an orange-flavored soft drink called Oranj


by combining orange soda and orange juice.
– Each oz of orange soda contains 0.5 oz of sugar and 1 mg of vitamin C.
– Each oz of orange juice contains 0.25 oz of sugar and 3 mg of vitamin C.

– It costs Bevco 2¢ to produce an ounce of orange soda and 3¢ to


produce an ounce of orange juice.
– Bevco’s marketing department has decided that each 10-oz bottle of
Oranj must contain at least 20 mg of vitamin C and at most 4 oz of
sugar.
 Use linear programming to determine how Bevco can meet
the marketing department’s requirements at minimum cost.

36
Example 4: Bevco
Letting x1 = number of ounces of orange soda in a bottle of Oranj
x2 = number of ounces of orange juice in a bottle of Oranj
The LP is:

min z = 2x1 + 3x2


st 0.5x1 + 0.25x2 ≤ 4 (sugar constraint)
x1 + 3x2 ≥ 20 (Vitamin C constraint)
x1 + x2 = 10 (10 oz in 1 bottle of Oranj)
x1 , x 2 , ≥ 0

37
4.10 – The Big M Method
Row 0: z - 2x1 - 3x2 =0
What will be the BV in row 2? Row 3?
Row 1: 0.5x1 + 0.25x2 + s1 = 4
Row 2 would violate sign restrictions
Row 2: x1 + 3x2 - e2 = 20
Row 3 no readily apparent basic variable.
Row 3: x1 + x2 = 10

To find a bfs, we create artificial variables. The variables will be


labeled according to the row in which they are used.

Row 1: z - 2x1 - 3x2 =0


Row 2: 0.5x1 + 0.25x2 + s1 = 4
Row 3: x1 + 3x2 - e2 + a2 = 20
Row 4: x1 + x2 + a3 = 10

38
4.10 – The Big M Method
In the optimal solution, all artificial variables must be equal to zero. To
accomplish this, in a min LP, a term +Mai is added to the objective function for
each ai. For a max LP, the term –Mai is added to the objective function for each
ai. M represents some very large number.
The modified Bevco LP in standard form then becomes:

Row 0: z - 2x1 - 3x2 -Ma2 - Ma3 =0


Row 1: 0.5x1 + 0.25x2 + s1 = 4
Row 2: x1 + 3x2 - e2 + a2 = 20
Row 3: x1 + x2 + a3 = 10

Modifying the objective function this way makes it extremely costly for an
artificial variable to be positive. The optimal solution should force a2 = a3 =0.

39
4.10 – The Big M Method
Description of the Big M Method:

1. Modify the constraints so that the rhs of each constraint is nonnegative.


2. Convert each inequality constraint to standard form (add a slack variable
for ≤ constraints, add an excess variable for ≥ constraints).
3. For each ≥ or = constraint, add artificial variables. Add sign restriction
ai ≥ 0.
4. Let M denote a very large positive number. Add (for each artificial
variable) Mai to min problem objective functions or -Mai to max
problem objective function.
5. Since each artificial variable will be in the starting basis, all artificial
variables must be eliminated from row 0 before beginning the simplex.

40
4.10 – The Big M Method

If all artificial variables in the optimal solution equal zero, the


solution is optimal. If any artificial variables are positive in the
optimal solution, the problem is infeasible.
The Bevco example continued:
Initial Tableau

Row z x1 x2 s1 e2 a2 a3 rhs
0 1.00 -2.00 -3.00 -M -M 0.00
1 0.50 0.25 1.00 4.00
2 1.00 3.00 -1.00 1.00 20.00
3 1.00 1.00 1.00 10.00

41
4.10 – The Big M Method
Pivot 1 z x1 x2 s1 e2 a2 a3 rhs ratio ero
0 1,00 2m - 2 4M -3 -M 30M Row 0 + M(Row 2) + M(Row 3)

1 0,50 0,25 1,00 4,00 16


2 1,00 3 -1,00 1,00 20,00 6,67
3 1,00 1,00 1,00 10,00 10
ero 1 z x1 x2 s1 e2 a2 a3 rhs ero
0 1,00 2m - 2 4M -3 -M 30M
1 0,50 0,25 1,00 4,00
2 0,33 1 -0,33 0,33 6,67 Row 2 divided by 3
3 1,00 1,00 1,00 10,00
ero 2 z x1 x2 s1 e2 a2 a3 rhs ero
0 1,00 (2M-3)/3 (M-3)/3 (3-4M)/3 (60+10M)/3 Row 0 - (4M-3)*(Row 2)
1 0,50 0,25 1,00 4,00
2 0,33 1 -0,33 0,33 6,67
3 1,00 1,00 1,00 10,00
ero 3 z x1 x2 s1 e2 a2 a3 rhs ero
0 1,00 (2M-3)/3 (M-3)/3 (3-4M)/3 (60+10M)/3
1 0,42 1,00 0,08 -0,08 2,33 Row 1 - 0.25*(Row 2)
2 0,33 1 -0,33 0,33 6,67
3 1,00 1,00 1,00 10,00
ero 4 z x1 x2 s1 e2 a2 a3 rhs ero
0 1,00 (2M-3)/3 (M-3)/3 (3-4M)/3 (60+10M)/3
1 0,42 1,00 0,08 -0,08 2,33
2 0,33 1 -0,33 0,33 6,67
3 0,67 0,33 -0,33 1,00 3,33 Row 3 - Row 2

42
4.10 – The Big M Method
Pivot 2 z x1 x2 s1 e2 a2 a3 rhs ratio
0 1.00 (2M-3)/3 (M-3)/3 (3-4M)/3 (60+10M)/3
1 0.42 1.00 0.08 -0.08 2.33 5.60
2 0.33 1 -0.33 0.33 6.67 20.00
3 0.67 0.33 -0.33 1.00 3.33 5.00
ero 1 z x1 x2 s1 e2 a2 a3 rhs ero
0 1.00 (2M-3)/3 (M-3)/3 (3-4M)/3 (60+10M)/3
1 0.42 1.00 0.08 -0.08 2.33
2 0.33 1 -0.33 0.33 6.67
3 1.00 0.50 -0.50 1.50 5.00 (Row 3)*(3/2)
ero 2 z x1 x2 s1 e2 a2 a3 rhs ero
0 1.00 -0.50 (1-2M)/2 (3-2M)/2 25.00 Row 0 + (3-2M)*(Row 3)/3
1 0.42 1.00 0.08 -0.08 2.33
2 0.33 1.00 -0.33 0.33 6.67
3 1.00 0.50 -0.50 1.50 5.00
ero 3 z x1 x2 s1 e2 a2 a3 rhs ero
0 1.00 -0.50 (1-2M)/2 (3-2M)/2 25.00
1 1.00 -0.13 0.13 -0.63 0.25 Row 1 - (5/12)*Row 3)
2 0.33 1.00 -0.33 0.33 6.67
3 1.00 0.50 -0.50 1.50 5.00
ero 4 z x1 x2 s1 e2 a2 a3 rhs ero
0 1.00 -0.50 (1-2M)/2 (3-2M)/2 25.00 Optimal Solution
1 1.00 -0.13 0.13 -0.63 0.25
2 1.00 -0.50 0.50 -0.50 5.00 Row 2 -(1/3)*Row 3
3 1.00 0.50 -0.50 1.50 5.00

43
Wyndor Problem - modified

ISE203/IE251 44
Nonzero
coefficient of x5 in
the objective
function row.

We should make
it zero.

ISE203/IE251 45
ISE203/IE251 46
ISE203/IE251 47
ISE203/IE251 48
ISE203/IE251 49
ISE203/IE251 50
ISE203/IE251 51
ISE203/IE251 52
ISE203/IE251 53
4.14 Unrestricted-in-Sign Variables

 If some variables are allowed to be unrestricted in sign


(urs), the ratio test and therefore the simplex
algorithm are no longer valid.

 An LP with an unrestricted-in-sign variable can be


transformed into an LP in which all variables are non-
negative.
– For each urs variable xi, define two new variables x+i and x-i.
– Then substitute ( x +i - x - i ) for xi in each constraint and in
the objective function.
– Also add the sign restrictions.
54
 So we express xi as the difference of the two nonnegative
variables x+i and x-i.
 No basic feasible solution can have both x+i ≥ 0 and x-i ≥ 0.
 x+i and x-i will never be both basic variables.
– The column of one is equal to the negative column of the other
 For any basic feasible solution, each urs variable xi must fall into
one of the following three cases.
1. x+i > 0 and x-i = 0
2. x+i = 0 and x- i > 0
3. x+i = x-i = 0

55
Example 8 (Using urs Variables):

56
Solution:

57
58
59

You might also like