The Simplex Method and Duality
Simplex Method and Duality · Finding the optimum and reading the value of resources
How can we find the optimal solution efficiently, and interpret how valuable our limited resources are? In Chapter 02 we found the optimum by comparing the corner points of the feasible region. With two variables you can check this on a graph, but real problems have hundreds of products and thousands of constraints, so you cannot check every corner point one by one.
Why do we need the simplex method?
The simplex method is an algorithm that finds the optimal solution by moving systematically from one corner point of the feasible region to another, improving the objective value as it goes. Instead of blindly comparing every feasible solution, it only moves from the current corner to a neighboring corner that is better.
The basic idea of the simplex method
Start at x = 0, y = 0. Nothing is produced, so every constraint is satisfied.
Pick a variable that raises profit when increased. Usually the one with the largest unit profit is chosen.
Increase that variable as far as the constraints allow, and swap it into the basis for the variable that hits 0.
When no variable can raise profit any further, you have the optimum.
In Figure 1 the simplex method starts at (0, 0), first increases y, which has the larger unit profit, to arrive at (0, 4), and then increases x to reach (8/3, 8/3). It visited only three of the four corners, and as the problem grows, the share of corners that are never visited becomes much larger.
Slack variables and the simplex tableau
To apply the simplex method, we turn the inequality constraints into equations. If x + 2y of the 8 hours available in process 1 are actually used, we let s1 be the hours left unused and write:
s1, s2: slack variables — the amount of resource left unused
At the start x = y = 0, so s1 = s2 = 8. The variables whose values are determined this way are called basic variables, and the simplex method arranges these equations in a simplex tableau and swaps the basic variables one at a time. The Z row records how much profit falls when each variable is increased by one unit (a negative number means profit rises).
Step 0: (x, y) = (0, 0), Z = 0 · −100 is the smallest entry in the Z row, so y enters
| Basis | x | y | s₁ | s₂ | RHS |
|---|---|---|---|---|---|
| s₁ | 1 | 2 | 1 | 0 | 8 |
| s₂ | 2 | 1 | 0 | 1 | 8 |
| Z row | -60 | -100 | 0 | 0 | 0 |
As y increases, process 1 can hold out until 8/2 = 4 and process 2 until 8/1 = 8. Process 1 runs out first, so its slack variable s1 leaves the basis (the minimum ratio test).
Step 1: (x, y) = (0, 4), Z = 400 · −10 remains in the Z row, so x enters
| Basis | x | y | s₁ | s₂ | RHS |
|---|---|---|---|---|---|
| y | 1/2 | 1 | 1/2 | 0 | 4 |
| s₂ | 3/2 | 0 | -1/2 | 1 | 4 |
| Z row | -10 | 0 | 50 | 0 | 400 |
This time we increase x. The y row gives 4 ÷ (1/2) = 8 and the s2 row gives 4 ÷ (3/2) = 8/3, so s2 leaves.
Step 2: (x, y) = (8/3, 8/3), Z = 1280/3 · no negative entries in the Z row, so this is optimal
| Basis | x | y | s₁ | s₂ | RHS |
|---|---|---|---|---|---|
| y | 0 | 1 | 2/3 | -1/3 | 8/3 |
| x | 1 | 0 | -1/3 | 2/3 | 8/3 |
| Z row | 0 | 0 | 140/3 | 20/3 | 1280/3 |
With no negative entries left in the Z row, increasing any variable no longer raises profit. The optimal solution is x = y = 8/3, Z = 1280/3. The 140/3 and 20/3 in the slack-variable columns of the final Z row are the same values as the shadow prices we will see in Section 6.
What is duality?
If the simplex method is a way of computing the optimal solution, duality is a way of interpreting the same problem from a different point of view.
Maximize profit with the resources available: how much of each product should we make?
Minimize cost while valuing the resources: what value should we put on one unit of time in each process so that it accounts for each product's profit?
Building the dual of the production planning problem
Let the dual variables u and v be the values assigned to one unit of time in each of the two processes. Each process has 8 hours, so the total value of the resources is 8u + 8v. Product A uses 1 hour in process 1 and 2 hours in process 2, so the combined value of those resources must be at least A's profit of $60, and the same goes for B.
Flipping (transposing) the primal's constraint coefficient matrix gives the dual problem. The primal's right-hand side (8, 8) becomes the dual's objective coefficients, and the primal's objective coefficients (60, 100) become the dual's right-hand side.
Strong duality and the value of resources
When both the primal and the dual have optimal solutions, strong duality says the two optimal values are equal. Setting the dual's two constraints as equations and solving gives u = 140/3, v = 20/3, and
The two optimal values match. u and v are the shadow prices of one unit of time in each process. They tell you how much the optimal profit rises if you secure one more hour of that resource while everything else stays the same.
| Resource | Shadow price (per hour) | Range of available hours where the price holds |
|---|---|---|
| Process 1 | 140/3 ≈ $46.67 | 4–16 hours |
| Process 2 | 20/3 ≈ $6.67 | 4–16 hours |
In Figure 3, raising process 1's time from 8 to 9 hours lifts the maximum profit from 1280/3 to $473.33, an increase of exactly 140/3. So in this model, securing extra time in process 1 is worth far more in marginal profit than extra time in process 2. If an extra hour of process 1 costs less than $46.67, adding it pays off. This interpretation, however, holds only in the 4–16 hour range. Beyond 16 hours process 2 becomes the bottleneck, and adding more process 1 time no longer raises profit.
Weak duality and verifying the optimum
By weak duality, the profit of any feasible primal solution can never exceed the resource value of any feasible dual solution.
If a feasible primal solution earns $400 in profit and a feasible dual solution gives a resource value of $440, the optimal profit lies between $400 and $440. In this way the dual provides an upper bound on the optimal value (for a maximization problem), and the moment the two values become equal, both are proven optimal. This is also the principle behind the "optimality gap" that large-scale optimization software reports.
How the simplex method and duality differ
| Aspect | Simplex method | Duality |
|---|---|---|
| Core role | Computes the optimal solution | Interprets the problem's structure and the value of resources |
| Main view | Moves between corners while improving the feasible solution | Links the primal and the dual |
| Typical output | Optimal decision variables | Shadow prices, relation between optimal values |
| Use | Computing production and allocation amounts | Value of adding resources, verifying the optimum |
Using the two ideas together lets you read an optimization result not as a bare number but as real decision information: "if we add this resource, how much more do we make?"
Solving the production planning model with the simplex method reached x = y = 8/3 and a maximum profit of 1280/3 ≈ $426.67 after two basis changes, and the optimal value of the dual problem matched at 1280/3. The shadow prices of process 1 and process 2 are 140/3 ≈ $46.67 and 20/3 ≈ $6.67, so as long as process 1's available time stays within 4–16 hours, adding one hour raises profit by $46.67.
The simplex method finds the optimum, and duality tells you what that optimum means.
- Simplex method: finds the optimum by moving along the corners only in directions that improve the objective.
- Slack variables and the tableau: turn inequalities into equations; once the Z row has no negative entries, you are at the optimum.
- Dual problem: uses the value of one unit of each resource as variables and finds the minimum resource value that accounts for each product's profit.
- Strong · weak duality: Z ≤ W for feasible solutions and Z* = W* at the optimum, so optimality can be verified.
- Shadow price: the increase in optimal profit from one more unit of a resource, within its valid range.
Next is 04 Integer programming. It covers problems where decisions must be whole numbers, such as product quantities, numbers of staff, or numbers of vehicles.