Linear Programming The Modelling Cycle in Decision Maths Accept solution Yes Real life Problem No Compare the solution with reality – is it realistic? Interpret the solution in terms of the original problem Review Make simplifying assumptions Define variables and decide on the mathematical techniques to be used Solve the mathematical problem What is linear programming? A linear programming problem consists of a collection of linear inequalities of a number of real variables and a given linear function of these real variables which is to be maximised or minimised. Linear Programming Decision making is a process that has to be carried out in many areas of life. After the Second World War a group of American mathematicians developed some mathematical methods to help with decision making. They produced mathematical models that turned the requirements, constraints and objectives of a project into algebraic equations. Linear programming is the process of solving these equations by searching for an Optimal Solution. The optimal solution is the maximum or minimum value of a required function. Linear programming methods are some of the most widely used methods employed to solve management and economic problems, they can be applied to a variety of contexts, with enormous savings in money and resources. Linear Programming 1. Be able to manipulate inequalities algebraically. 2. Be able to illustrate linear inequalities in two variables graphically. 3. Be able to formulate simple maximisation of profit and minimisation of cost problems. • Formulation of constrained optimisation problems 4. Be able to use graphs to solve 2-D problems, including integer valued problems. • Solution of constrained optimisation problems 5. Be able to interpret solutions, including spare capacities. • Algebraic interpretation of the graphical solution in 2-D. Key Points 1. Formulating • Let x be the number of … , let y be the number of … • Text into linear constraints • Have you used all the information in the question? • Don’t forget x ≥ 0, y ≥ 0 2. Graphing • Two variables only • Use intercepts on axes, where feasible to do so • Label equations of lines; show inequalities by shading Key Points 3. Solving • The objective may be to minimise or maximise • Plot an example objective function (choose RHS) • Test the vertices of the Feasible Region. • The solution could be all the points along one edge. 4. Interpreting • Does it have to be an integer solution? • Are there alternative feasible solutions? • You may need to comment on the solution. Example: A small factory produces two types of toys: bicycles and trucks. In the manufacturing process two machines are used: the lathe and the assembler. The table shows the length of time needed for each toy: The lathe can be operated for 16 hours a day and there are two assemblers which can each be used for 12 hours a day. Each bicycle gives a profit of £16 and each truck gives a profit of £14. Formulate and solve a linear programming problem so that the factory maximises its profit. Example: A small factory produces two types of toys: bicycles and trucks. In the manufacturing process two machines are used: the lathe and the assembler. The table shows the length of time needed for each toy: The lathe can be operated for 16 hours a day and there are two assemblers which can each be used for 12 hours a day. Each bicycle gives a profit of £16 and each truck gives a profit of £14. Formulate and solve a linear programming problem so that the factory maximises its profit. Bicycle Truck Lathe 2 hours 1 hour Assembler 2 hours 3 hours 1. Formulate the problem Let x be number of bicycles made Let y be number of trucks made. Objective Function Maximise P = 16x + 14y Subject to constraints 2x + y 16 Lathe 2x + 3y 24 Assembler x, y 0 There are two assemblers Define variables and decide on the mathematical techniques to be used Finding the Optimum Value Method 1: Tour of vertices (0,8) profit = £112 (6,4) profit = £152 (8,0) profit = £128 Optimal solution is to make 6 bicycles and 4 trucks. Profit £152 Method 2: Profit Line Draw a line through the origin parallel to the gradient of the profit function. Move this line up the y-axis until it is just leaving the feasible region – the point at which it leaves the feasible region is the optimum value. Profit line y = 1/14 (P – 16x) Using ICT Finding the Optimum Value using AUTOGRAPH If you have Autograph you can use this to solve graphical LP problems 2. Using the on-line resources (www.mei.org.uk) LinPro Integer Prog What happens next? In real life you would go back to the original situation and assess whether this solution is reasonable and feasible before deciding whether to implement it. Compare the solution with reality – is it realistic? Minimisation problems Minimise C = 3x + 4y subject to the constraints: 3x - 4y ≤ 12, x + 2y ≥ 4 x ≥1, y ≥ 0. The feasible region for this set of constraints is shown on the graph. The value of C at each vertex C = 3x + 4y (1, 1.5): 3(1)+4(1.5) = 9 (4, 0): 3(4)+4(0) = 12 solution x = 1, y = 1.5, C = 9. January 2010 question 4 Link to the examination paper Link to FMSP revision recording January 2010 question 4 x June 2010 question 4 Link to the examination paper Link to FMSP revision recording June 2010 question 4 x What happens if there are more than 2 variables? In geometric terms we are considering a closed, convex, region, P, (known as a polytope), defined by intersecting a number of half-spaces in n-dimensional Euclidean space (these are the constraints). If the objective is to maximise a linear function L(x), consider the family of hyperplanes, H(c), defined by L(x) = c. As c increases, these form a parallel family. We want to find the largest value of c such that H(c) intersects P. Optimal Solution Starting Vertex What is linear programming? In this case we can show that the optimum value of c is attained on the boundary of P using the extreme point theorem If P is a convex polygon and L(x) is a linear function then all of the values of L(x) at the points of P, both maximum and minimum occur at the extreme points. Hence, if an LP has a bounded optimal solution then there exists an extreme point of the feasible region that is optimal Convex region An Introduction to Linear Programming and the Theory of Games by Abraham M Glicksman Published by Dover publications Isbn 0-486-41710-7 Concave region Introducing the simplex method Methods for finding this optimum point on P work in several ways: some attempt to improve a possible point by moving through the interior of P (so-called interior point methods); others start and remain on the boundary searching for an optimum. Optimal Solution Starting Vertex Solution by simplex Graphical method 1. Formulate the problem Objective Function Subject to constraints Solve problem Simplex method Let x be no. of bicycles made Let y be no. of trucks made. Maximise P = 16x + 14y Lathe 2x + y 16 Assembler 2x + 3y 24 Maximise P – 16x – 14y = 0 2x + y + s1 =16 2x + 3y + s2 = 24 y 16 14 12 10 8 6 4 2 x 0 0 2 4 6 8 10 12 14 Solution: P = 152, x = 6, y = 4 16 p x y 1 -16 -14 0 2 1 s1 0 1 s2 0 0 0 16 0 2 0 1 24 24/2=12 1 0 0 0 1 0 0 0 1 128 8 8/0.5=16 8 8/2=4 1 0 0 0 1 0 3 -6 8 0.5 0.5 2 -1 0 0 1 ratio test 5 3 152 0.75 -0.25 6 -0.5 0.5 4 16/2=8 Jeff Trim jefftrim@furthermaths.org.uk Central Coordinator & Area Coordinator, SE Region Further Mathematics Support Programme