Linear programming An area of relatively recent development in Mathematics, and one which has a financially important application, is that of linear programming It is a method for maximising or minimising variables, subject to constraints. This can be applied to maximising profit, given constraints on time, material & money Or applied to minimising costs, given constraints Eg Al is buying some cows and sheep for his farm. He buys c cows at £120 each He buys s sheep at £200 each. c s 10 He wants at least 10 animals in total. He wants more sheep than cows. He has a maximum of £1800 to spend. s c 120c 200s 1800 Write down three inequalities involving c and s By the end of the module you will know how to find a possible combination of cows and sheep that satisfies all 3 inequalities. Linear programming We will look in more detail about how to sketch inequalities, but for now, just to give an overall sense of the purpose of the method… Eg from previously Al is buying c cows and s sheep for his farm. Three inequalities involving c and s are: c s 10 s c 120c 200s 1800 What possible combinations could Al buy? Al can sell the produce of each cow for £150 and the produce of each sheep for £450. How many of each should he buy to maximise his profit? Profit 150c 450 s Cows Sheep Profit 3 7 £3600 4 6 £3300 5 6 £3450 Sketching regions Eg find the region that satisfies the inequalities: 2 x y 30 y 2x y6 2 x 3 y 36 0 0 the 36line Eliminate below the line 0 0 30 so eliminate above line y 6above 0 10 If we want eliminate below sothe eliminate theas line 2 x y 30 2 x y 30 x 0 y 30 (0,30) Then plot these lines using: y 0 x 15 (15,0) y 2x First identify Test a the coordinate lines of the notboundaries on the line to of each Either use intercept and gradient to plot region by see replacing which side inequality satisfies signs the with signs yinequality 2equals x Or find where each line intersects the axes Gradient = 2, Intercept = 0 2 x 3 y 36 y6 Horizontal line through 6 y6 Test Test aa coordinate coordinate not on on the the line line Test a not coordinate not on the line 2 x 3 y 36 x 0 y 12 (0,12) y 0 x 18 (18,0) Eg find the coordinates of the vertices of the feasible region below y 2x 2 x y 30 A is at the intersection of: y 2 x (1) 2 x y 30 (2) A Sub (1) in (2): 4 x 30 x 7.5 Sub x = 7.5 in (1): y 15 R So A has coordinates (7.5,15) y6 2 x 3 y 36 Eg find the coordinates of the vertices of the feasible region below y 2x 2 x y 30 B is at the intersection of: y 6 (1) 2 x y 30 (2) Sub (1) in (2): 2 x 6 30 x 12 R So B has coordinates (12,6) B y6 2 x 3 y 36 Eg find the coordinates of the vertices of the feasible region below y 2x 2 x y 30 C is at the intersection of: y 6 (1) 2 x 3 y 36 (2) Sub (1) in (2): 2 x 18 36 x9 R So C has coordinates (9,6) C y6 2 x 3 y 36 Eg find the coordinates of the vertices of the feasible region below y 2x 2 x y 30 D is at the intersection of: y 2 x (1) 2 x 3 y 36 (2) Sub (1) in (2): 8 x 36 x 4.5 D Sub x = 4.5 in (1): y 9 R So D has coordinates (4.5,9) y6 2 x 3 y 36 In linear programming, you need to be able to draw the line of an equation where, effectively, the intercept is a variable. Consider: 3 x 5 y c 5 y c 3x y c 3 x 5 5 c 3 so the gradient is and the intercept is 5 5 ie you know the gradient but not the intercept The intercept is a function of c As c is varied, so will the intercept, but not the gradient Watch the demo! Whatever the value of c, you get parallel lines So to draw 3 x 5 y c, draw any line with a gradient of 3 5 If ax by c then y This means a c a x and the line will have gradient b b b a b Eg 3 x 5 y c has gradient 3 5 When drawing this, we could imagine 3 triangles repeatedly, 5 or use a larger similar triangle like: 12 or 20 300 500 Depending on the scale of the axes, this may be a lot faster for accurately sketching a line Eg show a suitable line, for each axes, of the equation 3 x 5 y c 3 use 5 use 30 3 6 10 5 50 Eg John makes £1 profit for every chocolate brownie he sells and £2 for every muffin. Using x as the number of brownies he sells and y as the number of muffins he sells, write an equation for his total profit P x 2y P If To he increase needs toprofit, make move a profit ofobjective £240, combination he sell? £120, what £180, the line away fromcould the origin x 2 y 180 240 120 (0,60), he sells no brownies and 60 muffins (20,50), he sells 20 brownies and 50 muffins x 2(40,40), y 240 he sells 40 brownies and 40 muffins (60,30), he sells 60 brownies and 30 muffins (80,20), he sells 80 brownies and 20 muffins x 2 y 180 (100,10), he sells 100 brownies and 10 muffins (120,0), he sells 120 brownies and no muffins x 2 y 120 Eg The feasibility region of a linear programming problem is given below. Use the objective line method to identify the optimum solution if the aim is to: Maximise P x 2 y The optimum solution is: Increase the profit byline Draw a ‘suitable’ with The optimum point isimagining the last the line sliding away from the the gradient value x =correct 10, within y =the 10,critical P = 30region origin, keeping it parallel 1 use 10 2 20 Eg The feasibility region of a linear programming problem is given below. Use the objective line method to identify the optimum solution if the aim is to: Maximise N 3 x y Draw aoptimum ‘suitable’ line withis: Increase the profit by imagining The solution The optimum point is the last the correct gradient the linewithin sliding away from the value the critical region x = keeping 20, y = 0,it N = 60 origin, parallel 3 use 12 1 4 Eg The feasibility region of a linear programming problem is given below. Use the objective line method to identify the optimum solution if the aim is to: Minimise M 200 x 200 y The optimum solution is Minimise bypoint imagining the The not optimum a whole number is the and last Draw a ‘suitable’ line with line sliding the value we within totowards the solve critical region theneed correct gradient origin, keeping itequations parallel simultaneous to find their values 200 use 12 200 12 The fact that the optimal point is always a vertex of the feasibility region gives rise to a second method of identifying the optimal point called vertex testing With this method, we find the value of the objective function at every vertex. For maximise problems, we then identify the vertex that gives the largest value For minimise problems, we then identify the vertex that gives the smallest value Eg previously used Identify the optimum point and value if the aim is to: a) Maximise M = x + y x 7.5, y 15, M 22.5 x 9, y 6, N 27 b) Minimise N = x + 3y A(7.5,15) D(4.5,9) C(9,6) B(12,6) Vertex M=x+y N = x + 3y A(7.5,15) 22.5 52.5 B(12,6) 18 30 C(9,6) 15 27 D(4.5,9) 13.5 31.5 Ex 6C, Q1 Find the optimum point and the optimum value, using: a) the objective line method, with the objective ‘maximise M 2 x y ‘ 4 x y 1400 M 2x y use 2 1 400 200 3 x 2 y 1200 (1) 4 x y 1400 (2) 2 (2) 8 x 2 y 2800 (3) x 3 y 1200 (3) (1) 5 x 1600 x 320 x 320 (2) 1280 y 1400 y 120 R Solution x = 320, y = 120 3 x 2 y 1200 M 2 320 120 760 Ex 6C, Q1 Find the optimum point and the optimum value, using: a) the objective line method, with the objective ‘maximise N x 4 y ‘ 4 x y 1400 N x 4y use 1 4 100 400 x 3 y 1200 (1) x0 (2) x 0 y 400 x 3 y 1200 Solution x = 0, y = 400 N 0 4 400 R 1600 3 x 2 y 1200 Integer value solutions Often, solutions to linear programming problems require integer values. There are 2 methods for doing this, depending on the scale of the graph: Maximise P x 2 y Minimise C x y 5 x 2 y 1000 Objective line 3 x 5 y 1500 The closest point is obviously (3,6) The closest point is NOT obvious… 5 x 2 y 1000 (1) 3 x 5 y 1500 (2) 5 x 2 y 1000 5 (1) 25 x 10 y 5000 (3) 2 (2) 6 x 10 y 3000 (4) (3) (4) 19 x 2000 x 105 195 y 236 16 19 Objective line C x y Test 4 nearest points if integer solutions required 106,237 105,237 105 165 ,236 1619 3 x 5 y 1500 106,236 105,236 Point 105,236 105,237 106,236 106,237 5 x 2 y 1000 3 x 5 y 1500 997 1000 In R? C x y 999 1000 1002 1000 1498 1500 1004 1000 1503 1500 Yes 343 WB11 A manager wishes to purchase seats for a new cinema. He wishes to buy three types of seat; standard, deluxe and majestic. Let the number of standard, deluxe and majestic seats to be bought be x, y and z Standard, deluxe and majestic seats each cost £20, £26 and £36, respectively. The manager wishes to minimise the total cost, £C, of the seats. Constraints He decides that the total number of deluxe x and majestic seats should be at most half y z 2 y 2z x 2 of the number of standard seats. y 0.1 10 y x y z 9 y x z x yz y 0.2 5 y x y z 4 y x z x yz y The number of majestic seats should be at z 2z y least half of the number of deluxe seats. 2 The number of deluxe seats should be at least 10% and at most 20% of the total number of seats. The total number of seats should be at least 250. x y z 250 Non-negativity x, y, z 0 Objective function Minimise C 20 x 26 y 36 z Formulate this situation as a linear programming problem, simplifying your inequalities so that all coefficients are integers. WB12. A company produces two types of self-assembly wooden bedroom suites, the Oxford York ‘Oxford’ and the ‘York’. After the pieces of Cutting 4 6 wood have been cut and finished, all the materials have to be packaged. Finishing 3.5 4 The table below shows the time, in hours, Packaging 2 4 needed to complete each stage of the Profit (£) 300 500 process and the profit made, in pounds, on each type of suite. The times available each week for cutting, finishing and packaging are 66, 56 and 40 hours respectively. The company wishes to maximise its profit. Let x be the number of Oxford, and y be the number of York suites made each week. (a) Write down the objective function. Maximise P 300 x 500 y (b) In addition to 2x 3 y 33 x0 y0 find two further inequalities to model the company’s situation. Cutting: 4 x 6 y 66 2 x 3 y 33 given Finishing: 3.5 x 4 y 56 7 x 8 y 112 Packaging: 2 x 4 y 40 x 2 y 20 (c) On the grid below, illustrate all the inequalities, indicating clearly the feasible region 2x 3 y 33 x 0 y 11 (0,11) y 0 x 16.5 (16.5,0) 14 12 7 x 8 y 112 x 0 y 14 (0,14) y 0 x 16 (16,0) 10 x 2 y 20 x 0 y 10 (0,10) y 0 x 20 (20,0) 8 6 4 xmax 20 R ymax 14 P 300 x 500 y 2 use 300 0 0 2 4 6 8 10 12 14 16 18 20 500 6 10 (d) Explain how you would locate the optimal point P 300 x 500 y 14 use 300 10 500 12 6 Profit line: draw profit line, then select point on profit line furthest from the origin Furthest point (6,7) Make 6 Oxford and 7 York 10 Profit 300x 500 y = £5300 8 Point testing: test corner points in feasible region, find profit at each and select the point yielding maximum 6 4 2 0 0 2 4 6 8 10 12 14 16 18 20 Vertex Profit (0,10) 5000 (16,0) 4800 (6,7) 5300 (14,1) 4700 It is noticed that when the optimal solution is adopted, the time needed for one of the three stages of the process is less than that available. (f) Identify this stage and state by how many hours the time may be reduced 2 14 Cutting: 4 x 6 y 66 1 Finishing: 3.5 x 4 y 56 2 12 Packaging: 2 x 4 y 40 3 1 10 The maximum time possible for finishing is not used in the optimum solution 8 x 6, y 7 3.5 x 4 y 49 6 4 So only 49 hours of finishing is required 2 Reduce the amount of time by 7 hours 3 0 0 2 4 6 8 10 12 14 16 18 20