Topic 5 · Lesson 3 of 5
The simplex algorithm
Slack variables
A slack variable turns a constraint into an equation: becomes with . The slack measures the unused amount of that resource. At the origin, the slack variables equal the right-hand sides, which gives a starting solution.
The simplex tableau
Write the objective as , so the objective row has the negatives of the coefficients. Each constraint is one row. The basic variables are listed down the side: at the start, the slack variables. Variables not in the basis (non-basic) are 0.
The algorithm
- Pivot column: the column with the most negative entry in the objective row. (If there are no negative entries, the tableau is optimal: stop.)
- Pivot row: for each row with a positive entry in the pivot column, divide the value by that entry (the ratio). The row with the smallest ratio is the pivot row. The pivot is where the pivot row and column cross.
- Divide the pivot row by the pivot, so the pivot becomes 1. The pivot column's variable replaces that row's basic variable.
- Add or subtract multiples of the new pivot row to every other row, including the objective row, so that every other entry in the pivot column becomes 0. State the row operations you use.
- Repeat until there are no negative entries in the objective row.
The smallest ratio stops a variable going negative: it is how far you can increase the entering variable before one of the constraints runs out.
Worked example
The simplex algorithm
For the problem above: the most negative entry is , so enters. Ratios: , , . The smallest is in row , so the pivot is the 2. Divide row by 2, then R1 − new R3, R2 − new R3, R4 + 3 × new R3:
Show solutionHide solution
Now has the only negative entry, . Ratios: , , , so the pivot is in row . Multiply row by 2, then R2 − × new R1, R3 − × new R1, R4 + × new R1:
No negative entries remain, so this is optimal: , , , with (4 hours of moulding unused) and (resin and finishing fully used). This matches the graphical solution: each iteration moved to a neighbouring vertex, to to .
Try it: step through this example, or your own problem, one decision at a time, and watch each tableau move to a new vertex of the feasible region. The presets include two-stage and big-M problems.
Try it: simulation
Simplex method
Loading the simulation…
Reading a tableau
- Basic variables take the values in the Value column; non-basic variables are 0.
- The objective row can be read as an equation. In the final tableau above, , so : increasing any non-basic variable from 0 would reduce , which is why the tableau is optimal.
- For a minimisation problem, maximise instead.
Practise this topic
Both are part of Premium.