Docsity

Wayne Winst...ition, 2003 - 4 the simplex algorithm and goal programming, Manuais, Projetos, Pesquisas de Engenharia de Produção

Toggle sidebar
bg1
The Simplex Algorithm
and Goal Programming
In Chapter 3, we saw how to solve two-variable linear programming problems graphically. Un-
fortunately, most real-life LPs have many variables, so a method is needed to solve LPs with
more than two variables. We devote most of this chapter to a discussion of the simplex algo-
rithm, which is used to solve even very large LPs. In many industrial applications, the simplex
algorithm is used to solve LPs with thousands of constraints and variables.
In this chapter, we explain how the simplex algorithm can be used to find optimal solutions
to LPs. We also detail how two state-of-the-art computer packages (LINDO and LINGO) can
be used to solve LPs. Briefly, we also discuss Karmarkar’s pioneering approach for solving
LPs. We close the chapter with an introduction to goal programming, which enables the de-
cision maker to consider more than one objective function.
4.1 How to Convert an LP to Standard Form
We have seen that an LP can have both equality and inequality constraints. It also can
have variables that are required to be nonnegative as well as those allowed to be un-
restricted in sign (urs). Before the simplex algorithm can be used to solve an LP, the
LP must be converted into an equivalent problem in which all constraints are equa-
tions and all variables are nonnegative. An LP in this form is said to be in standard
form.
†
To convert an LP into standard form, each inequality constraint must be replaced by
an equality constraint. We illustrate this procedure using the following problem.
Leather Limited manufactures two types of belts: the deluxe model and the regular model.
Each type requires 1 sq yd of leather. A regular belt requires 1 hour of skilled labor, and
a deluxe belt requires 2 hours. Each week, 40 sq yd of leather and 60 hours of skilled la-
bor are available. Each regular belt contributes $3 to profit and each deluxe belt, $4. If
we define
x
1
number of deluxe belts produced weekly
x
2
number of regular belts produced weekly
Leather LimitedEXAMPLE 1
†
Throughout the first part of the chapter we assume that all variables must be nonnegative (0). The conver-
sion of urs variables to nonnegative variables is discussed in Section 4.12.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Pré-visualização parcial do texto

Baixe Wayne Winst...ition, 2003 - 4 the simplex algorithm and goal programming e outras Manuais, Projetos, Pesquisas em PDF para Engenharia de Produção, somente na Docsity!

The Simplex Algorithm

and Goal Programming

In Chapter 3, we saw how to solve two-variable linear programming problems graphically. Un- fortunately, most real-life LPs have many variables, so a method is needed to solve LPs with more than two variables. We devote most of this chapter to a discussion of the simplex algo- rithm, which is used to solve even very large LPs. In many industrial applications, the simplex algorithm is used to solve LPs with thousands of constraints and variables. In this chapter, we explain how the simplex algorithm can be used to find optimal solutions to LPs. We also detail how two state-of-the-art computer packages (LINDO and LINGO) can be used to solve LPs. Briefly, we also discuss Karmarkar’s pioneering approach for solving LPs. We close the chapter with an introduction to goal programming, which enables the de- cision maker to consider more than one objective function.

4.1 How to Convert an LP to Standard Form

We have seen that an LP can have both equality and inequality constraints. It also can have variables that are required to be nonnegative as well as those allowed to be un- restricted in sign (urs). Before the simplex algorithm can be used to solve an LP, the LP must be converted into an equivalent problem in which all constraints are equa- tions and all variables are nonnegative. An LP in this form is said to be in standard form. † To convert an LP into standard form, each inequality constraint must be replaced by an equality constraint. We illustrate this procedure using the following problem.

Leather Limited manufactures two types of belts: the deluxe model and the regular model. Each type requires 1 sq yd of leather. A regular belt requires 1 hour of skilled labor, and a deluxe belt requires 2 hours. Each week, 40 sq yd of leather and 60 hours of skilled la- bor are available. Each regular belt contributes $3 to profit and each deluxe belt, $4. If we define x 1  number of deluxe belts produced weekly x 2  number of regular belts produced weekly

E X A M P L E 1 Leather Limited

†Throughout the first part of the chapter we assume that all variables must be nonnegative (0). The conver- sion of urs variables to nonnegative variables is discussed in Section 4.12.

the appropriate LP is max z  4 x 1  3 x 2 (LP 1) s.t. x 1  x 2  40 (Leather constraint) (1) s.t. 2 x 1  x 2  60 (Labor constraint) (2) x 1 , x 2  0

How can we convert (1) and (2) to equality constraints? We define for each  constraint a slack variable si ( si  slack variable for i th constraint), which is the amount of the re- source unused in the i th constraint. Because x 1  x 2 sq yd of leather are being used, and 40 sq yd are available, we define s 1 by

s 1  40  x 1  x 2 or x 1  x 2  s 1  40

Similarly, we define s 2 by

s 2  60  2 x 1  x 2 or 2 x 1  x 2  s 2  60

Observe that a point ( x 1 , x 2 ) satisfies the i th constraint if and only if si  0. For example, x 1  15, x 2  20 satisfies (1) because s 1  40  15  20  5  0. Intuitively, (1) is satisfied by the point (15, 20), because s 1  5 sq yd of leather are unused. Similarly, (15, 20) satisfies (2), because s 2  60  2(15)  20  10 labor hours are unused. Finally, note that the point x 1  x 2  25 fails to satisfy (2), because s 2  60  2(25)  25  15 indicates that (25, 25) uses more labor than is available. In summary, to convert (1) to an equality constraint, we replace (1) by s 1  40  x 1  x 2 (or x 1  x 2  s 1  40) and s 1  0. To convert (2) to an equality constraint, we replace (2) by s 2  60  2 x 1  x 2 (or 2 x 1  x 2  s 2  60) and s 2  0. This converts LP 1 to

max z  4 x 1  3 x 2 s.t. x 1  x 2  s 1  s 2  40 (LP 1  ) s.t. 2 x 1  x 2  s 1  s 2  60 x 1 , x 2 , s 1 , s 2  0

Note that LP 1 is in standard form. In summary, if constraint i of an LP is a  constraint, then we convert it to an equality constraint by adding a slack variable s (^) i to the ith con- straint and adding the sign restriction s (^) i  0. To illustrate how a  constraint can be converted to an equality constraint, let’s con- sider the diet problem of Section 3.4.

min z  50 x 1  20 x 2  30 x 3  80 x 4 s.t. 400 x 1  200 x 2  150 x 3  500 x 4  500 (Calorie constraint) (3) s.t. 3 x 1  2 x 2  6 (Chocolate constraint) (4) s.t. 2 x 1  2 x 2  4 x 3  4 x 4  10 (Sugar constraint) (5) s.t. 2 x 1  4 x 2  x 3  5 x 4  8 (Fat constraint) (6) x 1 , x 2 , x 3 , x 4  0

To convert the i th  constraint to an equality constraint, we define an excess variable (sometimes called a surplus variable) ei. ( ei will always be the excess variable for the i th

128 C H A P T E R 4 The Simplex Algorithm and Goal Programming

Following the procedures described previously, we transform this LP into standard form by adding slack variables s 1 , s 2 , and s 3 , respectively, to the first three constraints and sub- tracting an excess variable e 4 from the fourth constraint. Then we add the sign restrictions s 1  0, s 2  0, s 3  0, and e 4  0. This yields the following LP in standard form: max z  20 x 1  15 x 2 s.t. x 1  15 x 2  s 1  s 1  s 1  e 4  100 s.t. 50 x 1  15 x 2  s 1  s 2  s 1  e 4  100 s.t. 50 x 1  35 x 2  s 1  s 1  s 3  e 4  6, s.t. 20 x 1  15 x 2  s 1  s 1  s 1  e 4  2, xi  0 ( i  1, 2); si  0 ( i  1, 2, 3); e 4  0 Of course, we could easily have labeled the excess variable for the fourth constraint e 1 (because it is the first excess variable). We chose to call it e 4 rather than e 1 to indicate that e 4 is the excess variable for the fourth constraint.

P R O B L E M S

Group A

130 C H A P T E R 4 The Simplex Algorithm and Goal Programming

1 Convert the Giapetto problem (Example 1 in Chapter 3) to standard form.

2 Convert the Dorian problem (Example 2 in Chapter 3) to standard form.

3 Convert the following LP to standard form: min z  3 x 1  x 2 s.t. x 1  x 2  3 s.t. x 1  x 2  4 s.t. 2 x 1  x 2  3 x 1 , x 2  0

4.2 Preview of the Simplex Algorithm

Suppose we have converted an LP with m constraints into standard form. Assuming that the standard form contains n variables (labeled for convenience x 1 , x 2 ,... , xn ), the stan- dard form for such an LP is max z  c 1 x 1  c 2 x 2   cnxn (or min) s.t. a 11 x 1  a 12 x 2   a 1 nxn  b 1 s.t. a 21 x 1  a 22 x 2   a 2 nxn  b 2 (7)

s.t. a (^) m 1 x 1  am 2 x 2   a (^) mn xn  bm xi  0 ( i  1, 2,... , n ) If we define

A 

a 1 n a 2 n

amn

a 12 a 22

am

a 11 a 12

a 1 n

and

x 

, b 

the constraints for (7) may be written as the system of equations A x  b. Before pro- ceeding further with our discussion of the simplex algorithm, we must define the concept of a basic solution to a linear system.

Basic and Nonbasic Variables

Consider a system A x  b of m linear equations in n variables (assume n  m ).

D E F I N I T I O N  A basic solution to A x  b is obtained by setting n  m variables equal to 0 and solving for the values of the remaining m variables. This assumes that setting the n  m variables equal to 0 yields unique values for the remaining m variables or, equivalently, the columns for the remaining m variables are linearly independent. 

To find a basic solution to A x  b , we choose a set of n  m variables (the nonbasic variables, or NBV ) and set each of these variables equal to 0. Then we solve for the val- ues of the remaining n  ( n  m )  m variables (the basic variables, or BV ) that sat- isfy A x  b. Of course, the different choices of nonbasic variables will lead to different basic solu- tions. To illustrate, we find all the basic solutions to the following system of two equa- tions in three variables: x 1  x 2  x 3  3 (8) x 1  x 2  x 3   1 We begin by choosing a set of 3  2  1 (3 variables, 2 equations) nonbasic variables. For example, if NBV  { x 3 }, then BV  { x 1 , x 2 }. We obtain the values of the basic vari- ables by setting x 3  0 and solving x 1  x 2  3 x 1  x 2   1 We find that x 1  2, x 2  1. Thus, x 1  2, x 2  1, x 3  0 is a basic solution to (8). How- ever, if we choose NBV  { x 1 } and BV  { x 2 , x 3 }, we obtain the basic solution x 1  0, x 2  3, x 3  2. If we choose NBV  { x 2 }, we obtain the basic solution x 1  3, x 2  0, x 3  1. The reader should verify these results. Some sets of m variables do not yield a basic solution. For example, consider the fol- lowing linear system: x 1  2 x 2  x 3  1 2 x 1  4 x 2  x 3  3 If we choose NBV  { x 3 } and BV  { x 1 , x 2 }, the corresponding basic solution would be obtained by solving x 1  2 x 2  1 2 x 1  4 x 2  3

b 1 b 2

bm

x 1 x 2

xn

  1. 2 Preview of the Simplex Algorithm 131

Table 1 shows the correspondence between the basic feasible solutions to LP 1 and the extreme points of the feasible region for LP 1. This example should make it clear that the basic feasible solutions to the standard form of an LP correspond in a natural fashion to the LP’s extreme points. In the context of the Leather Limited example, it is easy to show why any bfs is an ex- treme point. The converse is harder! We now show that for the LL problem, any bfs is an extreme point. Any point in the feasible region for LL may be specified as a four- dimensional column vector with the four elements of the vector denoting x 1 , x 2 , s 1 , and s 2 , respectively. Consider the bfs B with BV  { x 2 , s 2 }. If B is not an extreme point, then there exists two distinct feasible points v 1 and v 2 and non-negative numbers 1 and 2 sat- isfying 0  (^) i  1 and 1  2  1 such that

 1 v 1  2 v 2

Clearly, both v 1 and v 2 must both have x 1  s 2  0. But because v 1 and v 2 are both feasible, the values of x 2 and s 2 for both v 1 and v 2 can be determined by solving x 2  40 and x 2  s 2  60. These equations have a unique solution (because columns corre- sponding to basic variables x 2 and s 2 are linearly independent). This shows that v 1  v 2 , so B is indeed an extreme point.

  1. 2 Preview of the Simplex Algorithm 133

E

F

D

B

C (^) A

x 2

x 1

60

50

10 20 30 40 50 60

40

30

20

F I G U R E 1 10 Feasible Region for Leather Limited

T A B L E 1 Correspondence between Basic Feasible Solutions and Corner Points for Leather Limited Basic Nonbasic Basic Corresponds to Variables Variables Feasible Solution Corner Point x 1 , x 2 s 1 , s 2 s 1  s 2  0, x 1  x 2  20 E x 1 , s 1 x 2 , s 2 x 2  s 2  0, x 1  30, s 1  10 C x 1 , s 2 x 2 , s 1 x 2  s 1  0, x 1  40, s 2   20 Not a bfs because s 2  0 x 2 , s 1 x 1 , s 2 x 1  s 2  0, s 1  20, x 2  60 Not a bfs because s 1  0 x 2 , s 2 x 1 , s 1 x 1  s 1  0, x 2  40, s 2  20 B s 1 , s 2 x 1 , x 2 x 1  x 2  0, s 1  40, s 2  60 F

We note that more than one set of basic variables may correspond to a given extreme point. If this is the case, then we say the LP is degenerate. See Section 4.11 for a dis- cussion of the impact of degeneracy on the simplex algorithm. We will soon see that if an LP has an optimal solution, then it has a bfs that is optimal. This is important because any LP has only a finite number of bfs’s. Thus we can find the optimal solution to an LP by searching only a finite number of points. Because the feasible region for any LP contains an infinite number of points, this helps us a lot! Before explaining why any LP that has an optimal solution has an optimal bfs, we need to define the concept of a direction of unboundedness.

4.3 Direction of Unboundedness

Consider an LP in standard form with feasible region S and constraints A x  b and x  0. Assuming that our LP has n variables, 0 represents an n -dimensional column vector consisting of all 0’s. A nonzero vector d is a direction of unboundedness if for all x  S and any c  0, x  c d  S. In short, if we are in the LP’s feasible region, then we can move as far as we want in the direction d and remain in the feasible region. Figure 2 dis- plays the feasible region for the Dorian Auto example (Example 2 of Chapter 3). In stan- dard form, the Dorian example is min z  50 x 1  100 x 2 7 x 1  2 x 2  e 1  28 2 x 1  12 x 2  e 2  24 x 1 , x 2 , e 1 , e 2  0 Looking at Figure 2 it is clear that if we start at any feasible point and move up and to the right at a 45-degree angle, we will remain in the feasible region. This means that

134 C H A P T E R 4 The Simplex Algorithm and Goal Programming

z = 320 z = 600

(10)

(4, 4)

B

E D A C

x 2

x 1

4

2 (11)

6

8

10

12

14

2 4 6 8 10 12 14

F I G U R E 2 Graphical Solution of Dorian Problem

2 x 1  12 x 2  e 2  24 From Figure 4, we see that to move from bfs C to point F we need to move up and to the right along a line having slope 144 ^012  2. This line corresponds to the direction of unboundedness

d 

Letting

b 1 

and x 

we may write x  d  b 1 , which is the desired representation.

4.4 Why Does an LP Have an Optimal bfs?

Consider an LP with objective function max cx and constraints A x  b. Suppose this LP

has an optimal solution. We now sketch a proof of the fact that the LP has an optimal bfs.

If an LP has an optimal solution, then it has an optimal bfs. Proof Let x be an optimal solution to our LP. Because x is feasible, Theorem 2 tells us that we may write x  d  ii  k 1 i b i , where d is 0 or a direction of unbound- edness and b 1 , b 2 ,... , b k are the LP’s bfs. Also, ii  k 1 i  1 and (^) i  0. If cd

136 C H A P T E R 4 The Simplex Algorithm and Goal Programming

T H E O R E M 3

z = 320 z = 600

(10)

(4, 4)

B

E C

F

A

D

x 2

x 1

4

2 (11)

6

8

10

12

14

2 4 6 8 10 12 14

F I G U R E 4 Expressing F  (14, 4) Using Theorem 2

0 , then for any k 0, k d  ii  k 1 i b i is feasible, and as k grows larger and larger, the objective function value approaches infinity. This contradicts the fact that the LP has an optimal solution. If cd  0 , then the feasible point ii  k 1 i b i has a larger ob- jective function value than x. This contradicts the optimality of x. In short, we have shown that if x is optimal, then cd  0. Now the objective function value for x is given by cx  cd  ii  k 1 i cb i  ii  k 1 i cb i Suppose that b 1 is the bfs with the largest objective function value. Because ii  k 1 i ^ 1 and^ i ^ 0, cb 1  cx Because x is optimal, this shows that b 1 is also optimal, and the LP does indeed have an optimal bfs.

Adjacent Basic Feasible Solutions

Before describing the simplex algorithm in general terms, we need to define the concept of an adjacent basic feasible solution.

D E F I N I T I O N  For any LP with m constraints, two basic feasible solutions are said to be adjacent if their sets of basic variables have m  1 basic variables in common. 

For example, in Figure 3, two basic feasible solutions will be adjacent if they have 2  1  1 basic variable in common. Thus, the bfs corresponding to point E in Figure 3 is adjacent to the bfs corresponding to point C. Point E is not, however, adjacent to bfs F. Intuitively, two basic feasible solutions are adjacent if they both lie on the same edge of the boundary of the feasible region. We now give a general description of how the simplex algorithm solves LPs in a max problem. Step 1 Find a bfs to the LP. We call this bfs the initial basic feasible solution. In general, the most recent bfs will be called the current bfs, so at the beginning of the problem the initial bfs is the current bfs. Step 2 Determine if the current bfs is an optimal solution to the LP. If it is not, then find an adjacent bfs that has a larger z -value. Step 3 Return to step 2, using the new bfs as the current bfs. If an LP in standard form has m constraints and n variables, then there may be a ba- sic solution for each choice of nonbasic variables. From n variables, a set of n  m non- basic variables (or equivalently, m basic variables) can be chosen in

  

different ways. Thus, an LP can have at most

 

basic solutions. Because some basic solutions may not be feasible, an LP can have at most

n m

n n! m

  1. 4 Why Does an LP Have an Optimal bfs? 137

E , and B are adjacent to corner point F. Thus, if the simplex algorithm begins at F , then we can be sure that the next bfs to be considered will be A , E , or B.

  1. 4 Why Does an LP Have an Optimal bfs? 139

C

E

F A

D

B

x 3

x 1

x 2

(0, 0, 10)

(0, 0, 0) (4, 0, 0)

(0, 8, 10)

(4, 0, 10)

(0, 8, 0)

F I G U R E 5 Feasible Region in Three Dimensions

T A B L E 2 Correspondence between bfs and Corner Points Basic Corresponds to Variables Basic Feasible Solution Corner Point x 1 , x 3 x 1  4, x 3  10, x 2  s 1  s 2  0 D s 1 , s 2 s 1  8, s 2  10, x 1  x 2  x 3  0 F s 1 , x 3 s 1  8, x 3  10, x 1  x 2  s 2  0 E x 2 , x 3 x 2  8, x 3  10, x 1  s 1  s 2  0 C x 2 , s 2 x 2  8, s 2  10, x 1  x 3  s 1  0 B x 1 , s 2 x 1  4, s 2  10, x 2  x 3  s 1  0 A

P R O B L E M S

Group A

1 For the Giapetto problem (Example 1 in Chapter 3), show how the basic feasible solutions to the LP in standard form correspond to the extreme points of the feasible region.

2 For the Dorian problem (Example 2 in Chapter 3), show how the basic feasible solutions to the LP in standard form correspond to the extreme points of the feasible region.

3 Widgetco produces two products: 1 and 2. Each requires the amounts of raw material and labor, and sells for the price given in Table 3. Up to 350 units of raw material can be purchased at $ per unit, while up to 400 hours of labor can be purchased at $1.50 per hour. To maximize profit, Widgetco must solve the following LP: max z  2 x 1  2.5 x 2 s.t. x 1  2 x 2  350 (Raw material)

2 x 1  x 2  400 (Labor) x 1 , x 2  0 Here, xi  number of units of product i produced. Demon- strate the correspondence between corner points and basic feasible solutions. 4 For the Leather Limited problem, represent the point (10, 20) in the form cd  ii  k 1 i b i. 5 For the Dorian problem, represent the point (10,40) in the form cd  ii  k 1 i b i.

Group B 6 For an LP in standard form with constraints A x  b and x  0 , show that d is a direction of unboundedness if and

T A B L E 3 Product 1 Product 2 Raw material 1 unit 2 units Labor 2 hours 1 hour Sales price $7 $

only if A d  0 and d  0.

7 Recall that Example 5 of Chapter 3 is an unbounded LP. Find a direction of unboundedness along which we can move for which the objective function becomes arbitrarily large.

4.5 The Simplex Algorithm

We now describe how the simplex algorithm can be used to solve LPs in which the goal is to maximize the objective function. The solution of minimization problems is discussed in Section 4.4. The simplex algorithm proceeds as follows: Step 1 Convert the LP to standard form (see Section 4.1). Step 2 Obtain a bfs (if possible) from the standard form. Step 3 Determine whether the current bfs is optimal. Step 4 If the current bfs is not optimal, then determine which nonbasic variable should become a basic variable and which basic variable should become a nonbasic variable to find a new bfs with a better objective function value. Step 5 Use EROs to find the new bfs with the better objective function value. Go back to step 3. In performing the simplex algorithm, write the objective function z  c 1 x 1  c 2 x 2   cnxn in the form z  c 1 x 1  c 2 x 2   cnxn  0 We call this format the row 0 version of the objective function (row 0 for short).

The Dakota Furniture Company manufactures desks, tables, and chairs. The manufacture of each type of furniture requires lumber and two types of skilled labor: finishing and car- pentry. The amount of each resource needed to make each type of furniture is given in Table 4. Currently, 48 board feet of lumber, 20 finishing hours, and 8 carpentry hours are avail- able. A desk sells for $60, a table for $30, and a chair for $20. Dakota believes that de- mand for desks and chairs is unlimited, but at most five tables can be sold. Because the available resources have already been purchased, Dakota wants to maximize total revenue.

140 C H A P T E R 4 The Simplex Algorithm and Goal Programming

E X A M P L E 2 Dakota Furniture Company

T A B L E 4 Resource Requirements for Dakota Furniture Resource Desk Table Chair Lumber (board ft) 8 6.5 1. Finishing hours 4 2.5 1. Carpentry hours 2 1.5 0.

From Section 4.2, we know that the simplex algorithm begins with an initial basic fea- sible solution and attempts to find better ones. After obtaining a canonical form, we there- fore search for the initial bfs. By inspection, we see that if we set x 1  x 2  x 3  0, we can solve for the values of s 1 , s 2 , s 3 , and s 4 by setting si equal to the right-hand side of row i. BV  { s 1 , s 2 , s 3 , s 4 } and NBV  { x 1 , x 2 , x 3 } The basic feasible solution for this set of basic variables is s 1  48, s 2  20, s 3  8, s 4  5, x 1  x 2  x 3  0. Observe that each basic variable may be associated with the row of the canonical form in which the basic variable has a coefficient of 1. Thus, for canonical form 0, s 1 may be thought of as the basic variable for row 1, as may s 2 for row 2, s 3 for row 3, and s 4 for row 4. To perform the simplex algorithm, we also need a basic (although not necessarily non- negative) variable for row 0. Because z appears in row 0 with a coefficient of 1, and z does not appear in any other row, we use z as its basic variable. With this convention, the basic feasible solution for our initial canonical form has BV  { z , s 1 , s 2 , s 3 , s 4 } and NBV  { x 1 , x 2 , x 3 } For this basic feasible solution, z  0, s 1  48, s 2  20, s 3  8, s 4  5, x 1  x 2  x 3  0. As this example indicates, a slack variable can be used as a basic variable for an equa- tion if the right-hand side of the constraint is nonnegative.

Is the Current Basic Feasible Solution Optimal?

Once we have obtained a basic feasible solution, we need to determine whether it is op- timal; if the bfs is not optimal, then we try to find a bfs adjacent to the initial bfs with a larger z -value. To do this, we try to determine whether there is any way that z can be in- creased by increasing some nonbasic variable from its current value of zero while hold- ing all other nonbasic variables at their current values of zero. If we solve for z by re- arranging row 0, then we obtain z  60 x 1  30 x 2  20 x 3 (9) For each nonbasic variable, we can use (9) to determine whether increasing a nonbasic variable (and holding all other nonbasic variables at zero) will increase z. For example, suppose we increase x 1 by 1 (holding the other nonbasic variables x 2 and x 3 at zero). Then (9) tells us that z will increase by 60. Similarly, if we choose to increase x 2 by 1 (holding x 1 and x 3 at zero), then (9) tells us that z will increase by 30. Finally, if we choose to in- crease x 3 by 1 (holding x 1 and x 2 at zero), then (9) tells us that z will increase by 20. Thus, increasing any of the nonbasic variables will increase z. Because a unit increase in x 1 causes the largest rate of increase in z , we choose to increase x 1 from its current value of zero. If x 1 is to increase from its current value of zero, then it will have to become a ba- sic variable. For this reason, we call x 1 the entering variable. Observe that x 1 has the most negative coefficient in row 0.

Determine the Entering Variable

We choose the entering variable (in a max problem) to be the nonbasic variable with the most negative coefficient in row 0 (ties may be broken in an arbitrary fashion). Because each one-unit increase of x 1 increases z by 60, we would like to make x 1 as large as pos- sible. What limits how large we can make x 1? Note that as x 1 increases, the values of the

142 C H A P T E R 4 The Simplex Algorithm and Goal Programming

current basic variables ( s 1 , s 2 , s 3 , and s 4 ) will change. This means that increasing x 1 may cause a basic variable to become negative. With this in mind, we look at how increasing x 1 (while holding x 2  x 3  0) changes the values of the current set of basic variables. From row 1, we see that s 1  48  8 x 1 (remember that x 2  x 3  0). Because the sign restriction s 1  0 must be satisfied, we can only increase x 1 as long as s 1  0, or 48  8 x 1  0, or x 1  488  6. From row 2, s 2  20  4 x 1. We can only increase x 1 as long as s 2  0, so x 1 must satisfy 20  4 x 1  0 or x 1  240  5. From row 3, s 3  8  2 x 1 so x 1  82  4. Similarly, we see from row 4 that s 4  5. Thus, whatever the value of x 1 , s 4 will be nonnegative. Summarizing,

s 1  0 for x 1 

s 2  0 for x 1 

s 3  0 for x 1 

s 4  0 for all values of x 1

This means that to keep all the basic variables nonnegative, the largest that we can make x 1 is min { 488 , 240 , 82 }  4. If we make x 1 4, then s 3 will become negative, and we will no longer have a basic feasible solution. Notice that each row in which the entering vari- able had a positive coefficient restricted how large the entering variable could become. Also, for any row in which the entering variable had a positive coefficient, the row’s ba- sic variable became negative when the entering variable exceeded

(10)

If the entering variable has a nonpositive coefficient in a row (such as x 1 in row 4), the row’s basic variable will remain positive for all values of the entering variable. Using (10), we can quickly compute how large x 1 can become before a basic variable becomes negative.

Row 1 limit on x 1 

Row 2 limit on x 1 

Row 3 limit on x 1 

Row 4 limit on x 1  no limit (Because coefficient of x 1 in row 4 is nonpositive)

We can state the following rule for determining how large we can make an entering variable.

The Ratio Test

When entering a variable into the basis, compute the ratio in (10) for every constraint in which the entering variable has a positive coefficient. The constraint with the smallest ra- tio is called the winner of the ratio test. The smallest ratio is the largest value of the en- tering variable that will keep all the current basic variables nonnegative. In our example, row 3 was the winner of the ratio test for entering x 1 into the basis.

Find a New Basic Feasible Solution:

Pivot in the Entering Variable

Right-hand side of row

  1. 5 The Simplex Algorithm 143
  1. 5 The Simplex Algorithm 145

Thus, canonical form 1 yields the basic feasible solution z  240, s 1  16, s 2  4, x 1  4, s 4  5, x 2  x 3  s 3  0. We could have predicted that the value of z in canonical form 1 would be 240 from the fact that each unit by which x 1 is increased increases z by

  1. Because x 1 was increased by 4 units (from x 1  0 to x 1  4), we would expect that

Canonical form 1 z -value  initial z -value  4(60)  0  240  240 In obtaining canonical form 1 from the initial canonical form, we have gone from one bfs to a better (larger z -value) bfs. Note that the initial bfs and the improved bfs are adjacent. This follows because the two basic feasible solutions have 4  1  3 basic variables ( s 1 , s 2 , and s 4 ) in common (excluding z , which is a basic variable in every canonical form). Thus, we see that in going from one canonical form to the next, we have proceeded from one bfs to a better adjacent bfs. The procedure used to go from one bfs to a better adjacent bfs is called an iteration (or sometimes, a pivot ) of the simplex algorithm. We now try to find a bfs that has a still larger z -value. We begin by examining canon- ical form 1 (Table 6) to see if we can increase z by increasing the value of some nonba- sic variable (while holding all other nonbasic variables equal to zero). Rearranging row 0  to solve for z yields

z  240  15 x 2  5 x 3  30 s 3 (11)

From (11), we see that increasing the nonbasic variable x 2 by 1 (while holding x 3  s 3 

  1. will decrease z by 15. We don’t want to do that! Increasing the nonbasic variable s 3 by 1 (holding x 2  x 3  0) will decrease z by 30. Again, we don’t want to do that. On the other hand, increasing x 3 by 1 (holding x 2  s 3  0) will increase z by 5. Thus, we choose to enter x 3 into the basis. Recall that our rule for determining the entering variable is to choose the variable with the most negative coefficient in the current row 0. Because x 3 is the only variable with a negative coefficient in row 0, it should be entered into the basis. Increasing x 3 by 1 will increase z by 5, so it is to our advantage to make x 3 as large as possible. We can increase x 3 as long as the current basic variables ( s 1 , s 2 , x 1 , and s 4 ) re- main nonnegative. To determine how large x 3 can be, we must solve for the values of the current basic variables in terms of x 3 (holding x 2  s 3  0). We obtain

From row 1: s 1  16  x 3 From row 2: s 2  4  0.5 x 3 From row 3: x 1  4  0.25 x 3 From row 4: s 4  5

These equations tell us that s 1  0 and s 4  0 will hold for all values of x 3. From row 2 , we see that s 2  0 will hold if 4  0.5 x 3  0, or x 3  (^04) .5  8. From row 3, x 1  0 will hold if 4  0.25 x 3  0, or x 3  (^) 0.^425  16. This shows that the largest we can make x 3 is min { (^04) .5 , (^) 0.^425 }  8. This fact could also have been discovered by using (10) and the ratio test, as follows:

Row 1: no ratio ( x 3 has negative coefficient in row 1)

Row 2: 0

Row 3:

Row 4: no ratio ( x 3 has a nonpositive coefficient in row 4)

Thus, the smallest ratio occurs in row 2, and row 2 wins the ratio test. This means that we should use EROs to make x 3 a basic variable in row 2.

ERO 1 Create a coefficient of 1 for x 3 in row 2 by replacing row 2 with 2(row 2):  2 x 2  x 3  2 s 2  4 s 3  8 (row 2  ) ERO 2 Create a coefficient of 0 for x 3 in row 0 by replacing row 0 with 5(row 2)  row 0: z  5 x 2  10 s 2  10 s 3  280 (row 0  ) ERO 3 Create a coefficient of 0 for x 3 in row 1 by replacing row 1 with row 2  row 1:  2 x 2  s 1  2 s 2  8 s 3  24 (row 1  ) ERO 4 Create a coefficient of 0 for x 3 in row 3, by replacing row 3 with  14 (row 2)  3 : x 1  1.25 x 2  0.5 s 2  1.5 s 3  2 (row 3  ) Because x 3 already has a zero coefficient in row 4, we may write x 2  s 4  5 (row 4  ) Combining rows 0– 4 gives the canonical form shown in Table 7. Looking for a basic variable in each row of canonical form 2, we find BV  { z , s 1 , x 3 , x 1 , s 4 } and NBV  { s 2 , s 3 , x 2 } Canonical form 2 yields the following bfs: z  280, s 1  24, x 3  8, x 1  2, s 4  5, s 2  s 3  x 2  0. We could have predicted that canonical form 2 would have z  280 from the fact that each unit of the entering variable x 3 increased z by 5, and we have increased x 3 by 8 units. Thus, Canonical form 2 z -value  canonical form 1 z -value  8(5)  240  40  280 Because the bfs’s for canonical forms 1 and 2 have (excluding z ) 4  1  3 basic vari- ables in common ( s 1 , s 4 , x 1 ), they are adjacent basic feasible solutions. Now that the second iteration (or pivot) of the simplex algorithm has been completed, we examine canonical form 2 to see if we can find a better bfs. If we rearrange row 0 and solve for z , we obtain z  280  5 x 2  10 s 2  10 s 3 (12) From (12), we see that increasing x 2 by 1 (while holding s 2  s 3  0) will decrease z by 5; increasing s 2 by 1 (holding s 3  x 2  0) will decrease z by 10; increasing s 3 by 1 (hold- ing x 2  s 2  0) will decrease z by 10. Thus, increasing any nonbasic variable will cause z to decrease. This might lead us to believe that our current bfs from canonical form 2 is

146 C H A P T E R 4 The Simplex Algorithm and Goal Programming

T A B L E 7 Canonical Form 2 Basic Row Variable 0  z  0.15 x 2  x 3  s 1  .10 s 2  .10 s 3  s 4  280 z  280 1  z 1  0.12 x 2  x 3  s 1  0.2 s 2  .38 s 3  s 4  24 s 1  24 2  z 1  0.12 x 2  x 3  s 1  0.2 s 2  .34 s 3  s 4  8 x 3  8 3  x 1  1.25 x 2  x 3  s 1  0.5 s 2  1.5 s 3  s 4  2 x 1  2 4  z 1  0.15 x 2  x 3  s 1  0.5 s 2  .30 s 3  s 4  5 s 4  5