LINEAR PROGRAMMING
Chapter 12: Linear Programming
Chapter 12
Linear Programming
Big idea: when you have limited time, material or money, many plans are possible but only one is best. Linear programming shows how to find the best plan with a picture and a short list of corner points.
12.1 Introduction
A small workshop makes two products, P and Q. Making P takes hours of cutting and hours of finishing. Making Q takes hours of cutting and hours of finishing. The workshop has hours of cutting time and hours of finishing time each week. Each P gives a profit of units and each Q gives units. The owner asks: how many of each product should we make to earn the most profit?
Many plans are possible. The table tries five of them. A plan is allowed only if it fits inside both time limits.
| Plan (P, Q) | Cutting hours used | Finishing hours used | Allowed? | Profit |
|---|---|---|---|---|
| Yes | ||||
| Yes | ||||
| Yes | ||||
| Yes | ||||
| No | — |
The plan needs cutting hours, but only are available, so it is not allowed. Among the other plans, gives the most profit. But is it the best of all possible plans? There are infinitely many plans if parts of a product are allowed, and even with whole numbers there are far too many to try one by one.
We need a method that is sure to find the best plan. Linear programming is that method. It works when:
- you want to make one quantity as large (or as small) as possible, for example profit or cost;
- the limits on time, material or space are all straight-line conditions such as .
Problems like this appear everywhere: planning production, mixing food to meet nutrition needs at lowest cost, and moving goods between places at the least shipping cost. In this chapter we study problems with two unknowns, because then we can draw a picture and read the answer from it.
12.2 Linear Programming Problem and its Mathematical Formulation
Every linear programming problem (LPP) has the same parts. Look back at the workshop and give each part its name.
- Decision variables. The numbers you can choose. Here = number of P made and = number of Q made.
- Objective function. The quantity you want to make as large or as small as possible, written with the variables. Here the profit . "Optimise" means maximise or minimise.
- Constraints. The limits. Here cutting time and finishing time .
- Non-negativity conditions. You cannot make a negative number of products: and .
The word linear means that the objective function and every constraint are straight-line expressions: each variable appears only to the first power, and variables are never multiplied together. So is allowed, but or is not.
- A feasible solution is any pair that satisfies all constraints and the non-negativity conditions.
- The feasible region is the set of all feasible solutions.
- An optimal solution is a feasible solution that gives the best value of the objective function. The best value is called the optimal value.
The line splits the plane into two sides. One side satisfies and the other does not. To find which side, test a point. The origin gives , which is true, so the origin side is the allowed side. The point gives , which is false. The picture shows the allowed side, kept to the part where and . It is a triangle with corners , , .
A triangle with corners at (0, 0), (8, 0) and (0, 12), shaded. The slanted side lies on the line 3x plus 2y equals 24. Points inside the triangle satisfy the constraint, points beyond the slanted line do not.
When there are several constraints, the feasible region is the part of the plane that is on the allowed side of every line at once. It is always a convex polygon (or an unbounded region): a shape with no dents, where the straight line between any two of its points stays inside it.
12.2.1 Mathematical formulation of the problem
To formulate a problem means to turn the words into mathematics. You do not solve anything yet. Follow these steps every time:
- Read the problem and decide what you are choosing. Name these decision variables and , and say what they mean, with units.
- Write the objective function and say whether to maximise or minimise it.
- Write one constraint for each limit. Check the direction: "at most" gives , "at least" gives .
- Add and .
This is the workshop from Section 12.1.
| Product P | Product Q | Available | |
|---|---|---|---|
| Cutting (hours) | |||
| Finishing (hours) | |||
| Profit (units) |
Let = number of P made and = number of Q made. The problem is:
A quick check of one plan: making of P and of Q uses cutting hours and finishing hours. Both are within the limits, so the plan is allowed (confirmed by computer), and it gives .
A farm mixes two foods, F1 and F2, for its animals. Each kilogram of F1 gives units of protein and unit of iron. Each kilogram of F2 gives unit of protein and units of iron. Each day the animals need at least units of protein and at least units of iron. F1 costs units per kilogram and F2 costs units per kilogram. Find the cheapest mix.
Let = kilograms of F1 and = kilograms of F2 per day. The goal is a minimum cost, and the needs are "at least", so the constraints use :
Check: the mix , gives units of protein and units of iron, which meets both needs (confirmed), at a cost of .
A shop needs at least boxes of goods. Depot A can send at most boxes and depot B can send at most boxes. Sending a box from A costs units and from B costs units. How should the shop order to pay the least?
Let = boxes from A and = boxes from B.
Check: ordering boxes from A and from B gives boxes in total, within both depot limits (confirmed), at a cost of .
A bakery makes loaves ( per day) and rolls ( per day). A loaf needs minutes of oven time and minutes of mixing. A roll needs minutes of oven time and minutes of mixing. The oven is available for minutes and the mixer for minutes each day. A loaf gives profit units and a roll gives . Formulate the problem to find the plan with the most profit.
Answers
- Maximise subject to (oven), (mixer), , . As a check, loaves and rolls use oven minutes and mixer minutes, which is allowed (confirmed), and give .
12.2.2 Graphical method of solving linear programming problems
With two variables we can solve an LPP by drawing it. The method has six steps:
- Formulate the problem (Section 12.2.1).
- Draw each constraint as a straight line, then use a test point (usually ) to decide which side is allowed. The feasible region is where all allowed sides overlap, inside , .
- Find the corner points of the region: the points where two boundary lines meet. Solve the two line equations together.
- Calculate the objective function at every corner point.
- Compare the values (the rule in the next paragraphs tells you how).
- Write the answer in words, with the units.
Maximise subject to , , , .
The corners on the axes are easy: , (where meets ) and (where meets ). The fourth corner is where the two slanted lines meet. Divide the second equation by to get . Subtract this from : , so and . The corner is .
The feasible region of the workshop problem, a shaded four-sided polygon with corners at (0, 0), (8, 0), (4, 6) and (0, 8). Two solid lines mark its slanted sides, 3x plus 2y equals 24 and 2x plus 4y equals 32. Three dashed parallel lines show profit values 200, 320 and 460. The line for 460 just touches the corner (4, 6).
| Corner point | Z = 40x + 50y |
|---|---|
The largest value is at . So the workshop should make of P and of Q each week, for a profit of units.
Think of the profit lines . For each value of it is a straight line, and all these lines are parallel. As grows, the line slides away from the origin. The best plan is on the last such line that still touches the feasible region. Because the region is a polygon with straight sides, the last point touched is a corner (or a whole side, which then has corners at both ends). The picture shows this for .
This idea is stated in two theorems. We accept them without a long proof.
Theorem 1. If a linear programming problem has an optimal value, then it is attained at a corner point of the feasible region.
Theorem 2. If the feasible region is bounded (it fits inside some circle), then the objective function has both a maximum value and a minimum value, and each is attained at a corner point.
If two corners both give the optimal value, then every point on the line segment between them is also optimal. We look at this below.
Minimise subject to , , , (the diet problem from Section 12.2.1).
This time the region is unbounded: it goes on for ever to the right and upwards. The corners are , , . The solution of and is .
The unbounded feasible region of the diet problem, shaded, lying above and to the right of two lines. The corners are (0, 9), (2, 3) and (8, 0). The region is cut off at the edge of the picture. A dashed line 4x plus 3y equals 17 passes through the corner (2, 3) and no part of the region lies below it.
| Corner point | Z = 4x + 3y |
|---|---|
The smallest corner value is at . But Theorem 2 does not apply, because the region is unbounded. A smallest corner value is only a candidate. We must check it with the half-plane test:
Here the half-plane misses the region completely (the picture shows the whole region on or above the dashed line, and the computer confirms that no feasible point gives a smaller value). So the minimum cost is , using kg of F1 and kg of F2. For a maximum there is none: the point is allowed and gives , and is allowed and gives . The cost can be made as large as you like.
Minimise subject to , , , .
The unbounded feasible region above two lines, shaded. The corners are (0, 6), (2, 2) and (6, 0). The region extends upwards and to the right beyond the edge of the picture, including the point (7, 0) on the horizontal axis.
| Corner point | Z = -x + y |
|---|---|
The smallest corner value is at . Is it the minimum? Test a point of the region to the right of the corner: is allowed and gives , which is smaller. In fact, moving right along the axis makes smaller and smaller. So there is no minimum, even though the table has a smallest corner value. (The computer agrees: this problem is unbounded.) The same region with does have a minimum, namely at , because moving away from the origin there only makes larger.
Take the workshop region again, but change the profits to and units: maximise . The profit lines now have the same slope as the cutting-time line , because . So the last profit line to touch the region lies along a whole side. The corners and both give . So does every point on the side between them, for example : it is allowed and gives . The problem has many optimal solutions, and every one has the same optimal value.
Maximise subject to , , , . The first says is at most . The second says it is at least . No point can do both, so the two allowed sides do not overlap. The feasible region is empty: there are no corners, and the problem is infeasible (it has no solution). Checking whole-number or fractional points will not help.
Maximise subject to , , , where and must be whole numbers of items. The graphical method gives the corner with . But you cannot make of an item. We test whole-number plans directly (the computer tried every whole pair with ). The best whole-number plan is with , which is below .
EXERCISE 12.1
- Maximise subject to , , and .
- Minimise subject to , , and .
- Maximise subject to , , , and .
- A small factory makes desk lamps ( per week) and floor lamps ( per week). A desk lamp needs hours of wiring and hour of painting. A floor lamp needs hours of wiring and hours of painting. There are hours of wiring and hours of painting each week. A desk lamp gives profit units and a floor lamp . Formulate the problem and find the weekly plan with the most profit.
- Two feeds, A and B, are mixed for a farm. Each kilogram of A has units of protein and unit of vitamins. Each kilogram of B has unit of protein and units of vitamins. The daily mix must have at least units of protein and at least units of vitamins. A costs units per kilogram and B costs . Find the cheapest mix.
- Maximise subject to , and .
- Maximise subject to , , and .
- Maximise subject to , , , and .
Answers
- Corner points and values of : : ; : ; : ; : . The maximum value is , at .
- Corner points and values of : : ; : ; : . The minimum value is , at .
- Corner points and values of : : ; : ; : ; : . The maximum value is , at .
- Maximise subject to , , . Corner points and values of : : ; : ; : ; : . The maximum value is , at . The corner is a whole-number plan, and the computer's check of every whole-number plan up to agrees: at .
- Let = kg of A and = kg of B. Minimise subject to , , . Corner points and values of : : ; : ; : . The minimum value is , at . The region is unbounded, so the half-plane test is needed; the computer confirms that the minimum exists.
- Corner points and values of : : ; : . The region is unbounded and keeps improving along it, so there is no maximum.
- No point satisfies all the constraints together, so the feasible region is empty and the problem has no solution.
- Corner points and values of : : ; : ; : ; : ; : . The maximum value is , at every point of the line segment joining and (many optimal solutions). The value is the same at and , because the profit line is parallel to the side .
Summary
- LPP: optimise (maximise or minimise) a linear objective function subject to linear constraints and , .
- Feasible solution: a point satisfying all constraints. Feasible region: the set of all of them (a convex polygon, bounded or unbounded). Optimal solution: a feasible point giving the best value of .
- Formulating: name the variables, write the objective function, write one constraint per limit ("at most" is , "at least" is ), add .
- Corner point method: draw the region, find the corners, evaluate at each corner, compare.
- Theorem 1: if an optimal value exists, it is attained at a corner point.
- Theorem 2: if the region is bounded, both a maximum and a minimum exist, at corner points.
- Unbounded region: the best corner value (or ) is only a candidate. It is the minimum (maximum) only if the open half-plane () has no point in common with the region. Otherwise there is no minimum (maximum).
- Many optimal solutions: if two corners give the same best value, every point on the segment between them does too.
- Infeasible: if the allowed sides do not overlap, the region is empty and there is no solution.
- Whole numbers: a corner may have fractions. If items must be whole, test whole-number plans directly.
Historical Note
Linear programming grew out of the need to plan large operations with limited resources. It became important during the Second World War, when planners had to decide how to use scarce supplies, vehicles and workers as well as possible.
- About 1941: the mathematician Leonid Kantorovich and the economist Frank Hitchcock, working separately, each described the transportation problem: how to send goods from several sources to several destinations at the least total cost.
- 1945: the economist George Stigler described the diet problem: how to choose foods so that nutrition needs are met at the lowest cost.
- 1947: George Dantzig invented the simplex method, a step-by-step procedure that solves any linear programming problem in a finite number of steps, whatever the number of variables.
- 1975: Kantorovich and Tjalling Koopmans received the Nobel Prize in Economics for their pioneering work on the best use of resources.
With computers, the simplex method and later methods now solve problems with thousands of variables, in industry, transport, energy and many other areas. The two-variable pictures in this chapter show the main idea behind all of them: the best plan sits at a corner of the region of allowed plans.