The simplex algorithm iterates between basic feasible solutions of the feasible region, improving the objective each step. It stops when no adjacent vertex improves it further.
Named after simplices. It moves along the edges between adjacent extreme points (vertices) of the feasible polyhedron, which can be decomposed into simplices, improving the objective at each step.
Conditions for Use
All of the following must hold:
- LP in standard form
Objective to maximize, constraints as equalities, all variables , RHS . Per the fundamental theorem. - An initial basic feasible solution is available
With all constraints and non-negative RHS, the slack variables give one directly. Otherwise use artificial variable methods (big-M or two-phase) to start. - Feasible region is non-empty
Infeasible LPs have no basic feasible solution to iterate from.
Cycling on degenerate solutions is possible but preventable with anti-cycling rules (Bland’s rule). The algorithm handles unboundedness by detecting it during the ratio test.
Represents the system of equations and objective row together for iteration.
Suppose a linear program with constraints and variables is in standard form.
- Rows
1 objective row, plus rows (1 per constraint). - Columns
1 per variable, plus 1 for right-hand-side (RHS).
A basic feasible solution reads basic variables directly from the RHS. Non-basic variables are 0.
Iteration Steps
Each iteration moves from one basic feasible solution to an adjacent one with a better or equal objective value.
Repeat the following steps until an optimal solution is found.
Check Optimality
Inspect the objective row coefficients. If all are (maximization, standard form), the current solution is optimal. Stop.
Select Entering Variable
Entering variable is the non-basic variable selected to become basic. Chosen as the variable with the most negative objective row coefficient.
Select Leaving Variable
Leaving variable is the basic variable selected to become non-basic. Chosen by the minimum ratio test on the entering variable’s column.
Minimum Ratio Test
In the entering variable’s column, for each constraint row with , compute:
The row with the smallest non-negative ratio determines the leaving variable.
If no exists in the entering column, the problem is unbounded. Stop.
Pivot
The intersection of the entering column and leaving row.
- Divide the pivot row by the pivot element, making its entering-column entry 1.
- For every other row (constraint rows and the objective row), subtract times the new pivot row, where is that row’s current entering-column entry. Applied across all columns including RHS.
This zeroes the entering column everywhere except the pivot row, making the entering column a unit vector. On the objective row the same operation removes the negative reduced cost and updates .
Worked Example
Standard form adds slacks , one per constraint:
The objective row is written as . Initial basis .
entering column leaving row pivot element updated this step
Basic feasible solution , . Two negative objective coefficients (, ), so not optimal.
Most negative objective coefficient is , so enters. Minimum ratio is in row , so leaves. Pivot element is .
After the pivot . Now is the most negative, so enters. Minimum ratio is in row , so leaves. Pivot element is .
All objective coefficients are non-negative. Optimal at , , .
Special Cases
Read off the final tableau:
- Unique optimal solution
Every non-basic variable has a strictly positive objective row coefficient. - Alternate (infinite) optimal solutions
A non-basic variable has a 0 objective row coefficient. Every convex combination of the corresponding basic feasible solutions is also optimal. - Unbounded solution
No positive entry in the entering variable’s column during the minimum ratio test.
Tie in Entering Variable
Several non-basic variables share the most negative objective row coefficient. Break the tie arbitrarily; any choice reaches an optimal solution, though the iteration count may differ.
Tie in Leaving Variable
Several rows share the minimum ratio. Breaking the tie arbitrarily leaves a basic variable at 0, giving a degenerate basic feasible solution. This risks cycling (revisiting a basis without improving the objective), avoided by a fixed tie-breaking rule (Bland’s rule: prefer the lowest-indexed variable).
Other Uses of Simplex
- Constructing a tableau for a given set of basic variables
Row-reduce the constraint matrix on those columns until they form an identity matrix. - Solving a system of linear equations
Add an artificial objective (minimize the sum of artificial variables) and run simplex; a 0 optimal value with all artificial variables out of the basis gives a solution. - Finding the inverse of a matrix
Run simplex with each column of the identity matrix as a separate RHS; the columns under the original identity’s position in the final tableau form the inverse.