simplex method STEPS WISE, Study notes of Computer Science

operation research lecture notes

Typology: Study notes

2017/2018

Uploaded on 05/04/2018

sunny-abbasi
sunny-abbasi 🇵🇰

5

(1)

2 documents

1 / 38

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
SUPPLEMENT CD3
The Simplex
Method
CD-227
In Chapters 3 and 4 we introduced linear programming
and showed how models with two variables can be solved
graphically. We relied on computer programs (WINQSB, Excel,
or LINDO) to generate optimal solutions and sensitivity anal-
yses for problems with more than two variables. The algorithm
used in each of these programs is a variant of the simplex
method, first developed by George Dantzig in 1947. In recent
years, much attention has been paid to a new technique known
as an
interior point algorithm
. While this algorithm has proven
successful for solving many types of large problems, the simplex
method remains the predominant method for solving most
problems. Here we present a review of what’s going on in the
simplex computer module of software packages.
ISTANDARD AND CANONICAL FORM
STANDARD FORM The simplex method for solving linear programming models requires that all functional
constraints be written as equalities so that elementary row operations—(1) multiplying equations
by positive or negative numbers and (2) adding multiples of one equation to other
equations—can systematically be performed without changing the set of feasible so-
lutions to the problem. The problem must also be expressed in nonnegative variables.
When these conditions are met, the problem is said to be in standard form.
Standard Form
A linear program is in standard form if all the functional constraints are written as equa-
tions and all the variables are required to be nonnegative.
Converting a Linear
Programming Formulation
to Standard Form
When a linear programming model is formulated, it will most likely include some in-
equality constraints and perhaps some variables that are not restricted to be nonneg-
ative. To achieve standard form, the following conversions are made:
1. ‘‘#’’ Constraints—Define a nonnegative slack variable (SI) to represent the difference
between the left side and the right side of the constraint. Then add SI to the right
side of the constraint to form an equation.
Example: 2X1 15X2 23X3 #120
Define S1 5the difference between 120 and 2X1 15X2 23X3
Result: 2X1 15X2 23X3 1S1 5120
2. ‘‘$’’ Constraints—Define a nonnegative surplus variable (SI) to represent the difference
between the right side and the left side of the constraint. Then subtract SI fromthe
right side of the constraint to form an equation.
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

Partial preview of the text

Download simplex method STEPS WISE and more Study notes Computer Science in PDF only on Docsity!

S U P P L E M E N T C D 3

The Simplex

Method

CD-

I

n Chapters 3 and 4 we introduced linear programming and showed how models with two variables can be solved graphically. We relied on computer programs (WINQSB, Excel, or LINDO) to generate optimal solutions and sensitivity anal- yses for problems with more than two variables. The algorithm used in each of these programs is a variant of the simplex method, first developed by George Dantzig in 1947. In recent

years, much attention has been paid to a new technique known as aninterior point algorithm. While this algorithm has proven successful for solving many types of large problems, the simplex method remains the predominant method for solving most problems. Here we present a review of what’s going on in the simplex computer module of software packages.

I S TANDARD AND CANONICAL FORM

STANDARD FORM The simplex method for solving linear programming models requires that all functional

constraints be written as equalities so that elementary row operations —(1) multiplying equations by positive or negative numbers and (2) adding multiples of one equation to other equations—can systematically be performed without changing the set of feasible so- lutions to the problem. The problem must also be expressed in nonnegative variables. When these conditions are met, the problem is said to be in standard form.

Standard Form

A linear program is in standard form if all the functional constraints are written as equa- tions and all the variables are required to be nonnegative.

Converting a Linear

Programming Formulation

to Standard Form

When a linear programming model is formulated, it will most likely include some in- equality constraints and perhaps some variables that are not restricted to be nonneg- ative. To achieve standard form, the following conversions are made:

1. ‘‘ # ’’ Constraints —Define a nonnegative slack variable (SI) to represent the difference between the left side and the right side of the constraint. Then add SI to the right side of the constraint to form an equation. Example: 2X1 1 5X2 2 3X3 # 120 Define S1 5 the difference between 120 and 2X1 1 5X2 2 3X Result: 2X1 1 5X2 2 3X3 1 S1 5 120 2. ‘‘ $ ’’ Constraints —Define a nonnegative surplus variable (SI) to represent the difference between the right side and the left side of the constraint. Then subtract SI from the right side of the constraint to form an equation.

Example: 6X1 2 5X2 1 4X3 $ 200 Define S1 5 the difference between 6X1 2 5X2 1 4X3 and 200 Result: 6X1 2 5X2 1 4X3 2 S1 5 200

3. XJ is restricted to a nonpositive variable —Define a new nonnegative variable XJ9 5 2 XJ and replace XJ by 2 XJ 9 in the formulation. 4. XJ is unrestricted (i.e., it can be positive, negative, or 0)—Define XJ 5 XJ9 2 XJ 0 where XJ 9 and XJ 0 are restricted to nonnegative variables and replace XJ in the formulation by XJ9 2 XJ 0.

Using these rules, let us convert the following linear programming formulation to one in standard form. Note that the value of I that we use for a slack or surplus variable corresponds to the position of the constraint in the formulation; that is, S1 is associated with the first constraint, S2 with the second, and so on.

MAX 2X1 1 5X2 2 4X3 1 8X ST X1 1 X2 1 3X3 2 2X4 $ 28 6X1 1 5X2 1 X4 5 30 7X1 2 2X2 1 4X3 # 25 X2 2 3X3 $ 1 X1, X4 $ 0, X2 unrestricted, X3 # 0

Now we define:

S1 5 Surplus variable for constraint 1 S3 5 Slack variable for constraint 3 S4 5 Surplus variable for constraint 4 X2 5 X29 2 X2 0 X3 5 2X3 9

Making these substitutions, the standard form is:

MAX 2X1 1 5X29 2 5X20 1 4X39 1 8X ST X1 1 X29 2 X20 2 3X39 2 2X4 2 S1 5 28 6X1 1 5X29 2 5X2 0 1 X4 5 30 7X1 2 2X29 1 2X20 2 4X3 9 1 S3 5 25 X29 2 X20 1 3X3 9 2 S4 5 1 X1, X2 9 , X2 0 , X3 9 , X4, S1, S3, S4 $ 0

CANONICAL FORM After slack and surplus variables have been added to the functional constraints, there

are typically more total variables (decision, slack, and surplus variables) than there are equations. When this occurs, there are usually an infinite number of possible solutions. Even so, it may be difficult to determine even one solution. For example, can you easily find a solution to the following three equations in six unknowns?

6X1 1 X2 1 2X3 1 5X4 1 X5 1 9X6 5 100 12X1 1 3X2 1 4X3 1 9X4 1 X5 1 23X6 5 170 3X1 1 X2 1 X3 1 7X4 1 X5 1 7X6 5 80

There is no immediately obvious solution to this system of equations. However, if a system of equations is written in canonical form , as defined below, a solution can easily be determined:

CD-228 SUPPLEMENT CD3 / The Simplex Method

In linear programming models, a feasible solution must satisfy not only the functional constraints, but also the nonnegativity constraints of the variables; that is, all variables must be greater than or equal to zero. A basic solution in which all the variables have nonnegative values is a basic feasible solution for the problem. In the basic solu- tion above, all the variables do have nonnegative values; thus, it is a basic feasible solution.

Basic Solutions and Basic Feasible Solutions

A basic solution for a system of equations in canonical form is obtained by setting the nonbasic variables to zero and the basic variables to the right-hand side values. A basic solution in which all the variables are greater than or equal to zero is a basic feasible solution.

Basic feasible solutions are important because of the following algebraic/geometric property for feasible regions generated by linear constraints:

Basic Feasible Solution/Extreme Point Equivalence

A basic feasible solution is equivalent to an extreme point of the feasible region of a linear constraint set, and vice versa.

Recall that, according to the extreme point property, if a linear program has an optimal solution, then an extreme point must be optimal. Thus, algebraically, if a linear program has an optimal solution, then a basic feasible solution must be optimal.

CD-230 SUPPLEMENT CD3 / The Simplex Method

II T ABLEAUS FOR MAXIMIZATION PROBLEMS WHEN ALL

FUNCTIONAL CONSTRAINTS ARE ‘‘ # ’’ CONSTRAINTS

The simplex method performs elementary row operations on functional constraints writ- ten in canonical form. In the discussion that follows, we outline the simplex method for problems with a maximization objective function and all ‘‘#’’ functional constraints. (Problems with other structures are discussed later in this supplement.) We illustrate the approach by considering the model for Galaxy Industries presented in Chapter 3 of the text. For this problem, the linear programming model is: X1 5 dozens of Space Rays produced in the production run X2 5 dozens of Zappers produced in the production run MAX 8X1 1 5X2 (Profit) ST 2X1 1 X2 # 1200 (Plastic) 3X1 1 4X2 # 2400 (Production Time) X1 1 X2 # 800 (Total Production) X1 2 X2 # 450 (Mix) X1, X2 $ 0

We define: S1 5 the amount of unused plastic S2 5 the amount of unused production time S3 5 the amount by which total production falls below 800 dozen S4 5 the amount by which the difference in production of Space Rays and Zappers falls below 450 dozen The standard form for the Galaxy Industries model is then: MAX 8X1 1 5X2 (Profit) ST 2X1 1 X2 1 S1 5 1200 (Plastic) 3X1 1 4X2 1 S2 5 2400 (Production Time) X1 1 X2 1 S3 5 800 (Total Production) X1 2 X2 1 S4 5 450 (Mix) All XJ $ 0 and all SJ $ 0 As you can see, since the slack variables S1, S2, S3, and S4 comprise a set of basic variables, this standard form is also a canonical form. In fact, canonical form always results from adding slack variables to a model in which all the functional constraints are ‘‘#’’ constraints. The initial basic feasible solution, found by setting the nonbasic variables X1 and X2 to 0, is X1 5 0, X2 5 0, S1 5 1200, S2 5 2400, S3 5 800, and S4 5 450. Since X1 5 0, X2 5 0 yields an objective function value of zero, hopefully this is not the optimal solution. The simplex method operates by performing elementary row operations on this set of equations to generate an equivalent set of equations that is also in canonical form. It then determines if the basic feasible solution for this equivalent set of equations is optimal; if it is not, it repeats the process. One efficient way to keep track of the equations and other relevant information utilized in the simplex method is through the use of a matrix (similar to a spreadsheet) called the simplex tableau. Different software packages format the simplex tableau differ- ently. Here we present one similar to that used by WINQSB. Instructions for constructing a simplex tableau are illustrated in Figure CD3.1.

II Tableaus for Maximization Problems When All Functional Constraints Are ‘‘#’’ Constraints CD-

Names of variables BASIS CJ Objective function coefficients BI

Left side of constraints

Sum of (each column) x (CJ column)

Names of the basic variables Sum of (RHS column) x (CJ column)

Ojective function coefficients of the corresponding basic variables

ZJ CJ 2 ZJ Subtract ZJ row from CJ row

Right side of constraints

FIGURE CD3.1 Constructing a Tableau

The simplex tableau for the initial canonical form for the Galaxy Industries problem is given in Figure CD3.2. Let us analyze the information contained in this tableau.

increases by one unit, S1 decreases by two, S2 decreases by three, S3 decreases by one, and S4 decreases by one. These are the numbers found in the X1 column. Thus, we can interpret the numbers in the main body of the tableau as follows:

Interpretation of Numbers in the Body of the Tableau

The numbers in the column of a nonbasic variable provide the amount the correspond- ing basic variables will decrease given a one-unit increase in that nonbasic variable.

Hypothetical ZJ Calculation Now, suppose, hypothetically, that the objective function coefficients for S1, S2, S3, and S4 were 2, 1, 0, and 3, respectively ( they are not but suppose they were ). In this case, the two-unit decrease in S1 reduces the objective function value by 2(2) 5 $4; the three-unit decrease in S2 reduces the objective function by 3(1) 5 $3; the one-unit decrease in S3 decreases it by 1(0) 5 $0; and the one-unit decrease in S decreases it by 1(3) 5 $3. The total gross decrease in profit is $4 1 $3 1 $0 1 $3 5 $10; this becomes the ZJ entry in the X1 column. Table CD3.1 summarizes the calcula- tions.

Table CD3.1 (HYPOTHETICAL) CALCULATION OF THE ZJ VALUE FOR X

Basic Variable

Amount Decreased (X1 Column)

(Hypothetical) Profit Loss per Unit (CJ Column)

Total Profit Loss (X1 3 CJ) S1 2 $2 $ S2 3 $1 $ S3 1 $0 $ S4 1 $3 $ Total per Unit Decrease (ZJ Value) 5 $

Actual ZJ calculation for the original tableau The actual objective function coefficients for S1, S2, S3, and S4 in the first tableau are not 2, 1, 0, and 3, respectively, but 0, 0, 0, and 0. Thus, the actual ZJ calculation for X1 in the first tableau is shown in Table CD3.2. These data verify the ZJ entry for X1 of 0 in the original tableau. To calculate the ZJ value for another variable, we would simply perform the same calculation using the column of that variable in place of the X1 column. In this tableau, there is no gross decrease in the value of the objective function for any variable (the ZJs are all 0).

Table CD3.2 (ACTUAL) CALCULATION OF THE ZJ VALUE FOR X

Basic Variable

Amount Decreased (X1 Column)

Profit Lost per Unit (CJ Column)

Total Lost Profit (X1 3 CJ) S1 2 $0 $ S2 3 $0 $ S3 1 $0 $ S4 1 $0 $ Total per Unit Decrease (ZJ Value) 5 $

The entry in the BI column of the ZJ row is obtained the same way as are the other ZJ values. Since the CJ column gives the objective function coefficients of the basic variables and the BI column gives the value of the basic variables, this entry gives the

II Tableaus for Maximization Problems When All Functional Constraints Are ‘‘#’’ Constraints CD-

value of the objective function for the basic feasible solution associated with this tableau. Because the basic feasible solution for this first tableau shows X1 5 0 and X2 5 0, the objective function value for this solution is 0.

The CJ-ZJ Row The CJ row provides the gross per unit increase in the value of the objective function when

each variable is increased, and the ZJ row gives the corresponding gross per unit decrease in the value of the objective function when each variable is increased. The difference between the per unit gross increase and the per unit gross decrease is the net effect on the value of the objective function as each variable is increased by one unit. The net effect on the objective function of increasing X1 by one unit is $8; for X2 it is $5; and so on. Note that the CJ-ZJ value for all basic variables is 0.

Meaning of CJ, ZJ, and CJ-ZJ Rows

for Maximization Problems

CJ Value The gross increase in the value of the objective function, given a one-unit increase in that variable. ZJ Value The gross decrease in the value of the objective function given a one-unit increase in that variable. CJ-ZJ Value The net effect on the value of the objective function, given a one-unit increase in that variable.

(For minimization problems, the CJ value gives the gross decrease and the ZJ value gives the gross increase to the value of the objective function, given a one-unit increase in the variable. The CJ-ZJ value still gives the net effect of the change.)

Figure CD3.3 summarizes the meaning of each number in a simplex tableau.

CD-234 SUPPLEMENT CD3 / The Simplex Method

X

Increase in the objective function when X2 increases by one unit

Decrease in the objective function when X2 increases by one unit

Net effect on objective function when X2 increases by one unit

Current value of the objective function

Current value of S

Basic variable for the second constraint

Objective coefficient for S

Amount S2 decreases when X2 increases by one unit.

X2 S1 S2 S3 S BASIS CJ 8 5 0 0 0 0 BI S1 0 2 1 1 0 0 0 1200 S2 0 3 4 0 1 0 0 2400 S3 0 1 1 0 0 1 0 800 S4 0 1 21 0 0 0 1 450 0 0 0 0 0 0 8 5 0 0 0 0

ZJ 0 CJ 2 ZJ

FIGURE CD3.3 Meaning of all Entries in a Tableau

quickly. 2 If two or more variables have the same largest positive CJ-ZJ value, the entering variable can be selected arbitrarily from them.

STEP 2: DETERMINE

THE MAXIMUM

INCREASE FOR THE

ENTERING VARIABLE

As we have seen, if X1 increases by one unit, S1 decreases by two units. Thus, if X increases by 30 units, S1 decreases by 30(2) 5 60 units to 1200 2 60 5 1140; if X increases by 100 units, S1 decreases by (100)(2) 5 200 units to 1200 2 200 5 1000. Since the value of S1 is currently 1200, the ratio 1200/2 5 600 is the maximum increase in X1 possible before S1 reaches 0. If X1 increases by more than 600, S1 becomes negative, which is not permitted. Similar reasoning indicates the following: Equation Ratio Interpretation 1 1200/2 5 600 Maximum value of X1 before S1 reaches 0 2 2400/3 5 800 Maximum value of X1 before S2 reaches 0 3 800/1 5 800 Maximum value of X1 before S3 reaches 0 4 450/1 5 450 Maximum value of X1 before S4 reaches 0 Since no variable, including S1, S2, S3, or S4 can have a negative value, the maximum value that X1 can take on at this time, before some basic variable reaches zero, is the minimum ratio of 450. When X1 5 450, the current basic variable, S4, is the first basic variable to reach zero. This variable is called the leaving variable because it will leave the set of basic variables at the next iteration. The current row corresponding to the leaving variable is called the leaving , or pivot row. In this case, there are no negative or zero entries in the X1 column. If there had been a negative entry inthe X1 column in a particular row, the corresponding basic variable would increase (not decrease) as X1 increases. Similarly, if there had been a zero entry in the X1 column in a particular row, the corresponding basic variable would have remained unchanged (rather than decrease) as X1 increases. Neither of these cases imposes limits on the maximum value of X1. Hence, this ratio test is applied only to positive numbers in the entering column. We can express the process for selecting the leaving variable in Step 2 as follows:

Step 2: How Far Can the Entering Variable Be Increased?

Find the minimizing ratio between the right-hand side values and positive entries in the entering column.

STEP 3: GENERATE AN

EQUIVALENT SYSTEM

OF EQUATIONS WITH

A NEW BASIS

REPRESENTATION

Since only basic variables can be positive (nonbasic variables are set to zero), we need a new canonical form representation for the equations in which the entering variable replaces the leaving variable as a basic variable. The goal is to make the new column of the entering variable (the pivot column) all zeros, except for a 1 1 in the row corre- sponding to the row of the leaving variable (the pivot row), as shown in Figure CD3.4. The current value of the entry that we wish to make 1 1 is the number that is in both the pivot row and pivot column; it is called the pivot element. Thus, at this stage, we wish to generate a new tableau in which all of the entries in the X1 column (the pivot column) are zeros, except for a 1 1 in the fourth row (since S4 is the leaving variable). To accomplish this, we employ the elementary row operations in the following sequence.

CD-236 SUPPLEMENT CD3 / The Simplex Method

(^2) This concept is illustrated in Problem 4 at the end of this supplement.

1. Generate a ‘‘ 1 1’’

in the pivot row

It just so happens that in this first tableau, there is already a 1 1 entry for X1 in the pivot row; that is, the pivot element is a 1. But if the pivot element had been a ‘‘5,’’ say, dividing the pivot row through by 5 would generate a row with a 1 1 entry in the X column. Thus, to ‘‘get the 1’’ in the pivot row, we divide the pivot row by the pivot element. We designate the new row generated as a result of this division as the ‘‘p’’ row, in a new tableau as shown in Figure CD3.5.

Entries in X column of current tableau

Entries in X column of next tableau

Pivot 1 element "*" Row

1

3

2

1

0

0

0

FIGURE CD3.4 Goal of Elementary Row Operations

III The Simplex Algorithm CD-

X1 X2 S

Generate the "*"row

Get a "1" in the position of the pivot element by dividing the pivot row by the pivot element

S2 S3 S BASIS CJ 8 5 0 0 0 0 BI S1 0 2 1 1 0 0 0 1200 S2 0 3 4 0 1 0 0 2400 S3 0 1 1 0 0 1 0 800 S4 0 1 21 0 0 0 1 450 0 0 0 0 0 0 8 5 0 0 0 0

0

Ratio 600 800 800 450 ZJ^0 CJ 2 ZJ

Pivot row

X1 X2 S1 S2 S3 S BASIS CJ 8 5 0 0 0 0 BI

1 21 0 0 0 1 450 (*) ZJ CJ 2 ZJ

FIGURE CD3.5 Generating the ‘‘p’’ Row

2. Generate the ‘‘0s’’

in the other rows

Consider the first equation row. If there is already a ‘‘0’’ in that row, we simply copy the row into the new tableau. Since the coefficient in the first row is a ‘‘2,’’ however, we can make this coefficient a ‘‘0’’ in the new tableau by another elementary row operation. Recall that an equivalent system of equations is generated if a multiple of one row is added to or subtracted from another row. Since there is now a ‘‘1’’ in the pivot column of the ‘‘p’’ row in the new tableau, we can generate a ‘‘0’’ in the pivot column for the first equation by subtracting 2 times the ‘‘p’’ row from the current row. This is illustrated in Figure CD3.6.

The set of steps in the simplex algorithm can now be summarized as follows:

Simplex Algorithm (For Maximization Problems):

The Mechanics

1. Find the most positive entry in the CJ-ZJ row; this is the entering variable. If there are no positive entries, STOP; the current solution is optimal. 2. Find the minimizing ratio between the RHS values and positive entries in the en- tering column; this is the leaving variable. 3. a. Divide pivot row by pivot element to get the ‘‘p’’ row for the next tableau. b. For other rows : Multiply this ‘‘p’’ row by the current pivot column value and subtract the result from the current row. c. Replace the leaving variable by the entering variable in the BASIS column and enter its CJ coefficient in the BASIS CJ column. Calculate the ZJ value for each column by summing the products of the BASIS CJ entries and the corresponding entry in the column. Calculate the CJ-ZJ row by subtracting the ZJ row entries from the CJ row entries. Then go back to Step 1

Each repetition of these steps is an iteration of the algorithm. The tableau we gener- ated above by replacing S4 with X1 as a basic variable is the tableau for the second iter- ation. Note that, at this point, the solution is now X1 5 450, X2 (nonbasic) 5 0, S1 5 300, S2 5 1050, S3 5 350, S4 (nonbasic) 5 0, yielding an objective function value of 3600.

X1 X2 S

  1. Write the current second row :
  2. Multiply "*" row by 3 :
  3. Subtract (1) 2 (2) : Goal is to get "0" here

S2 S3 S BASIS CJ 8 5 0 0 0 0 BI S1 0 2 1 1 0 0 0 1200 S2 0 3 4 0 1 0 0 2400

3 4 0 1 0 0 2400 3 23 0 0 0 3 1350 0 7 0 1 0 23 1050

  1. Write the current third row :
  2. Multiply "*" row by 1 :
  3. Subtract (1) 2 (2) : Goal is to get "0" here

1 1 0 0 1 0 800 1 21 0 0 0 1 450 0 2 0 0 0 21 350

S3 0 1 1 0 0 1 0 800 S4 0 1 21 0 0 0 1 450 0 0 0 0 0 0 8 5 0 0 0 0

0

Ratio 600 800 800 450 ZJ CJ 2 ZJ

Pivot row

X1 X2 S1 S2 S3 S BASIS CJ 8 5 0 0 0 0 BI S1 0 0 3 1 0 0 22 300 S2 0 0 7 0 1 0 23 1050 S3 0 0 2 0 0 1 21 350 X1 8 1 21 0 0 0 1 450 8 28 0 0 0 8 0 13 0 0 0 28

ZJ^3600 CJ 2 ZJ

FIGURE CD3.7 Generating the ‘‘0’’ in the Second and Third Equations

III The Simplex Algorithm CD-

SUBSEQUENT

ITERATIONS

We will do one additional iteration for the Galaxy Industries problem in detail. In Figure CD3.7, the tableau for the second iteration, the most positive CJ-ZJ value is 13. This corresponds to the X2 column; hence, X2 is the entering variable. The ratios for Step 2 are determined by dividing the right-hand side values by the numbers in the X2 column. These ratios for the first three rows are 300/3 5 100, 1050/7 5 150, and 350/2 5 175, respectively. No ratio is determined for the fourth row because its value in the pivot column is a negative number ( 2 1). Since the minimizing ratio is 100, S1 is the leaving variable and the first row is the ‘‘p’’ row in the next tableau. The pivot element, found at the intersection of the entering column and leaving row, is 3. To generate the ‘‘p’’ row for the next tableau, we divide the first row of the current tableau by the pivot element, (3). The resulting iteration is illustrated in Figure CD3.8.

CD-240 SUPPLEMENT CD3 / The Simplex Method

X1 X2 S1 S2 S3 S BASIS CJ 8 5 0 0 0 0 BI S1 0 0 3 1 0 0 22 300 S2 0 0 7 0 1 0 23 1050 S3 0 0 2 0 0 1 21 350 X1 0 1 21 0 0 0 1 450 8 28 0 0 0 8 0 13 0 0 0 28

3600

Ratio 100

BI (*)

(min) 150 175

ZJ

Divide pivot row (first row) by pivot element (3) to get "*" row

CJ 2 ZJ

X1 X2 S1 S2 S3 S BASIS CJ 8 5 0 0 0 0 (^0 1 1) / 3 0 0 22 / 3 100

ZJ CJ 2 ZJ

FIGURE CD3.8 Iteration 2: Generating The ‘‘*’’ Row

The remainder of the equations are found by multiplying this ‘‘p’’ row by the current entry in the X2 column for each row and subtracting the result from the current row entries. Thus, the new second row is generated by subtracting 7 times the ‘‘p’’ row from the current second row; the new third row by subtracting 2 times the ‘‘p’’ row from the current third row; and the new fourth row by subtracting 2 1 times the ‘‘p’’ row from the current fourth row (or alternatively, adding 1 1 times the ‘‘p’’ row to the current fourth row). Then, X2 replaces S1 in the BASIS column, its CJ value of 5 is entered next to it in the BASIS CJ column, and the ZJ row and the CJ-ZJ rows are calculated. These calculations are shown in detail in Figure CD3.9, the tableau to begin the next iteration. The basic feasible solution associated with this tableau is X1 5 550, X2 5 100, S1 (nonbasic) 5 0, S2 5 350, S3 5 150, and S4 (nonbasic) 5 0. The objective function value is 4900. To do the third iteration, we note that the most positive CJ-ZJ value in Figure CD3.

is 2 ”; therefore, S4 is the entering variable. We determine the ratios for Step 2 by dividing

the right-hand side values by the corresponding positive values in the S4 column; no

ratio is calculated for the first row since its pivot column element ( 22 ”) is negative. The

steps for this iteration are shown in Figure CD3.10.

The basic feasible solution associated with this tableau is X2 5 240, S4 5 210, S 5 80, X1 5 480, and the nonbasic variables, S1 5 0, and S2 5 0. The value of the objective function is 5040. Since there are no positive CJ-ZJ values in Figure CD3.10, the algorithm is terminated and we conclude that the above solution is optimal. Note that the result, X1 5 480, X2 5 240, coincides with the result we derived graphically in Chapter 3.

IV G EOMETRIC INTERPRETATION OF THE SIMPLEX ALGORITHM

The simplex algorithm evaluates an extreme point (basic feasible solution) and deter- mines if it is optimal. If it is determined that the solution is not optimal, then the algorithm evaluates an adjacent extreme point (basic feasible solution) that provides a better value for the objective function and determines if that point is optimal. This process continues until an optimal extreme point (basic feasible solution) is found. The extreme points generated by the simplex method for the Galaxy Industries problem in the previous section were: Iteration 1: X1 5 0, X2 5 0 Objective Function: 0 Iteration 2: X1 5 450, X2 5 0 Objective Function: 3600 Iteration 3: X1 5 550, X2 5 100 Objective Function: 4900 Iteration 4: X1 5 480, X2 5 240 Objective Function: 5040 As indicated in Figure CD3.11, these iterations generate a set of adjacent extreme points.

CD-242 SUPPLEMENT CD3 / The Simplex Method

100 200 300 400 500 600 700 800

100

200

300

400

500

600

700

800

900

1000

1100

1200

X

X

X (^1) (^) X (^) # (^) 800 (Total)

3X (^1) 4X (^) # (^) 2400 (Production time)

X

2

X

450 (Mix)

(0, 600)

2X (^1) (^) 1X (^) # (^) 1200 (Plastic)

Iteration 4 (480, 240)

Iteration 3 (550, 100)

Iteration 2 (450, 0)

Iteration 1 (0, 0)

(480, 240)

(0, 0) (480, 240)

(550, 100)

FIGURE CD3.11 Sequence of Extreme Points Generated by the Simplex Algorithm for the Galaxy Industries Problem

V T HE SIMPLEX METHOD WHEN SOME FUNCTIONAL

CONSTRAINTS ARE NOT ‘‘ # ’’ CONSTRAINTS

Suppose we wish to solve the following linear programming model: MAX 16X1 1 15X2 1 20X3 2 18X ST 2X1 1 X2 1 3X3 # 3000 3X1 1 4X2 1 5X3 2 60X4 # 2400 X4 # 32 X2 $ 200 X1 1 X2 1 X3 $ 800 X1 2 X2 2 X3 5 0 XJ $ 0 for all J To convert all constraints to equalities, we must first add slack variables S1, S2, and S to the first three ‘‘#’’ constraints and subtract surplus variables S4 and S5 from the left side of the fourth and fifth constraints, respectively. The sixth constraint is already an equation; thus, it does not require the addition of any variables. The result of these operations is the following standard form for this model: MAX 16X1 1 15X2 1 20X3 2 18X ST 2X1 1 X2 1 3X3 1 S1 5 3000 3X1 1 4X2 1 5X3 2 60X4 1 S2 5 2400 X4 1 S3 5 32 X2 2 S4 5 200 X1 1 X2 1 X3 2 S5 5 800 X1 2 X2 2 X3 5 0 XJ $ 0, SJ $ 0 for all J As you can see, however, this standard form is not in canonical form. While the S1, S2, and S3 columns have the appropriate structure for the first, second, and third functional constraints, the other three constraints do not include a variable that appears only in that constraint and has a coefficient of ‘‘ 1 1.’’ A ‘‘ 2 1’’ coefficient, such as S4 and S5, in the fourth and fifth constraints, does not meet this requirement. Since the simplex algorithm requires canonical form to perform its operations, we can employ a mathematical ‘‘trick’’ to jumpstart the problem. We add artificial variables (AI’s) to the equations that do not currently have a basic variable. Thus we add artificials A4, A5, A6, respectively, to the fourth, fifth, and sixth equations. These artificial vari- ables, along with S1, S2, and S3, then serve as the first set of basic variables for the simplex method. Hence, artificial variables are added to constraints that were initially ‘‘ $ ’’ con- straints or ‘‘ 5 ’’ constraints. These artificial variables do not really exist, however, and as long as any artificial variable is positive, the corresponding solution is not really a feasible solution for the original problem. Thus, in addition to maximizing the objective function, we must also drive all the artificial variables to zero. These two goals can be merged into one by assigning a very large negative objective function coefficient, 2 M, ( 1 M for minimization problems) to each artificial variable. 3 The idea is that, since M is a very large number (close to infinity), if the value of some corresponding artificial variable, AJ, is even the least bit positive, its contribution to the objective function, 2 M(AJ), is such a large negative number that it is effectively consid- ered negative infinity.

V The Simplex Method When Some Functional Constraints Are Not ‘‘#’’ Constraints CD-

(^3) An alternative method that treats the two goals separately is illustrated in Problem 9 at the end of this supplement.

Figures CD3.12 ad are the series of tableaus generated by the simplex algorithm to reach the optimal solution. In these tableaus, since M is a very large number, the variable with the largest positive coefficient for M in the CJ-ZJ row is selected as the entering variable.

V The Simplex Method When Some Functional Constraints Are Not ‘‘#’’ Constraints CD-

X1 X2 S1 S2 A1 A BASIS CJ (^2 5 0 0 2) M 2 M BI A1 2 M 1 0 21 0 1 0 4 S2 0 1 4 0 1 0 0 32 A3 2 M 3 2 0 0 0 1 24

Ratio 4 (min) 32 8 2 2M M 0 2 M 2 M 51 2M

2 4M 21 4M 2 M 0 0 0

ZJ^2 28M CJ 2 ZJ

FIGURE CD3.12a Iteration 1

X1 X2 S1 S2 A1 A BASIS CJ 2 5 0 0 2 M 2 M BI X1 2 1 0 21 0 1 0 4 * S2 0 0 4 1 1 21 0 28 A3 2 M 0 2 3 0 23 1 12

Ratio

32 4 (min) 2 2M 0 21 3M 2 M 51 2M

2 0 0 222 4M

222 3M 21 3M 0

ZJ^82 12M CJ 2 ZJ

FIGURE CD3.12b Iteration 2

X1 X2 S1 S2 A1 A BASIS CJ 2 5 0 0 2 M 2 M BI X1 (^2 1 2) / 3 0 0 0 1 / 3 8 S2 (^0 0 10) / 3 0 1 0 21 / 3 24 S1 (^0 0 2) / 3 1 0 21 1 / 3 4 *

Ratio 12 (^72) / 10 6 (min) (^4) / 3 0 0 2 / 3 (^0 11) / 3 0

2 0 0 2 M 2 M (^22) / 3

ZJ^16 CJ 2 ZJ

FIGURE CD3.12c Iteration 3

X1 X2 S1 S2 A1 A BASIS CJ (^2 5 0 0 2) M 2 M BI X1 2 1 21 0 1 4 S2 0 0 25 1 5 22 4 * 0

0 0 X2 (^5 1 3) / 2 0 23 / 2 1 / 2 6 (^0 211) / 2 5 / 2 0 0

(^211) / 2 0

5 (^211) / 2 2 M (^111) / 2 2 M (^25) / 2

ZJ^38 CJ 2 ZJ

0

FIGURE CD3.12d Iteration 4

The tableaus generated the following sequence of points:

Iteration Point Classification Reason 1 X1 5 0, X2 5 0 Not feasible A1 and A3 are both positive 2 X1 5 4, X2 5 0 Not feasible A3 is positive 3 X1 5 8, X2 5 0 Feasible but not optimal CJ-ZJ for X2 is positive 4 X1 5 4, X2 5 6 Feasible and optimal All CJ-ZJ # 0 This model is depicted graphically in Figure CD3.13. Since the third constraint is the equality 3X1 1 2X2 5 24, the feasible region is only the line segment of 3X1 1 2X2 5 24 between (8,0) and (4,6). The sequence of points generated by the simplex algorithm en route to the optimal solution is highlighted. Notice that the points corresponding to the first two iterations—(0,0) and (4,0)—each lie at the intersection of two constraint boundaries. These are basic solutions but not basic feasible solutions (extreme points), since they violate some constraints of the problem. The third basic solution generated (8,0) is an extreme point (basic feasible solution), but it is not optimal. The last point, (4,6), is the optimal extreme point (basic feasible solution) for the problem.

CD-246 SUPPLEMENT CD3 / The Simplex Method

0 2 4 6 8 10 12 14 16

2

4

6

8

10

12

X

X 3X (^1) (^) 2X (^5) (^24)

X1 (^1) (^) 4X

32

(0,0) (4,0)

(4,6)

(8,0)

Iteration 3 (8,0) feasible

Iteration 1 (0,0) infeasible

Iteration 2 (4,0) infeasible

Iteration 4 (4,6) feasible and optimal

X1 # 4

FIGURE CD3.13 Sequence of Points Generated by the Simplex Algorithm

VI S IMPLEX ALGORITHM—SPECIAL CASES

In Chapter 3, we introduced graphically the concepts of minimization problems, un- bounded linear programs, infeasible linear programs, alternative optimal solutions, and degeneracy. Here we discuss each in the context of the simplex algorithm.

MINIMIZATION

PROBLEMS

Regardless of whether a problem has a maximization or a minimization objective func- tion, the CJ-ZJ row shows the net effect on the objective function of increasing each variable by one unit. A negative CJ-ZJ value for a variable implies that increasing the variable decreases the value of the objective function. Since this is precisely the objective in minimization problems, the only modification to the simplex algorithm is to select the most negative CJ-ZJ value in Step 1, instead of the most positive value. The algorithm terminates, and the optimal solution is found when all the CJ-ZJ values are nonpositive. This is the approach we will use in our discussions.^4

(^4) Note : An alternative approach is first to multiply the minimization objective function by 2 1 and leave Step 1 as it is, finding the variable with the most positive CJ-ZJ. If we use this approach, then, when the optimal solution is found, we must multiply the objective function value by 2 1 to obtain the correct value for the minimization problem.