TactivergeLite

Lite / Engineering Complex Systems / Week 30

Linear programming: why the corners win

A workshop has 24 machining hours and 30 assembly hours. Among infinitely many weekly plans, you only need to check four. Why?

About 45 min · 3 goals · Checked by automated tests · Full interactive version

Why should I care?

Linear programmes schedule airlines, blend fuels and allocate cloud servers. With two variables you can see the whole thing, and the picture explains the idea every large solver relies on.

Predict

You maximise 3x + 5y over a polygon-shaped feasible region. Where can the maximum be?

  1. Anywhere inside
  2. At the centre of the polygon
  3. At a corner (or along a whole edge if the objective is parallel to it)
  4. Only at the origin
Guess first, then reveal

Lines of equal profit are parallel. Sliding them outwards, the last feasible point they touch is a corner, unless they line up with an edge, in which case the whole edge ties.

Discover

Read the corner table and find the best corner. Move your trial plan (the square) to a point inside the region and compare its profit. Then raise the profit per chassis until the best corner jumps, and add machining hours to see how much one extra hour is worth.

What the interactive shows (text version)

The explorer shows the feasible region for 2x + y ≤ M (machining) and x + 3y ≤ A (assembly) with x, y ≥ 0, as a shaded polygon. A table lists each corner and its profit c₁x + c₂y; the largest is marked best. With M = 24, A = 30, c₁ = 3 and c₂ = 5 the corners are (0, 0), (12, 0), (0, 10) and (8.4, 7.2), and the optimum is 61.20 at (8.4, 7.2). Adding one machining hour raises it to about 62.00.

You can also open the interactive on the full site when you have a faster connection.

Watch (optional)

Watch for: Follow the corner-point method: shade the constraints, list the vertices, test the objective at each.

A worked graphical linear programme: shade the constraints, find the corners, test the objective at each.

“Linear Programming (maximize the objective function given the constraints)” by Math Problems Solved Craig Faulhaber (opens YouTube; streaming video uses a lot of data)

The video is optional. Everything you need is in this lesson's text.

Understand

Drawing the region

Turn each inequality into its boundary line (2x + y = 24 meets the axes at (12, 0) and (0, 24)), then shade the side that satisfies it (test the origin: 0 ≤ 24, so the origin's side). Non-negativity keeps you in the first quadrant. The overlap of all shaded regions is feasible.

Binding and slack constraints

At the optimum, a constraint that holds with equality is binding: that resource is fully used. One with spare capacity has slack. In the example both machining and assembly bind at (8.4, 7.2). A non-binding constraint could be loosened without changing the answer at all.

Sensitivity: what's an extra hour worth?

Raise machining from 24 to 25 hours and re-solve: the optimum rises by the shadow price of machining. In the explorer it is about £0.80 per hour. If an extra hour costs less than its shadow price, buy it. Changes to the objective coefficients can make the best corner jump to a neighbour: the plan is stable only within a range of prices.

Beyond two variables

Real problems have thousands of variables, but the theorem still holds: optima sit at vertices of a high-dimensional polytope. The simplex method walks from vertex to better neighbouring vertex; interior-point methods cut through the middle. If the variables must be whole numbers (integer programming) the corner can be fractional, and the problem becomes much harder.

Explain it another way

Intuitive

Imagine a ruler laid across the region at a slant set by the profits. Push it as far as it will go while still touching the region: it will last touch a corner.

Technical

Standard form: maximise cᵀx subject to Ax ≤ b, x ≥ 0. Feasible set is a convex polyhedron; if bounded and non-empty, an optimal basic feasible solution (vertex) exists. Dual variables give shadow prices.

Mathematical

Any feasible point is a convex combination of vertices: x = Σλᵢvᵢ with λᵢ ≥ 0, Σλᵢ = 1. Then cᵀx = Σλᵢ cᵀvᵢ ≤ maxᵢ cᵀvᵢ. So the maximum over the polygon equals the maximum over its vertices.

Applied

Power-grid operators solve linear programmes every few minutes to decide which generators to run at what output, meeting demand at least cost while respecting line limits.

Derivation: The corner-point theorem in two dimensions
  1. Maximise z = c₁x + c₂y subject to linear inequalities. Each inequality is a half-plane; their intersection is a convex polygon (the feasible region).

  2. The level sets z = k are parallel straight lines with normal vector (c₁, c₂). Increasing k slides the line in the direction (c₁, c₂).

  3. Suppose an optimum were at an interior point. A small step in direction (c₁, c₂) stays feasible and increases z, a contradiction. So the optimum is on the boundary.

  4. On an edge, z varies linearly along the edge, so it is largest at one of the edge's two endpoints (or constant, if the edge is parallel to the level lines).

  5. Therefore some vertex is optimal. Algorithm: find every vertex (intersect pairs of constraint lines, keep the feasible ones), evaluate z at each, take the largest.

  6. Example: 2x + y ≤ 24, x + 3y ≤ 30, x, y ≥ 0. Crossing: from the first y = 24 − 2x; substitute: x + 72 − 6x = 30, x = 8.4, y = 7.2. Corners (0, 0), (12, 0), (0, 10), (8.4, 7.2). With z = 3x + 5y: 0, 36, 50, 61.2. The optimum is £61.20 at (8.4, 7.2).

Worked example 1

Maximise 4x + 3y subject to x + y ≤ 10, 2x + y ≤ 16, x, y ≥ 0.

Corners: (0, 0) → 0; (8, 0) → 32; (0, 10) → 30; crossing: subtract the equations, x = 6, y = 4 → 36. Optimum 36 at (6, 4). Both constraints bind.

Common mix-ups

Practice

Practice, not a test. Answers are checked on our server; a wrong answer gets a hint and another try. Nothing is saved.

£

£

Practice 4. At the optimum, the assembly constraint has 6 hours of slack. What happens to the optimum if you buy 4 more assembly hours?
Practice 5. The LP optimum is 8.4 frames and 7.2 chassis, but you can only build whole items. What is true?

Apply it

A rover's science day: x hours of driving (needs 60 W) and y hours of imaging (needs 25 W). Energy ≤ 300 Wh, x + y ≤ 8 h, x ≤ 4 h. Science value 2x + 3y. Draw the region, find the corners and the optimum, and say which constraint you'd relax first.

Reflect

Where in daily life do you face a linear trade-off with a hard limit? Where is your corner?

Write your answer on paper or in your own notes. Lite never stores what you write.

← Formulate first: variables, objectives, constraints and Pareto frontsSearching a design landscape: grids, gradients and local minima →