Contents  |  ‹ Previous  |  Next ›  |  Download EPUB  |  PDF

Chapter 7
Simplex Method

Learning Outcomes

Picture hiking to the highest point of a fenced field on a moonless night. Your flashlight shows only the ground at your feet: the corner you are standing on and the fence lines leading away from it. A sensible strategy suggests itself: shine the light along each fence line; if one leads uphill, follow it to the next corner and look again; if none does, stop. The remarkable fact of this chapter is that for linear programs this nearsighted strategy is guaranteed to end at the highest point of the entire field. The algebra of “shining the flashlight” is a reformulation of the linear program called a dictionary.

In this section, we will develop the Simplex Method. This algorithm has been lauded as one of the most important algorithms of the 20th century. It will iteratively find better vertex solutions to a linear program until it can prove optimality.

To implement the simplex algorithm, we must first discuss a Standard Form with which to represent linear programs. After, we will discuss structure of linear programs in this form using matrix notation and demonstrate how a linear program can be transformed to new representations. These new representations will be the backbone of the simplex algorithm. We will pivot between vertices, and each vertex will have a new representation of the linear program that will help us understand how to choose a new vertex to move to.

The whole algorithm runs very fast in practice. Here, we will teach you a basic version of the algorithm, but note that state-of-the-art solvers will employ a number of tricks to make this process very fast. Linear programs can be solved with millions of variables!

7.1 Standard Form

To solve a linear program using methods such as the simplex algorithm, the problem must first be converted to a standard form. This ensures the problem adheres to a uniform structure, making it easier to analyze and solve algorithmically.

A linear program is in standard form if it satisfies all of the following:

Definition 7.1: Standard Form

A linear program is in standard form if it is written as

max cx s.t. Ax = b x 0.

7.1.1 Converting to Standard Form

We now describe how to handle each of these aspects step-by-step, including common subcases and examples.

1. Objective: Convert Minimization to Maximization

If the linear program is given as a minimization, we convert it into a maximization by multiplying the objective function by 1. This transformation does not affect the feasible region, and the maximizer of the new function will be the minimizer of the original.

Example 7.2: Convert Min to Max

Consider the following objective:

min 3x1 + 4x2.

To convert this to a maximization, we multiply the entire expression by 1:

max (3x1 4x2).

Now the problem can be treated using standard methods that assume a maximization objective.

2. Constraints: Convert Inequalities to Equalities

All inequality constraints must be transformed into equalities using slack or surplus variables, which represent the difference between the left- and right-hand sides of the constraint.

3. Variable Bounds: Ensure All Variables Are Nonnegative

The standard form requires all variables to satisfy xi 0. If any variable is unbounded below or is restricted in another way, we perform a variable substitution to enforce this condition.

After performing these transformations, the resulting linear program will be in standard form and ready for solution via the simplex method or other standard techniques.

Example 7.7: Complete Conversion to Standard Form

Consider the following linear program:

min 2x1 3x2 + x3  s.t. x1 x2 4, 2x1 + x3 = 7, x2 x3 2, x1 is unrestricted,x2 0,x3 is unrestricted.

We will now convert this problem into standard form.

Step 1: Convert the objective to maximization.

Since the problem is a minimization, we multiply the objective by 1:

max (2x1 + 3x2 x3).

Step 2: Replace unrestricted variables.

Both x1 and x3 are unrestricted. We express them as the difference of two nonnegative variables:

x1 = x1+ x 1,x 3 = x3+ x 3,with x 1+,x 1,x 3+,x 3 0.

Substitute these into the objective and constraints.

New objective:

max [2(x1+x 1)+3x 2(x3+x 3)] = max (2x 1++2x 1+3x 2x3++x 3).

New constraints:

(x1+ x 1) x 2 4 (original 1st constraint) 2(x1+ x 1) + (x 3+ x 3) = 7 (original 2nd constraint) x2 (x3+ x 3) 2 (original 3rd constraint)

Step 3: Convert inequalities to equalities.

Final standard form:

max 2x1+ + 2x 1 + 3x 2 x3+ + x 3  s.t.  x1+ x 1 x 2 + s1 = 4 2x1+ 2x 1 + x 3+ x 3 = 7 x2 x3+ + x 3 s 2 = 2 x1+,x 1,x 2,x3+,x 3,s 1,s2 0.

This is now in standard form: a maximization problem with equality constraints and all variables nonnegative.

Remark. Variable Transformations Preserve Solution Meaning To convert a linear program into standard form, we often introduce new variables:

These transformations may change the number of variables and the way solutions are expressed, but:

1.
Every feasible solution to the transformed problem corresponds to a feasible solution of the original problem.
2.
Every optimal solution of the transformed problem yields an optimal solution to the original.

Thus, while the form of the solution may look different, the meaning and the value of the solution are preserved.

Two-row diagram: Original LP (min or max, unrestricted variables, inequalities) connected by arrows labeled 'variable transformations / interpret in original space' to Transformed LP in Canonical Form (max, all equalities, variables >= 0); below, Solution to Original LP is connected to Solution to Transformed LP by 'encode to canonical form / map back (e.g., x_j = x_j-plus minus x_j-minus)'.

Figure 7.1: Correspondence between original and canonical form solutions.

Example 7.8: Transformation Preserves Solution Meaning

Consider the following linear program:

min x1 + 2x2 3x3  s.t. x1 x2 + x3 2, x2 0, x3 unrestricted.

Step 1: Convert to maximization.

Multiply the objective by 1:

max x1 2x2 + 3x3.

Step 2: Convert variables to be nonnegative.

Substitute into the objective and constraint:

max x1 2(x2) + 3(x 3+ x 3) = x 1 + 2x2 + 3x 3+ 3x 3.
Constraint: x1 + x2 + x 3+ x 3 2.

Step 3: Convert constraint to equality using a surplus variable.

Introduce surplus variable s1 0:

x1 + x2 + x 3+ x 3 s 1 = 2.

Now the problem is in standard form:

max x1 + 2x2 + 3x 3+ 3x 3  s.t.  x1 + x2 + x 3+ x 3 s 1 = 2, x1,x2,x 3+,x 3,s 1 0.

Example 7.9: Example Continued

Step 4: Example solution in standard form.

Consider a solution of the canonical form

x1 = 1,x2 = 0,x 3+ = 1,x 3 = 0,s 1 = 0.

Step 5: Map solution back to original variables.

x2 = x2 = 0,x 3 = x3+ x 3 = 1.

So the solution to the original problem is:

x1 = 1,x2 = 0,x3 = 1,

and the original objective value is:

1(1) + 2(0) 3(1) = 4.

Conclusion: The transformation allowed us to solve the LP using standard techniques, and we were able to directly interpret the solution in the space of the original variables. The solution meaning is preserved.

7.1.2 Basic Feasible Solutions for Standard Form

Consider a linear program in standard form:

max cx  s.t.  Ax = b, x 0,

where A m×n, b m, and c n.

We assume throughout that:

Definition 7.10: Basic Feasible Solution

A vector x n is called a basic feasible solution (BFS) if:

1.
It satisfies all the constraints of the LP (i.e., it is feasible),
2.
It has at most m positive components (i.e., n m components are set to zero),
3.
These positive components correspond to a set of linearly independent columns of A.

Let B {1,,n} be an index set of size m such that the submatrix AB (formed from the columns of A indexed by B) is nonsingular. Then the corresponding basic solution is given by:

xB = AB1b,x N = 0,

where N = {1,,n} B. If xB 0, the basic solution is feasible, and hence a basic feasible solution.

Basic feasible solutions play a central role in the simplex method, which moves from one BFS to another while improving the objective function value.

Example 7.11: Basic Feasible Solution

Consider the linear program:

max 3x1 + 2x2  s.t.  x1 + x2 4, 2x1 + x2 5, x1,x2 0.

We first convert the inequalities to equalities by introducing slack variables s1 and s2:

x1 + x2 + s1 = 4, 2x1 + x2 + s2 = 5, x1,x2,s1,s2 0.

This system has 4 variables and 2 equality constraints. A basic feasible solution corresponds to choosing any 2 variables (equal to the number of constraints) as basic and solving for them.

Choose s1 and s2 as the basic variables (so x1 = x2 = 0). Substituting into the equations:

s1 = 4, s2 = 5.

This gives the solution:

(x1,x2,s1,s2) = (0,0,4,5),

which is a basic feasible solution. It is feasible because all variables are nonnegative, and basic because we set two variables (equal to the number of constraints) to nonzero values.

Geometrically, this solution corresponds to the intersection of the two axes (i.e., the origin) in the (x1,x2) plane, a corner point of the feasible region.

Learning Checkpoint 7.1.1

In a basic feasible solution (BFS) to a linear program in standard form, how many components of the decision vector x can be nonzero?

[Hint: Relate your answer to the number of linearly independent constraints in the system.]

Proposition 7.1. Vertices and BFS Let P = {x n : Ax = b,x 0} be the feasible region of a linear program in standard form, where A m×n has full row rank m n. Then every vertex of P is a basic feasible solution.

Proof. Let x P be a vertex of the feasible region P. By definition, this means that x cannot be expressed as a strict convex combination of two distinct points in P. We will show that x is a basic feasible solution.

Let I := {j {1,,n} : xj > 0} be the support of x, and let AI denote the submatrix of A consisting of the columns indexed by I. Since Ax = b, and xj = 0 for jI, the vector xI |I| satisfies:

AIxI = b.

If the columns of AI were linearly dependent, then there would exist a nonzero vector d n with support in I such that Ad = 0, and for small enough 𝜀 > 0, both x + 𝜀d and x 𝜀d would remain in P, contradicting the fact that x is a vertex.

Therefore, the columns of AI must be linearly independent, and since A has rank m, it follows that |I| m. We can now construct a basic solution by selecting any set B {1,,n} of indices such that:

Let xB = AB1b, and set xN = 0, where N = {1,,n} B. Then x is a basic solution. Since xj = 0 for jI B, and xj > 0 for j I, it follows that x coincides with this basic solution and is nonnegative; hence it is a basic feasible solution. □

7.2 Canonical Form

For our purposes, it’s not quite enough to have a problem in standard form. We also want to have easy access to a basic feasible solution. Thus, we like to convert linear programs to canonical form.

Definition 7.12: Canonical Form of a Linear Program

A linear program is in canonical form if:

In this case, a basic feasible solution is immediately evident: set the basic variables xB = b, and nonbasic variables to zero.

Example 7.13: Canonical Form from Slack Variables

Consider the linear program:

max 2x1 + 3x2  s.t.  x1 + x2 4, x1 + 2x2 6, x1,x2 0.

We convert the constraints to equalities by introducing slack variables s1 and s2:

x1 + x2 + s1 = 4, x1 + 2x2 + s2 = 6, s1,s2 0.

Now the LP is in standard form with 4 variables x1,x2,s1,s2. The constraint matrix is:

A = [ 1 1 1 0 1 2 0 1 ]

The columns corresponding to s1 and s2 form the identity matrix:

AB = [ 1 0 0 1 ] = I2,andb = [ 4 6 ] 0.

Hence, this LP is now in canonical form. The evident basic feasible solution is:

x1 = 0,x2 = 0,s1 = 4,s2 = 6.

PIC

Figure 7.2: When can you use canonical form?

7.2.1 Augmenting system and Phase 1

We can summarize these tricks in the following table.






Type  of Constraint

Form  of Constraint

                                                      Constraint in                                                       Augmented  Form

                                                                                                                            Constraint                                                                                                                             Boundary Eq.

                                                                                                                                                                                                  Indicating                                                                                                                                                                                                   Variable(s)






Nonnegativity xj 0 xj 0 xj = 0 xj





Nonpositivity xj 0 xj = xj,x j0 x j= 0 x j





Unrestricted xj xj = xj+ x j,x j+,x j0 x j+ = x j x j+,x j





Functional ( ) j=1na ijxj bi j=1na ijxj + si = bi aijxj = bi si





Functional ( =) j=1na ijxj = bi j=1na ijxj + ai = bi aijxj = bi ai





Functional ( ) j=1na ijxj bi j=1na ijxj si + ai = bi aijxj = bi ai si





*Indicating variable = 0 constraint boundary is satisfied; indicating variable 0 constraint boundary is not satisfied.

Table 7.1: Summary of constraint and domain transformations used to convert to standard/canonical form.

We end this subsection with a motivating result.

Proposition 7.2. Existence of Canonical Form for Feasible LPs Let P be a linear program in standard form:

max cx  s.t. Ax = b, x 0.

If P is feasible (i.e., x 0 such that Ax = b), then there exists an equivalent linear program in canonical form, that is, a reformulation where:

Idea of Proof. Start from any feasible solution x n with x 0 and Ax = b. Use the simplex method (or a pivoting method) to move to a basic feasible solution x. Since A has full rank over the feasible region, the basis matrix AB will be invertible. By reordering variables (i.e., choosing a new basis where AB = Im), we can express the LP in canonical form.

If no feasible solution exists, then Phase I must be used to find one (or certify infeasibility). □

7.3 Pivoting and the Simplex Algorithm

Learning Outcomes

Resources

Video

Interactive Simplex Method

Simplex Dictionary Calculator Using Python + Jupyter

Try it out visually!

Simplex Pivoter in Dictionary Form: pivot this chapter’s bakery example (or your own LP) step by step, with a practice mode that checks your entering and leaving choices.

The Simplex Algorithm jumps among the vertices of the feasible region searching for an optimal point. It does this by moving along the edges of the feasible region in such a way that the objective function is always increased after each move.

PIC

(a) The feasible region for a linear program with 2-dimensional constraints.

PIC

(b) The feasible region for a linear program with 3-dimensional constraints.
Figure 7.3: If an optimal point exists, it is one of the vertices of the polyhedron. The simplex algorithm searches for optimal points by moving between adjacent vertices in a direction that increases the value of the objective function until it finds an optimal vertex.

To improve the solution, we:

1.
Select an entering variable with a negative reduced cost.
2.
Determine the leaving variable using the minimum ratio test.
3.
Perform a pivot operation to update the basis.

This process continues until no negative reduced costs remain, indicating an optimal solution.

7.3.1 Transforming the LP to Standard Form

We start with the following linear program:

max 2x + 3y  s.t.  x + y 9, 2x + y 16, x + 2y 14, x,y 0.

Blue feasible region with constraint lines x+y=9 (red), 2x+y=16 (teal), and x+2y=... (orange); the optimum is marked with a red dot at (4,5) and vertices (0,0), (0,7), (7,2), (8,0) are labeled.

To convert these inequalities to equalities, we introduce slack variables s1, s2, and s3. Specifically, we rewrite each constraint as follows:

x + y + s1 = 9, 2x + y + s2 = 16, x + 2y + s3 = 14,

with the additional nonnegativity constraints s1,s2,s3 0.

Hence, the linear program in standard form becomes:

max 2x + 3y  s.t.  x + y + s1 = 9, 2x + y + s2 = 16, x + 2y + s3 = 14, x,y,s1,s2,s3 0.

Rewriting the System with {s1,s2,s3} as the Basis

When we say {s1,s2,s3} is the basis, we solve each equation for the corresponding slack variable:

s1 = 9 x y, s2 = 16 2x y, s3 = 14 x 2y.

Our initial non-basic variables are x and y. We will call this representation of the linear program a dictionary.

max z = 0 + 2x + 3y  s.t.  s1 = 9 x y, s2 = 16 2x y, s3 = 14 x 2y, x,y,s1,s2,s3 0.

From here we can read off a basic solution that is

Basic variables: (s1,s2,s3) = (9,16,14),

Non-basic variables: (x,y) = (0,0)

with

Objective value: z = 0.

Since the basic variables are all non-negative ( 0), we call this a basic feasible solution.

Remark. Reading the Dictionary From the dictionary below, we can read off the corresponding basic solution and the objective value. The basic solution is obtained by:

The dictionary is said to be feasible if all basic variables have nonnegative values (which is true here). Thus, this corresponds to a basic feasible solution:

x = 0,y = 0,s1 = 9,s2 = 16,s3 = 14,z = 0.
max z = 0     + 2x + 3y  s.t. s1 = 9    x y, s2 = 16  2x y, s3 = 14  x 2y, x,y,s1,s2,s3 0.

PIC

7.3.2 Simplex Assuming Feasible Start

In this subsection we assume that the slack basis {s1,s2,s3} gives a feasible starting dictionary; that is, setting the original variables x,y to zero produces nonnegative values for every slack. Under this assumption, the simplex method proceeds by repeatedly choosing an entering variable whose objective-row coefficient is positive, performing the ratio test to decide which basic variable leaves, and pivoting to obtain a new dictionary. The remainder of this section walks through these three steps on the running example above.

We take as our initial basic variables the three slack variables s1,s2,s3. Geometrically, this corresponds to the point (x,y) = (0,0). Indeed, if x = 0 and y = 0, then from the original constraints

x + y + s1 = 9, 2x + y + s2 = 16, x + 2y + s3 = 14,

it follows that

s1 = 9,s2 = 16,s3 = 14.

All are nonnegative, so (s1,s2,s3) is indeed a feasible basis, and (0,0,9,16,14) is the basic feasible solution (BFS).

Thus, in “basic-variable = constant (nonbasic terms)” form, our system becomes

{ s1 + x + y = 9, s2 + 2x + y = 16, s3 + x + 2y = 14.

Since s1,s2,s3 are taken to be the basic variables, the nonbasic variables in this setup are x and y. Setting x = 0,y = 0 immediately gives the BFS

(x,y,s1,s2,s3) = (0,0,9,16,14).

The Objective Function in this Basis

max z = 2x + 3y.

Value of z at the BFS (0,0,9,16,14). At (x,y) = (0,0), we see z = 2 0 + 3 0 = 0, so the initial objective value is z = 0. From here, one would normally proceed with the simplex pivots to drive the objective upwards (since this is a maximization problem). We handle those pivot steps next.

Choosing the Entering Variable

We examine the objective row to determine which nonbasic variable should enter the basis. At this point, the objective is:

z = 2x + 3y.

Therefore, we choose y to enter the basis.

First Iteration. Ratio Test to Determine Who Leaves

We hold x = 0 fixed and allow y to increase from 0. Then from the initial dictionary, the basic variables become (substituting x = 0):

s1 = 9 y, s2 = 16 y, s3 = 14 2y.

To maintain feasibility, we require all basic variables to remain nonnegative:

s1 09 y 0y 9, s2 016 y 0y 16, s3 014 2y 0y 142 = 7.

The tightest constraint is y 7, which means s3 reaches zero first as y increases. Therefore, s3 will leave the basis in this pivot.

This is called the Ratio Test because we can compute these numbers as

9 y = 0 y = 91 = 9

16 y = 0 y = 161 = 16

14 2y = 0 y = 142 = 7

If a coefficient on y was positive, we would ignore that constraint as increasing y would never violate the corresponding inequality.

The ratio test can also be thought of as changing the solution via a vector. In particular, we are at the basic feasible solution (s1,s2,s3,x,y) = (9,16,14,0,0). Now, as we increase y, we change the solution as

(s1,s2,s3,x,y) = (9,16,14,0,0) + Δy (1,1,2,0,1) = (9,16,14,0,0) + 7 (1,1,2,0,1) = (2,9,0,0,7). We will see these numbers appear as we pivot the dictionary to the new basis.

Pivoting on the s3-Equation Solved for y

Originally, s3 + x + 2y = 14. Solve for y:

y = 7 x 2 s3 2 .

Substitute into the other rows (and the objective row), isolating each basic variable on the left and all others on the right:

max z = 0 + 2x + 3y = 21 + 1 2x 3 2s3  s.t.  s1 = 9 x y = 2 1 2x + 1 2s3, s2 = 16 2x y = 9 3 2x + 1 2s3, s3 = 14 x 2y y = 7 1 2x 1 2s3, x,y,s1,s2,s3 0.

Hence the new basic variables are {z,y,s1,s2} if we were to place z in the dictionary as well. Typically, in a standard simplex dictionary, z is displayed in its own row, but it is not counted as a “basic variable” in the same sense as the constraints. The nonbasic variables are now {x,s3}.

Updated Dictionary and Basic Feasible Solution

max z = 21 + 1 2x 3 2s3  s.t.  s1 = 2 1 2x + 1 2s3, s2 = 9 3 2x + 1 2s3, y = 7 1 2x 1 2s3, x,y,s1,s2,s3 0.

Thus the new BFS after the pivot is (x,y,s1,s2,s3) =(0,7,2,9,0) with z = 21.

Second Iteration

Since the objective function still has variables with positive coefficients in it, we will seek to pivot again to increase the objective.

Second Iteration. Identify the Entering Variable

We look at the coefficients of the nonbasic variables in the objective row,

z = 21 + 1 2x 3 2s3.

Since this is a maximization problem, increasing a variable with a negative objective coefficient would decrease z. Hence we choose x, the only nonbasic variable with a positive coefficient, to enter the basis.

Second Iteration. Ratio Test to Determine Who Leaves

We hold s3 = 0 for the moment and let x increase from 0. Then from the above system, the three basic variables become (substituting s3 = 0):

y = 7 1 2x, s1 = 2 1 2x, s2 = 9 3 2x.

We require these to remain nonnegative:

y 0 7 1 2x 0x 71 2 = 14, s1 02 1 2x 0x 21 2 = 4, s2 09 3 2x 0x 93 2 = 6.

The smallest upper bound is x 4, which means s1 will reach zero first when x = 4. Hence s1 must leave the basis.

The Pivot: Solve the s1 Equation for x

From

s1 = 2 1 2x + 1 2s3,

we isolate x:

s1 2 1 2s3 = 1 2xx = 2(s1 2 1 2s3) = 4 + s3 2s1.

Rewriting,

x + 2s1 s3 = 4.

This becomes the new pivot row, with x on the left side as a basic variable.

Eliminate x from the Other Rows

Next, we substitute x = 4 + s3 2s1 into the rows for {y,s2,z} to remove x. (In each row, replace x by 4 + s3 2s1.)

Updating y: Originally

y = 7 1 2x 1 2s3.

Substitute x:

y = 7 1 2(4 + s3 2s1) 1 2s3 = 7 2 1 2s3 + s1 1 2s3 = 5 + s1 s3.

Updating s2: Originally

s2 = 9 3 2x + 1 2s3.

Substitute x:

s2 = 9 3 2(4 + s3 2s1) + 1 2s3 = 9 6 3 2s3 + 3s1 + 1 2s3 = 3 + 3s1 s3.

Updating the Objective Row z: Originally

z = 21 + 1 2x 3 2s3.

Substitute x:

z = 21 + 1 2(4 + s3 2s1) 3 2s3 = 21 + 2 + 1 2s3 s1 3 2s3 = 23 s1 s3.

The Third Dictionary

After the pivot, the basic variables are now {x,y,s2}, and the nonbasic variables are {s1,s3}. Our updated equations, in a clean dictionary form (basic on the left) are:

max z = 23 s1 s3  s.t.  x = 4 2s1 + s3, y = 5 + s1 s3, s2 = 3 + 3s1 s3, x,y,s1,s2,s3 0.

Remark. Reading the Final Dictionary From the final dictionary below, we read the solution using the same process:

This yields the final basic feasible solution:

s1 = 0,s3 = 0,x = 4,y = 5,s2 = 3,z = 23.
max z = 23  s1 s3  s.t. x = 4  2s1 + s3, y = 5  + s1 s3, s2 = 3  + 3s1 s3, x,y,s1,s2,s3 0.

PIC

Why is this optimal? This is a maximization problem, and the final dictionary expresses the objective as:

z = 23 s1 s3.

Both s1 and s3 are nonbasic and currently zero. Since increasing either would decrease the value of z, we cannot improve the objective by pivoting.
Hence, this solution is optimal.

7.3.3 Summarizing the steps taken

We now summarize the whole process:

1.
Original LP

max 2x + 3y  s.t.  x + y 9, 2x + y 16, x + 2y 14, x,y 0.
2.
Standard Form with Feasible Basis {s1,s2,s3}

max 2x + 3y  s.t.  x + y + s1 = 9, 2x + y + s2 = 16, x + 2y + s3 = 14, x,y,s1,s2,s3 0.
3.
Initial Dictionary with Basis (s1,s2,s3)

max z = 0 + 2x + 3y  s.t.  s1 = 9 x y, s2 = 16 2x y, s3 = 14 x 2y. x,y,s1,s2,s3 0

Basic Feasible Solution: (s1,s2,s3) = (9,16,14),(x,y) = (0,0) Objective Value: z = 0.
Since the objective row has a positive coefficient, it is not optimal.

4.
First Iteration:
(a)
Ratio Test: y enters, s3 leaves.
(b)
Dictionary after Pivoting y in, s3 out

max z = 21 + 1 2x 3 2s3  s.t.  s1 = 2 1 2x + 1 2s3, s2 = 9 3 2x + 1 2s3, y = 7 1 2x 1 2s3.

Basic Feasible Solution: (s1,s2,y) = (2,9,7),(x,s3) = (0,0) Objective Value: z = 21.
Since the objective row has a positive coefficient, it is not optimal.

5.
Second Iteration
(a)
Ratio Test: x enters, s1 leaves.
(b)
Final Dictionary (Optimal) after pivoting x in, s1 out.

max z = 23 s1 s3  s.t.  x = 4 2s1 + s3, y = 5 + s1 s3, s2 = 3 + 3s1 s3.

Basic Feasible Solution: (x,y,s2) = (4,5,3),(s1,s3) = (0,0) Objective Value: z = 23.
Since all coefficients in the objective row are non-positive, this is the optimal solution.

Resources

You can review these calculations using the code available here in Jupyter Notebook Format.

A useful way to internalize what just happened: every vertex of the feasible region has its own dictionary, the same linear program rewritten from that vertex’s point of view. Figure 7.4 shows all five dictionaries for our example. The simplex method simply walks from dictionary to dictionary along edges of the region, and the signs of the objective-row coefficients at each vertex tell it where to go next. At (4,5) both coefficients are negative, so the walk stops: no neighboring vertex is better.

PIC

Figure 7.4: The same linear program seen from every vertex: each basic feasible solution has its own dictionary, whose objective row reveals whether a better neighbor exists. The orange arrows trace the pivots taken in the text, (0,0) (0,7) (4,5); at (4,5) all objective coefficients are negative, certifying optimality.

7.4 The Simplex Algorithm!

Here we formally describe the simplex algorithm.

Algorithm: Simplex Method

Input. A linear program in standard form with a feasible starting basis (typically the slack variables).
Initialization. Write the system in dictionary form (basic variables on the left, nonbasic variables on the right) and substitute the basic variables into the objective function.

Choose the entering variable Select a nonbasic variable with a positive coefficient in the objective row. (If no coefficient is positive, the current solution is already optimal.)

Determine the leaving variable For each basic variable with a positive entering-variable coefficient, compute the ratio current value of basic variable coefficient of entering variable. The basic variable with the smallest ratio reaches zero first and leaves the basis.

Pivot Rewrite the leaving variable’s equation so it is expressed in terms of the entering variable, then substitute this expression into all other equations and the objective function.

Repeat until optimal Repeat the three steps above until every objective-row coefficient of a nonbasic variable is non-positive. The current basic solution is then optimal.

We dive a little deeper into what the ratio test is here:

Learning Checkpoint 7.4.1

When applying the simplex method, why might choosing the wrong leaving variable during the ratio test lead you to an infeasible basic solution?

Hint: Think about what the ratio test is meant to guarantee for the nonnegativity of variables after the pivot.

We will see another example of this, and then modify it to handle LPs that don’t have a simple initial basic feasible solution.

7.4.1 Simplex Algorithm Execution

Here is the same computation from Section 7.3 again, this time in compact form, so you can see the whole run at a glance now that each step has a name. Each computation is colour-coded to match the algorithm card above: entering (green), ratio test / leaving (orange), pivot (blue), and optimal (purple).

Initial dictionary (basis {s1,s2,s3}; nonbasic x = y = 0):

max z = 2x + 3y  s.t.  s1 = 9 x y s2 = 16 2x y s3 = 14 x 2y

Iteration 1.

 Entering.  Both x and y have positive coefficients in z = 2x + 3y. By steepest ascent we increase the one with the larger coefficient, y (coefficient 3), so y enters.

 Ratio test.  As y increases (with x = 0), each basic variable stays nonnegative only up to its ratio:

s1 = 9 y 0y 91 = 9, s2 = 16 y 0y 161 = 16, s3 = 14 2y 0y 142 = 7(smallest).

The smallest ratio is 7, attained by s3, so s3 leaves.

 Pivot.  Solve the s3 row for y: y = 7 0.5x 0.5s3. Substituting into the objective and the other rows gives

max z = 21 + 0.5x 1.5s3  s.t.  s1 = 2 0.5x + 0.5s3 s2 = 9 1.5x + 0.5s3 y = 7 0.5x 0.5s3

Iteration 2.

 Entering.  Only x has a positive objective coefficient ( 0.5), so x enters.

 Ratio test.  As x increases (with s3 = 0):

s1 = 2 0.5x 0x 20.5 = 4(smallest), s2 = 9 1.5x 0x 91.5 = 6, y = 7 0.5x 0x 70.5 = 14.

The smallest ratio is 4, attained by s1, so s1 leaves.

 Pivot.  Solve the s1 row for x: x = 4 2s1 + s3. Substituting gives

max z = 23 s1 s3  s.t.  x = 4 2s1 + s3 s2 = 3 + 3s1 s3 y = 5 + s1 s3

 Optimal.  Every nonbasic objective coefficient is 0, so no further improvement is possible: x = 4,y = 5,z = 23.

In the example worked out in the prior section, we used the steepest ascent pivot rule, which means that we always used the variable in the objective with the largest positive coefficient to enter the basis. However, we could make other choices instead. The choice of how to pivot is left a little ambiguous in the simplex method and many different pivot rules have been proposed. See Exercise 7.25 to see how the simplex method plays out when pivoting in a different direction first.

In fact, in the figure below, we show the simplex dictionary at every single vertex. You can see that from any vertex, you can pivot along an edge of the feasible region to another vertex.

PIC

Figure 7.5: The feasible region with the basis and objective value at every vertex; the simplex path leads to...

Remark. Reduced Costsdef:reduced-cost The coefficients of the nonbasic variables in the objective row are their reduced costs:

Reduced cost of s1 = 1,Reduced cost of s3 = 1.
max z = 23  s1 s3  s.t. x = 4  2s1 + s3, y = 5  + s1 s3, s2 = 3  + 3s1 s3, x,y,s1,s2,s3 0.

Optimality Condition: A basic feasible solution is optimal if and only if all reduced costs of nonbasic variables satisfy:

(for maximization):reduced cost 0.

In this dictionary:

Reduced costs of s1,s3 < 0 no nonbasic variable can enter to improve z.

Therefore, the current solution is optimal.

Definition 7.14: Reduced Costs in an Arbitrary Dictionary

Let a linear program in standard form be given by

max cx s.t. Ax = b,x 0,

and let B {1,,n} be a basis of linearly independent columns of A. The corresponding dictionary expresses the basic and objective variables in terms of the nonbasic variables N = {1,,n} B:

z = z0 + jNc¯jxj xi = b¯i + jNāijxjfor i B

Here:

7.5 No Feasible Initial Basis and the Big-M Method

Try it out visually!

Two-Phase Simplex: watch artificial variables enter, Phase 1 drive them out, and the handoff to Phase 2.

Learning Outcomes

Every worked example so far started from the origin x = y = 0, where the slack variables handed us an obvious basic feasible solution. That convenience disappears the moment the problem has a “ ” constraint: at the origin the corresponding slack is negative, so the natural starting dictionary is infeasible and there is no basis from which to launch the simplex method. This section shows how to manufacture a feasible starting basis with an artificial variable penalized by a large constant M (the Big-M method), and how the same device reveals when a problem has no feasible solution at all.

Consider

max 2x + 3y  s.t.  2x + y 5, 2x + y 16, x + 2y 14, x,y 0.

The first constraint points the wrong way for an easy start, so the origin is infeasible and we cannot simply read off a starting basis.

Geometrically, the origin lies outside the feasible region, so it cannot serve as a starting vertex:

PIC

Figure 7.6: Feasible region after adding the constraint 2x+y>=5: the pink triangle near the origin becomes infeasible.

Step 1 — Put every constraint in “ ” form.  Multiplying the constraint by 1 turns it into a constraint:

max 2x + 3y  s.t.  2x y 5, 2x + y 16, x + 2y 14, x,y 0.

Step 2 — Form the slack dictionary and spot the infeasibility.  Introducing slack variables gives

max 2x + 3y  s.t.  s1 = 5 + 2x + y, s2 = 16 2x y, s3 = 14 x 2y, x,y,s1,s2,s3 0.

At x = y = 0 this gives s1 = 5 < 0, so the dictionary is infeasible and the usual simplex start is unavailable.

Step 3 — Introduce an artificial variable.  Add a nonnegative artificial variable a1 to the offending equation and penalize it heavily in the objective (here M = 1000), so the simplex method is driven to push it back to zero:

max 2x + 3y 1000a1  s.t.  s1 = 5 + 2x + y + a1, s2 = 16 2x y, s3 = 14 x 2y, x,y,s1,s2,s3,a1 0.

Step 4 — Pivot to a feasible basis.  Swapping a1 into the basis in place of s1 makes every right-hand side nonnegative at x = y = 0, giving a genuine starting point:

max 5000 + 2002x + 1003y 1000s1  s.t.  a1 = 5 2x y + s1, s2 = 16 2x y, s3 = 14 x 2y, x,y,s1,s2,s3,a1 0.

With a feasible basis in hand, we run the simplex method as usual. Letting x enter drives the artificial variable back out of the basis:

max 5 + 2y + s1 1001a1  s.t.  x = 2.50 0.50y + 0.50s1 0.50a1, s2 = 11 s1 + a1, s3 = 11.50 1.50y 0.50s1 + 0.50a1, x,y,s1,s2,s3,a1 0.

The structure of this feasible dictionary is worth pausing on.

Remark. Artificial Variable Can Be Removed: Feasible Start for Phase II This is the second artificial dictionary from Phase I of the two-phase simplex method. Our goal was to eliminate the artificial variable a1 while finding a feasible solution to the original problem.

Consider this dictionary:

Conclusion: We now have a basic feasible solution to the original problem (with no artificial variables present), so we can begin Phase II of the simplex method using this dictionary as the starting point.

max 5  + 2y + s1 1001a1  s.t. x = 2.50  0.50y + 0.50s1 0.50a1, s2 = 11  s1 + a1, s3 = 11.50  1.50y 0.50s1 + 0.50a1, x,y,s1,s2,s3,a1 0.

PIC

Learning Checkpoint 7.5.1

Why can the artificial variable be removed from this system?

Now a1 is nonbasic, so the basis is feasible for the original problem. We may discard the artificial variable and continue from the feasible dictionary

max 5 + 2y + s1  s.t.  x = 2.50 0.50y + 0.50s1, s2 = 11 s1, s3 = 11.50 1.50y 0.50s1, x,y,s1,s2,s3 0.

7.5.1 Big-M Method Algorithm

Algorithm: Big-M Method

Input. A linear program in standard form (maximize), possibly with an infeasible initial basic solution.

Add artificial variables For each constraint with a negative right-hand side, multiply the constraint by 1 so the RHS becomes positive. For each constraint without an obvious feasible basic variable, add an artificial variable ai 0.

Penalize the artificials Add a penalty term Mai (with M a very large constant) for each artificial variable to the objective. Form the initial dictionary (including slack/surplus and artificial variables) using this modified objective, with the artificials in the starting basis.

Drive the artificials out While an artificial variable is in the basis (or the basic solution is infeasible), perform a simplex pivot, using the modified objective, that moves at least one artificial variable out of the basis.

Restore and continue Once all artificial variables are zero, remove their columns and continue the standard simplex iterations using the original objective function.

Output The optimal solution to the original problem, or a declaration of infeasibility if any artificial variable remains positive.

7.5.2 Detecting Infeasibility via the Big-M Method

Consider the linear program

max 2x + 3y  s.t.  2x + y 22,2x + y 16,x + 2y 14,x,y 0.

The first two constraints demand that 2x + y be simultaneously at least 22 and at most 16, so we should expect trouble. Rewriting the constraint as 2x y 22 and adding a slack gives s1 = 22 + 2x + y, which is negative at the origin. Exactly as before, we add an artificial variable a1 (penalty M = 1000) and pivot it into the basis to obtain a feasible starting dictionary:

max 22000 + 2002x + 1003y 1000s1   s.t. a1 = 22 2x y + s1, s2 = 16 2x y, s3 = 14 x 2y.

Pivot: x enters, s2 leaves. 

max 5984 + 2y 1000s1 1001s2   s.t. a1 = 6 + s1 + s2, x = 8 0.50y 0.50s2, s3 = 6 1.50y + 0.50s2.

Pivot: y enters, s3 leaves. 

max 5976 1000s1 1000.33s2 1.33s3  s.t.  a1 = 6 + s1 + s2, x = 6 0.67s2 + 0.33s3, y = 4 + 0.33s2 0.67s3.

Every objective-row coefficient is now nonpositive, so this dictionary is optimal for the penalized (Big-M) problem, yet the artificial variable is still basic.

Interpreting the Final Dictionary

In the final dictionary, the artificial variable a1 appears in the equation

a1 = 6 + s1 + s2.

When the nonbasic variables s1 and s2 are set to zero (which is typical in a basic solution), we find

a1 = 6.

Because a1 > 0 in the optimal dictionary, this indicates that the original linear program has no feasible solution. The presence of a positive artificial variable in the final optimal dictionary is the standard signal in the Big-M method that the original problem is infeasible.

In summary, the contradictory constraints (requiring 2x + y to be both at least 22 and at most 16) force the artificial variable a1 to remain positive. Thus, the Big-M method confirms that the problem is infeasible.

Remark. Final Artificial Dictionary Indicates Infeasibility This is the final dictionary at the end of Phase I of the two-phase simplex method, where the goal was to eliminate the artificial variable a1 and reach a feasible solution to the original problem.

To interpret this:

Thus, there is no feasible solution to the original problem.
Conclusion: The original linear program is infeasible.

max 5976  1000s1 1000.33s2 1.33s3  s.t. a1 = 6  + s1 + s2, x = 6  0.67s2 + 0.33s3, y = 4  + 0.33s2 0.67s3, x,y,s1,s2,s3,a1 0.

PIC

Theorem 7.15: Infeasibility Detection via the Big-M Method

Consider the linear programming problem

max cx  s.t.  Ax b, x 0.

After converting inequalities to equalities by introducing slack, surplus, and, if needed, artificial variables, the system takes the form

Ax Iaa = b,x,a 0,

where Ia is a submatrix of the identity matrix, with each column corresponding to an artificial variable introduced to enforce equality in a constraint that initially lacked a basic variable with a nonnegative right-hand side. The Big-M formulation is then given by

max cx M iIai.

If, in any optimal solution of the Big-M problem, there exists an artificial variable ai > 0 for some i I, then the original linear programming problem is infeasible.

Proof. Assume that an optimal solution (x,a) of the Big-M problem satisfies ai > 0 for some i I.

Suppose, for contradiction, that the original linear programming problem is feasible. Then there exists some x0 such that Axb. In the reformulation process, if a constraint lacked a basic variable with a nonnegative right-hand side, an artificial variable ai was introduced, rewriting the constraint as

(original constraint) ai = bi.

For any feasible x of the original problem, we can set a = 0 for all artificial variables, and the equality constraints will still be satisfied.

Thus, the solution (x,0) is feasible for the Big-M formulation, and its objective value is exactly cx. On the other hand, the optimal solution (x,a) yields an objective value of

cx M iIai.

Since M is chosen to be a very large positive constant, any positive contribution from iIai imposes a severe penalty. Consequently, the objective value of (x,0) would be strictly greater than that of (x,a) provided that M is sufficiently large.

This contradiction implies that no feasible solution (x,0) exists for the original problem. In other words, the assumption that the original problem is feasible is false.

Hence, if in the optimal solution of the Big-M problem any artificial variable remains positive, the original linear programming problem must be infeasible. □

7.5.3 A second example: two artificial variables

When several constraints point the “wrong” way, we simply add one artificial variable per offending constraint. Consider

max 3x + y  s.t.  2x + y 5,2x + y 16,x + 2y 3,x,y 0.

Two constraints are of “ ” type, so the origin violates both. Flipping them to 2x y 5 and x 2y 3 and adding slacks gives s1 = 5 + 2x + y and s3 = 3 + x + 2y, both negative at the origin. We introduce two artificial variables a1,a3 (each penalized by M = 1000) and pivot them into the basis, producing a feasible starting dictionary whose objective row carries the Big-M penalty:

max 8000 + 3003x + 3001y 1000s1 1000s3   s.t. a1 = 5 2x y + s1, s2 = 16 2x y, a3 = 3 x 2y + s3.

The large penalties make x and y attractive to increase, and successive pivots drive both artificial variables out of the basis. Once a1 = a3 = 0 the basis is feasible for the original problem; we drop the artificials and continue on the true objective 3x + y until every reduced cost is nonpositive:

max 24 0.5y 1.5s2   s.t. x = 8 0.5y 0.5s2, s1 = 11 s2, s3 = 5 + 1.5y 0.5s2.

Reading the optimal dictionary gives x = 8, y = 0, and z = 3x + y = 24, with the first and third constraints slack ( s1 = 11, s3 = 5) and the second constraint tight ( s2 = 0).

7.6 Degeneracy, Cycling, and Bland’s Rule

Definition 7.16: Degeneracy

A basic feasible solution (BFS) in the Simplex Method is said to be degenerate if one or more of its basic variables take a value of zero. Mathematically, a BFS corresponding to a basis B is degenerate if there exists at least one basic variable xB such that xB = 0.

Remark. Degenerate Dictionary The dictionary below represents a feasible solution, but one of the basic variables is equal to zero. This situation is called degeneracy.

What is degeneracy? A dictionary is called degenerate if any basic variable is equal to zero. This is important because:

In this dictionary:

max z = 0  + x1 + 2x2  s.t. x3 = 4  x2, x4 = 2  x1 + x2, x5 = 3  x1, x6 = 0  + 2x1 x2, x1,x2,x3,x4,x5,x6 0.

PIC

In this case, the basic feasible solution is (basic variables) (x3,x4,x5,x6) = (4,2,3,0) and (non-basic variables) (x1,x2) = (0,0).

7.6.1 Degeneracy and Unchanged BFS after Pivoting

Degeneracy can lead to cases where pivoting in the Simplex Method does not change the basic feasible solution. When a pivot is performed, the entering variable is increased until one of the current basic variables reaches zero, at which point that variable leaves the basis. However, if multiple constraints yield the same minimum ratio in the ratio test, then a tie-breaking rule must be applied. If the variable that leaves the basis was already zero, the BFS remains unchanged.

Notice in the prior example, we can try to let x2 enter the basis. What happens? By the ratio test, we see that x6 leaves the basis. This results in the following new dictionary:

Remark. Degenerate Pivot: No Change in BFS After pivoting x2 into the basis and x6 out, we arrive at the dictionary below.

Here is what happened:

Conclusion: This is a case of a degenerate pivot: we performed a pivot step, but the resulting basic feasible solution did not change. The simplex algorithm moved to a new dictionary (i.e., a new basis), but the point in solution space stayed the same.

max z = 0  + 5x1 2x6  s.t. x3 = 4  2x1 + x6, x4 = 2  + x1 x6, x5 = 3  x1, x2 = 0  + 2x1 x6, x1,x2,x3,x4,x5,x6 0.

PIC

But! The basic feasible solution is the same!!!

Fortunately, the next pivot leads to a new solution.

However, this phenomenon can cause the algorithm to visit the same BFS multiple times, potentially leading to cycling.

See https://gilp.henryrobbins.com/en/latest/examples/3d/SQUARE_PYRAMID_3D_LP.html for a highly degenerate case where the first two pivots do not change the solution.

7.7 Cycling in the Simplex Method

In the Simplex Method, a pivot operation normally improves the objective function by moving from one basic feasible solution (BFS) to another. However, in rare cases, the method can revisit the same BFS multiple times without progress. This phenomenon is called cycling.

Cycling occurs due to:

The following example demonstrates cycling. The entering variable is chosen by the largest-coefficient rule, and ties in the minimum ratio test are broken naively, by taking the tied row whose basic variable is listed first. This combination cycles on the example below. Anti-cycling pivot rules, such as the lexicographic rule or Bland’s rule (described later in this section), prevent this behavior.

7.7.1 Cycling in the Simplex Method

Cycling occurs when the Simplex Method revisits the same set of basic variables repeatedly without making progress in improving the objective function. This happens when degeneracy is present and the choice of entering and leaving variables results in looping between a set of degenerate BFSs.

The following example demonstrates cycling in the Simplex Method. It is a rescaled version of the classic cycling example constructed by E. M. L. Beale (1955), the first published instance of an LP on which the simplex method cycles; only the units of two variables have been changed, which preserves the cycle.

Initial Dictionary

max z = 0 + 0.75x1 20x2 + 0.50x3 6x4  s.t.  s1 = 0 0.25x1 + 8x2 + x3 9x4, s2 = 0 0.50x1 + 12x2 + 0.50x3 3x4, s3 = 1 x3, x1,x2,x3,x4,s1,s2,s3 0.

Pivot: x1 enters, s1 leaves. 

max z = 0 + 4x2 + 3.50x3 33x4 3s1  s.t.  x1 = 0 + 32x2 + 4x3 36x4 4s1, s2 = 0 4x2 1.50x3 + 15x4 + 2s1, s3 = 1 x3, x1,x2,x3,x4,s1,s2,s3 0.

Pivot: x2 enters, s2 leaves. 

max z = 0 + 2x3 18x4 s1 s2  s.t.  x1 = 0 8x3 + 84x4 + 12s1 8s2, x2 = 0 0.38x3 + 3.75x4 + 0.50s1 0.25s2, s3 = 1 x3, x1,x2,x3,x4,s1,s2,s3 0.

Pivot: x3 enters, x1 leaves. 

max z = 0 0.25x1 + 3x4 + 2s1 3s2  s.t.  x3 = 0 0.12x1 + 10.50x4 + 1.50s1 s2, x2 = 0 + 0.05x1 0.19x4 0.06s1 + 0.12s2, s3 = 1 + 0.12x1 10.50x4 1.50s1 + s2, x1,x2,x3,x4,s1,s2,s3 0.

Pivot: x4 enters, x2 leaves. 

max z = +0.50x1 16x2 + s1 s2  s.t.  x3 = 0 + 2.50x1 56x2 2s1 + 6s2, x4 = 0 + 0.25x1 5.33x2 0.33s1 + 0.67s2, s3 = 1 2.50x1 + 56x2 + 2s1 6s2, x1,x2,x3,x4,s1,s2,s3 0.

Pivot: s1 enters, s3 leaves. 

max z = +1.75x1 44x2 0.50x3 + 2s2  s.t.  s1 = 0 + 1.25x1 28x2 0.50x3 + 3s2, x4 = 0 0.17x1 + 4x2 + 0.17x3 0.33s2, s3 = 1 x3, x1,x2,x3,x4,s1,s2,s3 0.

Pivot: s2 enters, x4 leaves. 

max z = +0.75x1 20x2 + 0.50x3 6x4  s.t.  s1 = 0 0.25x1 + 8x2 + x3 9x4, s2 = 0 0.50x1 + 12x2 + 0.50x3 3x4, s3 = 1 x3, x1,x2,x3,x4,s1,s2,s3 0.

This last dictionary is identical to the initial one: after six pivots the method has returned to its starting basis with the objective still at z = 0. The simplex method is cycling, and without an anti-cycling safeguard it will loop forever.

7.7.2 Bland’s Rule

Bland’s Rule is a tie-breaking strategy used to prevent cycling in the Simplex Method. The rule ensures that:

1.
The variable with the smallest index enters the basis when multiple choices exist.
2.
The variable with the smallest index leaves the basis when multiple choices exist.

By enforcing this lexicographic ordering, the method guarantees progress and prevents the algorithm from revisiting the same basis indefinitely.

Theorem 7.17: Bland’s Rule Prevents Cycling

If Bland’s Rule is used to select the entering and leaving variables in the Simplex Method, then the algorithm will terminate in a finite number of steps, either by reaching an optimal solution or by detecting an unbounded problem.

Proof sketch. Suppose, for contradiction, that the method cycles: a sequence of degenerate pivots returns to a basis visited before. During a cycle the basic feasible solution and the objective value never change, and some set of variables enters and leaves the basis over and over. Consider the largest-indexed variable xt that takes part in the cycle. Comparing the dictionary at a step where xt enters with the dictionary at a step where xt leaves, a sign analysis of the two objective rows shows that at one of these steps some variable with index smaller than t was also eligible, so Bland’s rule could not have selected xt there, a contradiction. Hence no basis repeats; since there are finitely many bases, the algorithm terminates. The full argument is standard and can be found, for example, in Chvátal’s Linear Programming. □

From the example above, following the same sequence, we arrive at this dictionary.

max z = +0.50x1 16x2 + s1 s2  s.t.  x3 = 0 + 2.50x1 56x2 2s1 + 6s2, x4 = 0 + 0.25x1 5.33x2 0.33s1 + 0.67s2, s3 = 1 2.50x1 + 56x2 + 2s1 6s2, x1,x2,x3,x4,s1,s2,s3 0.

Pivot: x1 enters, s3 leaves. Bland’s rule: choose the lowest-index eligible entering and leaving variables

max z = 0.20 4.80x2 + 1.40s1 2.20s2 0.20s3  s.t.  x3 = 1 s3, x4 = 0.10 + 0.27x2 0.13s1 + 0.07s2 0.10s3, x1 = 0.40 + 22.40x2 + 0.80s1 2.40s2 0.40s3, x1,x2,x3,x4,s1,s2,s3 0.

Bland’s rule breaks the tie differently from before: the method moves to a genuinely new basis and the objective strictly increases to z = 0.20. The cycle is broken, and the simplex method now makes progress toward optimality.

7.8 Simplex and Unbounded LPs

Example 7.18: Unbounded Linear Program

Consider the linear program:

maximizex1  s.t.  x1 x2 1 2x1 x2 3 x1,x2 0

Desmos plot of the feasible region defined by x1-x2<=1, 2x1-x2<=3, x1,x2>=0: an unbounded region extending to the right in the first quadrant, illustrating the unbounded LP example.

Figure 7.7: Desmos plot of the feasible region defined by x1-x2<=1, 2x1-x2<=3, x1,x2>=0: an unbounded region...

We convert the inequalities into equalities using slack variables s1 and s2:

s1 = 1 x1 + x2 s2 = 3 2x1 + x2 x1,x2,s1,s2 0

Initial dictionary.

max z = x1  s.t.  s1 = 1 x1 + x2, s2 = 3 2x1 + x2.

Pivot: x1 enters, s1 leaves. ratio test: 11 < 32, so s1 leaves

max z = 1 + x2 s1  s.t.  x1 = 1 + x2 s1, s2 = 1 x2 + 2s1.

Pivot: x2 enters, s2 leaves. only s2 limits x2

max z = 2 + s1 s2  s.t.  x1 = 2 + s1 s2, x2 = 1 + 2s1 s2.

Now s1 is eligible to enter (its objective coefficient + 1 is positive), but its column is entirely nonnegative: in x1 = 2 + s1 s2 and x2 = 1 + 2s1 s2 the coefficients of s1 are + 1 and + 2. Increasing s1 raises both basic variables and never drives one to zero, so the ratio test finds no limiting row. The objective z = 2 + s1 grows without bound, and the linear program is unbounded.

Conclusion: This linear program is unbounded. Once s1 enters the basis, there is no constraint limiting how large it can grow while maintaining feasibility. Therefore, the objective function can increase without bound.

Pioneer Spotlight: George Dantzig

George Dantzig, known for spearheading linear programming with the simplex algorithm, was born in Portland, Oregon on November 8, 1914.1 George received his Bachelor of Arts in Mathematics and Physics from the University of Maryland, College Park. After marrying his wife, Anne Shmuner, he completed his Master of Arts in Mathematics at the University of Michigan in 1938. Before graduating with his Master’s degree, he began working at the United States Bureau of Labor Statistics as a junior statistician. George took interest in statistics through the work of Jerzy Neyman, which led him to earn a Ph.D. in Statistics with Neyman’s guidance from the University of California, Berkeley in 1946. Before his dissertation, he began working with the Army Air Force Combat Analysis Branch of Statistical Control at the Pentagon, then transferred to the Department of the Air Force as a mathematical advisor. After his work at the Pentagon, he became a professor in operations research at the University of California, Berkeley, and Stanford. He went on to receive the National Medal of Science in 1975. He was also a member of the National Academy of Engineering, the National Academy of Sciences, and the American Association of Arts and Sciences.2

While in school at the University of California, Berkeley, George became widely known for solving two of the “unsolved” statistics problems, which he mistakenly thought were homework. In 1947, Dantzig proposed the simplex algorithm, which started the field of linear programming.3 Geometrically, the simplex method consists of traveling along the edges of a polyhedron from vertex to vertex. The feasible region of a linear program is always convex, and if the program has an optimal solution and its feasible region has a vertex, then some optimal solution occurs at a vertex. The linear program should be in the following standard form:

max cxsubject toAx = b,x 0.

The corresponding vertices of the feasible region are the basic feasible solutions. If a system is nondegenerate, the process of simplex pivoting can occur, where the previous solution is used to pivot towards a better feasible basis.

After Dantzig’s development of the simplex algorithm, he presented a talk geared toward the application of his linear programming model in the digital world, including games and computers. His algorithm was implemented in the animal feed industry and computing machines for the Air Force. It was also used to solve Stigler’s “diet problem,” a simple question with modern technology, but a long computation process in 1947. Dantzig’s procedure has been utilized in countless industries, such as communications, railroads, petroleum, airlines, and the economy. His utilization of linear algebra theory and the creation of pivoting will continue to be used when solving complex linear problems.

Dantzig also studied network flow problems, which led to the duality theorem in the 1950s. The dual theorem utilizes the costs as integers to create a pair that highlights integer basic solutions, which was used in the application of the “fleet assignment model.” With a great understanding of real-world problems, Dantzig developed the recourse stochastic program, which accounted for uncertain constraints and utilized statistical tests to determine the likelihood of an optimal solution. Dantzig was responsible for the solution to countless military problems through his development of linear programming in the late-1940s.

This spotlight was contributed by Irma Adams

7.9 Exercises

Warm-ups

Exercise 7.19: Standard form and the first dictionary

  Consider the linear program

max 4x + 5y  s.t.  x + 2y 12, 3x + 2y 24, x,y 0.

1.
Convert the program to standard form by introducing slack variables s1,s2.
2.
Write the initial dictionary for the slack basis {s1,s2}, exactly as in the Initial Dictionary of Section 7.3.
3.
Read off the basic feasible solution and its objective value.
4.
Under the steepest ascent rule, which variable would enter the basis first?

7.3, Initial Dictionary; §7.1]

Exercise 7.20: Convert to Standard Form

  Convert the following linear program to standard form:

max 3x1 5x2  s.t.  2x1 + x2 6, x1 + 3x2 2, x1,x2 0.

7.1, Example: Complete Conversion to Standard Form]

Exercise 7.21: Convert to Standard Form

  Convert the following linear program to standard form:

min x1 + 2x2 + x3  s.t. x1 x2 + 2x3 = 4, 2x1 + x2 1, x3 is unrestricted,x1,x2 0.

7.1, Example: Complete Conversion to Standard Form]

Exercise 7.22: Convert to Standard Form

  Convert the following linear program to standard form:

max 5x1 + x2 3x3  s.t.  x1 + 2x2 x3 7, x2 4x3 = 3, x1 is unrestricted,x2,x3 0.

7.1, Example: Complete Conversion to Standard Form]

Exercise 7.23: Convert to Standard Form

  Convert the following linear program to standard form:

min 2x1 + 4x2  s.t. x1 + x2 3, 2x1 x2 5, x1 is unrestricted,x2 0.

7.1, Example: Complete Conversion to Standard Form]

Exercise 7.24: Convert to Standard Form

  Convert the following linear program to standard form:

min 5y1 3y2 + y3  s.t. 2y1 y2 + 3y3 = 7, y1 + 4y2 5, y3 is unrestricted.

7.1, Example: Complete Conversion to Standard Form]

Core problems

Exercise 7.25: Pivoting in a different direction

  We consider the example from Section 7.3. In that example, we pivoted first on the y variable. This choice of pivot called the steepest ascent rule since we chose the variable in the objective with the largest coefficient. However, we can consider pivoting on any variable with a positive coefficient in the objective. We will now pivot first on the x variable.

Starting Point

max 2x + 3y  s.t.  s1 = 9 x y, s2 = 16 2x y, s3 = 14 x 2y, x,y,s1,s2,s3 0.

1.
Let x increase first.
2.
Determine which variable leaves the basis using the ratio test.
3.
Pivot by rewriting the equation of the leaving variable in terms of x and substitute it into the other equations and the objective.
4.
Write down the new dictionary.
5.
Decide whether the resulting dictionary is optimal. If not, repeat the process.

7.3; §7.4]

Exercise 7.26: Simplex Method Practice

  Solve the following linear programming problem using the simplex method:

Maximize:z = 5x1 + 3x2 subject to:x1 + x2 12, 2x1 + x2 16, x1,x2 0.

7.3; §7.4]

Exercise 7.27: Simplex Method Practice

  Solve the following linear programming problem using the simplex method:

Maximize:z = 5x1 + 8x2 subject to:x1 + 2x2 30, 3x1 + x2 30, x1,x2 0.

7.3; §7.4]

Exercise 7.28: Simplex Method Practice

  Solve the following linear programming problem using the simplex method:

Maximize:z = 2x1 + 3x2 + x3 subject to:4x1 + 2x2 + 5x3 32, 2x1 + 4x2 + 3x3 28, x1,x2,x3 0.

7.3; §7.4]

Exercise 7.29: Simplex Method Practice

  Solve the following linear programming problem using the simplex method:

Maximize:z = 6x1 + 8x2 + 5x3, subject to:4x1 + x2 + x3 1800, 2x1 + 2x2 + x3 2000, 4x1 + 2x2 + x3 3200, x1,x2,x3 0.

7.3; §7.4]

Exercise 7.30: Simplex Method Practice

  Solve the following linear programming problem using the simplex method:

Minimize: z = 4x1 + 6x2 + 7x3, subject to:x1 + x2 + 2x3 20, x1 + 2x2 + x3 30, x1,x2,x3 0.

7.5]

Exercise 7.31: Simplex Method Practice

  Solve the following linear programming problem using the simplex method:

Minimize: z = 40x1 + 48x2 + 30x3, subject to:2x1 + 2x2 + x3 25, x1 + 3x2 + 2x3 30, x1,x2,x3 0.

7.5]

Concepts and connections

Exercise 7.32: Dictionary Optimality

  Conditions in the dictionary. The following is a dictionary of a maximization problem. State conditions (i.e., the range of values) on a1,a2,b,c1,c5,c6 that are required to make the following true. Note: This does not require any simplex pivots.

max 0 + c1x1 + c5x5 + c6x6 x2 = 1 + x1 a1x5 x4 = 2 + x1 + 2x5 x6 x3 = b a2x1 x5 x6

1.
The current solution is feasible and optimal.
2.
The current basic solution is not feasible.
3.
The current basic solution is degenerate.
4.
The current basic solution is feasible, and the LP is unbounded.

7.4; §7.6]

Exercise 7.33: Basic Feasible Solutions

  Consider the following linear programming feasible region in 2 variables that is depicted in the plot below.

maximize 2x1 + x2 subject to 2x1 + 3x2 7 x2 1 x1 x2 4 x1 + 3x2 16 x1, x2 0.

Here is a graph of the feasible region:

Desmos graph of a 2-variable LP feasible region with vertices labeled A, B, C, D used to identify basic and nonbasic variables and to trace pivot moves between adjacent basic feasible solutions.

Figure 7.8: Desmos graph of a 2-variable LP feasible region with vertices labeled A, B, C, D used to identify...

The variables in the augmented linear program are {x1,x2,s1,s2,s3,s4}, where s1 and s2 are the surplus variables of the two constraints and s3 and s4 are the slack variables of the two constraints, in the order listed (matching the labels in the figure). In the context of the simplex method, answer the following questions:

(a) At the basic feasible solution D, which variables are non-basic and which variables are basic?

B = { }, N = { }.

(b) If we pivot from the basic feasible solution at D to the basic feasible solution at C,

7.3, Figure 7.4]

Exercise 7.34: What the ratio test protects

  In the second dictionary of the running example of Section 7.3,

max z = 21 + 1 2x 3 2s3  s.t.  s1 = 2 1 2x + 1 2s3, s2 = 9 3 2x + 1 2s3, y = 7 1 2x 1 2s3, x,y,s1,s2,s3 0,

the entering variable is x, and the ratio test selects s1 (ratio 4) to leave.

1.
Suppose you ignore the ratio test and instead pivot on the s2 row (ratio 6), so that s2 leaves. Compute the resulting basic solution and show that it is infeasible by finding the basic variable that becomes negative.
2.
Explain in general terms what goes wrong when a row other than the minimum-ratio row is chosen: which variables does the minimum ratio protect, and why does overshooting it break feasibility?

7.4, Learning Checkpoint 7.4.1]

Challenge problems

Exercise 7.35: A tie in the ratio test forces degeneracy

  Consider the linear program

max 2x + y  s.t.  x + y 4, 2x + y 8, x,y 0.

1.
Write the initial dictionary for the slack basis and let x enter. Show that the ratio test produces a tie: both s1 and s2 reach zero at x = 4.
2.
Pivot with s1 leaving and write the next dictionary. Show that it is degenerate: a basic variable sits at value zero.
3.
Repeat the pivot with s2 leaving instead, and show that the resulting dictionary is also degenerate. What do you notice about the reduced cost of y in this dictionary, and what does it suggest about the set of optimal solutions?
4.
Explain why this is a general phenomenon: whenever the minimum ratio is attained by two rows, the dictionary after the pivot must be degenerate. Then construct your own linear program, different from the one above, whose first pivot has a tied ratio test.

7.6; §7.4]

Selected Solutions

Solution

(Exercise 7.23)

1. Convert the minimization problem to a maximization problem by negating the objective function:

max 2x1 4x2.

2. Convert the constraint into an equality by introducing a surplus variable s1 0:

x1 + x2 s1 = 3.

3. Convert the constraint into an equality by introducing a slack variable s2 0:

2x1 x2 + s2 = 5.

4. Since x1 is unrestricted, replace it with x1 = x1 x1, where x1,x1 0.

Final Standard Form:

max 2(x1 x 1) 4x 2  s.t. (x1 x 1) + x 2 s1 = 3, 2(x1 x 1) x 2 + s2 = 5, x1,x 1,x 2,s1,s2 0.

Solution

(Exercise 7.24)

1. Convert the minimization problem to a maximization problem by negating the objective function:

max 5y1 + 3y2 y3.

2. Convert the constraint into an equality by introducing a slack variable s1 0:

y1 + 4y2 + s1 = 5.

3. Since y3 is unrestricted, replace it with y3 = y3 y3, where y3,y3 0.

Final Standard Form:

max 5y1 + 3y2 (y3 y 3)  s.t. 2y1 y2 + 3(y3 y 3) = 7, y1 + 4y2 + s1 = 5, y1,y2,y3,y 3,s 1 0.

Solution

[Solution for Exercise 7.25] We will have to do 3 pivots!

We begin with the original linear program:

max 2x + 3y  s.t. s1 = 9 x y, s2 = 16 2x y, s3 = 14 x 2y, x,y,s1,s2,s3 0.

First Pivot: x Enters the Basis

Let x increase first. The ratio test gives 91 = 9 for s1, 162 = 8 for s2, and 141 = 14 for s3. The smallest ratio is 8, so s2 leaves the basis. Rewriting the s2 equation in terms of x and substituting into the other equations and the objective, we obtain:

max 16 + 2y s2  s.t. s1 = 1 0.50y + 0.50s2, x = 8 0.50y 0.50s2, s3 = 6 1.50y + 0.50s2, x,y,s1,s2,s3 0.

Second Pivot: y Enters the Basis

Now y is the only variable with a positive objective coefficient, so y enters. The ratio test gives 10.5 = 2 for s1, 80.5 = 16 for x, and 61.5 = 4 for s3, so s1 leaves. After rewriting the s1 equation in terms of y and substituting into the remaining equations and the objective function, the dictionary becomes:

max 20 4s1 + s2  s.t. y = 2 2s1 + s2, x = 7 + s1 s2, s3 = 3 + 3s1 s2, x,y,s1,s2,s3 0.

Third Pivot: s2 Enters the Basis

The coefficient of s2 in the objective is positive, so s2 enters. In the y row s2 appears with a positive coefficient, so that row imposes no limit; the ratio test gives 71 = 7 for x and 31 = 3 for s3, so s3 leaves. The new dictionary is

max 23 s1 s3  s.t. x = 4 2s1 + s3, s2 = 3 + 3s1 s3, y = 5 + s1 s3, x,y,s1,s2,s3 0.

This is optimal!

Solution

(Exercise 7.26) Add slacks s1,s2 to obtain the initial dictionary

max z = 5x1 + 3x2  s.t. s1 = 12 x1 x2, s2 = 16 2x1 x2.

First pivot: x1 enters (coefficient 5). Ratio test: 121 = 12 and 162 = 8, so s2 leaves. Solving the s2 equation for x1 and substituting gives

max z = 40 + 1 2x2 5 2s2  s.t. x1 = 8 1 2x2 1 2s2, s1 = 4 1 2x2 + 1 2s2.

Second pivot: x2 enters. Ratio test: 81 2 = 16 and 41 2 = 8, so s1 leaves. The new dictionary is

max z = 44 s1 2s2  s.t. x2 = 8 2s1 + s2, x1 = 4 + s1 s2.

Both objective coefficients are negative, so this dictionary is optimal: (x1,x2) = (4,8) with z = 44.

Solution

(Exercise 7.27) The initial dictionary is

max z = 5x1 + 8x2  s.t. s1 = 30 x1 2x2, s2 = 30 3x1 x2.

First pivot: x2 enters (coefficient 8 > 5). Ratio test: 302 = 15 and 301 = 30, so s1 leaves. Substituting x2 = 15 1 2x1 1 2s1 gives

max z = 120 + x1 4s1  s.t. x2 = 15 1 2x1 1 2s1, s2 = 15 5 2x1 + 1 2s1.

Second pivot: x1 enters. Ratio test: 151 2 = 30 and 155 2 = 6, so s2 leaves, and the dictionary becomes

max z = 126 19 5 s1 2 5s2  s.t. x1 = 6 + 1 5s1 2 5s2, x2 = 12 3 5s1 + 1 5s2.

This dictionary is optimal: (x1,x2) = (6,12) with z = 126.

Solution

(Exercise 7.32) The basic solution reads off the constant terms: x2 = 1, x4 = 2, x3 = b, with x1 = x5 = x6 = 0.

1.
Feasible and optimal: feasibility requires every constant term nonnegative, so b 0; optimality requires no improving direction, so c1 0, c5 0, c6 0. The values a1,a2 may be arbitrary.
2.
Not feasible: b < 0 (the constants 1 and 2 are already nonnegative, so only x3 can fail).
3.
Degenerate: b = 0, so that the basic variable x3 sits at value zero.
4.
Feasible and unbounded: we need b 0 together with an entering variable whose objective coefficient is positive and whose column never decreases a basic variable. The variable x5 appears as x5 in the x3 row and x6 appears as x6 in the x4 and x3 rows, so the ratio test always stops them. Only x1 can certify unboundedness: its coefficients are + 1, + 1, and a2, so we need c1 > 0 and a2 0 (with b 0 for feasibility).

Solution

(Exercise 7.35) (a) The initial dictionary is

max z = 2x + y  s.t. s1 = 4 x y, s2 = 8 2x y, x,y,s1,s2 0.

With x entering (and y = 0), the ratio test gives 41 = 4 for s1 and 82 = 4 for s2: a tie at x = 4.

(b) Let s1 leave. Solving the s1 row for x gives x = 4 y s1, and substituting,

max z = 8 y 2s1  s.t. x = 4 y s1, s2 = 0 + y + 2s1, x,y,s1,s2 0.

The basic variable s2 has value 0, so the dictionary is degenerate. (It is also optimal: both reduced costs are negative, and the solution is (x,y) = (4,0) with z = 8.)

(c) Let s2 leave instead. Solving the s2 row for x gives x = 4 1 2y 1 2s2, and substituting,

max z = 8 + 0 y s2  s.t. x = 4 1 2y 1 2s2, s1 = 0 1 2y + 1 2s2, x,y,s1,s2 0.

Again a basic variable ( s1) equals zero, so this dictionary is degenerate as well. The reduced cost of y is exactly 0: increasing y does not change z, which signals that the optimum is not unique along that direction of the boundary (any point of the edge from (4,0) toward the constraint x + y = 4 with 2x + y = 8 held tight gives z = 8 only at (4,0) itself here, since increasing y is blocked at once by s1; the zero reduced cost still flags the possibility of alternative optimal bases).

(d) If two rows tie at the minimum ratio, the entering variable stops at a value where both corresponding basic variables hit zero simultaneously. Only one of them leaves the basis; the other remains basic at value zero, so the new dictionary necessarily has a basic variable equal to zero, which is the definition of degeneracy. Any linear program in which two constraint boundaries pass through the same point of the entering edge works as a construction, for example max x + y subject to x 3, x + 2y 3, x,y 0: entering x gives ratios 31 = 3 and 31 = 3, a tie.

© 2026 Robert Hildebrand and contributors · Licensed CC BY-SA 4.0 · Sources and attribution · Book home