Operational Research Module AS3021 Problem Book Dr G Bowtell City University Contents A Worksheets A.1 Worksheet A.2 Worksheet A.3 Worksheet A.4 Worksheet A.5 Worksheet A.6 Worksheet A.7 Worksheet A.8 Worksheet A.9 Worksheet A.10 Worksheet A.11 Worksheet . . . . . . . . . . . 1 1 3 9 10 14 15 18 19 25 27 33 B Past Exam - May 2008 B.1 Question Paper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.2 Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 35 44 C Past Exam - May 2007 C.1 Question Paper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C.2 Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 55 63 D Past Exam - May 2006 D.1 Question Paper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D.2 Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 73 80 1 1 2 2 3 3 4 4 5 5 6 . . . . - . . . . . . . . . . . . . . . . . . . . Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - Solutions . . . . . . . . . . . . . . - Class Example - No solution given . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E Specimen Exam Type Questions and Solutions E.1 Specimen Questions . . . . . . . . . . . . . . . . . . . . E.1.1 Minimal spanning tree problem . . . . . . . . . . E.1.2 Shortest distance problem . . . . . . . . . . . . . E.1.3 Maximum Flow - Minimum Cut - Ford-Fulkerson E.1.4 Dynamic Programming . . . . . . . . . . . . . . E.1.5 Linear Programming . . . . . . . . . . . . . . . . E.2 Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . i . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 91 91 92 94 95 98 102 CONTENTS F Specimen Courseworks F.1 Coursework 1 - 2007 . . . . . . F.2 Coursework 1 - 2007 Solution . F.3 Coursework 2 - 2007 . . . . . . F.4 Coursework 2 - 2007 Solution . F.5 Coursework 1 - 2008 . . . . . . F.6 Coursework 1 - 2008 Solutions . F.7 Coursework 2 - 2008 . . . . . . F.8 Coursework 2 - 2008 Solutions . ii . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 116 118 123 123 127 130 133 135 Appendix A Worksheets A.1 Worksheet 1 1. Inequalities Graphically display the feasible region defined by the following inequalities: 2x1 + 2x2 ≤ 8 3x1 + 2x2 ≤ 12 x1 + 0.5x2 ≤ 3 x1 ≥ 0, x2 ≥ 0 Maximize z = 3x1 + 2x2 on the feasible region. Which, if any, of the first three inequalities may be removed without affecting the optimum solution? 2. Inequalities Consider the following linear programming model: Maximize the objective function z = 3x1 + 3x2 subject to the constraints: 2x1 + 4x2 ≤ 12 6x1 + 4x2 ≤ 24 x1 ≥ 0, x2 ≥ 0 (a) Find the optimal solution using graphical means. (b) If the objective function is changed to z = 2x1 + 6x2 what will the optimum solution be. 3. Workload Balancing The company Snap produces photo printers for both the professional and consumer markets. The Snap consumer division recently introduced two photo printers that provide colour prints rivaling those produced by a professional processing lab. The P100 model can produce a 100mm × 150mm borderless print in 40 seconds. The more sophisticated and faster P150 can even produce a 300mm× 500mm print. Financial projections show profit contributions of £42 for each P100 and £87 for each P150. The printers are assembled, tested and packaged at Snap’s plant located in New Barnet. This plant is highly automated and uses two manufacturing lines to produce the printers. Line 1 performs the assemble operation with times of 3 mins per P100 printer and 6 mins per P150 printer. Line 2 performs both the testing and packaging operations. Times are 4 mins per P100 1 APPENDIX A. WORKSHEETS 2 printer and 2 mins per P150 printer. The shorter time for the P150 is a result of its faster print speed. Both manufacturing lines are in operation for one 8-hour shift per day. The problem Perform an analysis for Snap by consider the following points. (a) Obtain the best number of units of each type to produce in order to maximize the total contribution to profit in an 8 hour shift. What reasons might management have for not implementing your recommendation? (b) Suppose that management also states that the number of P100 printers produced should be at least as great as the number of P150 produced? Again assuming that the objective is to maximize the total contribution to profit in an 8 hour shift, how many units of each printer should be produced? (c) Does the solution you have in (b) balance the total time spent on Line 1 with that on Line 2? Why should this be of concern to management? (d) Management requested an expansion of the model in (b) that would produce a better balance between the total time on Line 1 and that on Line 2. They want to limit the difference between the time spent on the two lines in the 8-hour shift to be no more than 30mins. If the objective is still to maximize the total profit how many units of each printer should be produced? What effect does this work-load balance have on the total profit in (b)? (e) Suppose that in part (a) management specified the objective as maximizing the total number of printers produced each shift rather than the total profit contribution. With this objective, how many units of each printer should be produced per shift? What effect does this objective have on total profit and workload balance? 4. Production Strategy Fit-Fit manufactures exercise equipment at its plant in York. It recently designed two universal weight machines for the home exercise market. Both machines use Fit-Fit’s patented technology that provides the user with an extremely wide range of motion capabilities for each type of exercise performed. Until now, such capabilities have been available only on expensive weight machines used primarily by physical therapists. At a recent trade show, demonstrations of the machines resulted in significant dealer interest. In fact, the number of orders that Fit-Fit received at the trade show far exceeded its manufacturing capabilities for the current production period. As a result, management decided to begin production of the two machines. The two machines, which Fit-Fit named Body-Firm and Body-Strong, require different amounts of resource to produce. Body-Firm consists of a frame unit, a press station and a pec-dec station. Each frame produced uses four hours of machining and welding time and two hours of painting and finishing time. Each press station requires two hours of machining and welding and one hour of painting and finishing, and each pec-dec station uses two hours of machining and welding time and two hours APPENDIX A. WORKSHEETS 3 of painting and finishing time. In addition two hours are spent assembling, testing and packaging each Body-Firm unit. The raw material costs £450 for each frame, £300 for each press station and £250 for each pec-dec station. Packaging costs are estimated at £50 per unit. Body-Strong consists of a frame unit, a press station, a pec-dec station, and a leg press station. Each frame produced uses five hours of machining and welding time and four hours of painting and finishing time. Each press station requires three hours machining and welding time and two hours of painting and finishing time, each pec-dec station uses two hours of machining and welding time and two hours of painting and finishing time, and each leg press station requires two hours of machining and welding time and two hours of painting and finishing time. In addition, two hours are spent assembling, testing, and packaging each Body-Strong unit. The raw material costs are: £650 for each frame, £400 for each press station, £250 for each pec-dec station, and £200 for each leg press station; packaging costs are estimated to be £75 per unit. For the next production period, management estimates that 600 hours of machining and welding time, 450 hours of painting and finishing time, and 140 of assembly, testing, and packaging time will be available. Current labour costs are £20 per hour for machining and welding time, £15 per hour for painting and finishging time, and £12 per hour for assembly, testing, and packaging time. The market in which the two machines must compete suggests a retail price of £2,400 for the Body-Firm unit and £3,500 for the Body-Strong unit, although some flexibility may be available to Fit-Fit because of the unique capabilities of the new machines. Authorised Fit-Fit dealers can purchase machines for 70% of the suggested retail price. Fit-Fit’s President believes that the unique capabilities of the Body-Strong unit can help position Fit-Fit as one of the leaders in high-end exercise equipment. Consequently, he has stated that the number of units of Body-Strong produced must be at least 25% of the total production. The problem Analyse the production strategy at Fit-Fit as follows: (a) What is the recommend number of Body-Firm and Body-Strong machines to produce in order to maximize profit. (b) How does the requirement that the number of units of Body-Strong produced be at least 25% of the total production affect profits? (c) Where should efforts be expended to increase profits? A.2 Worksheet 1 - Solutions 1. In Fig. A.1(a) the feasible region is shown hashed. As 3x1 + 2x2 = 12 does not form part of the boundary of the feasible region the constraint 3x1 + 2x2 ≤ 12 is redundant and may be removed without affecting the feasible region. The objective function has been plotted with z = 6. As this value of z is increased the objective function moves away from the origin and last intersects the feasible region at P . The point P therefore is the point at which z attains its maximum. APPENDIX A. WORKSHEETS 4 As P lies on the intersection of 3 = x1 + 0.5x2 and 8 = 2x1 + 2x2 the coordinates of P are (2, 2). Hence the maximum value of z is z = 3(2) + 2(2) = 10. 2. (a) In Fig. A.1(b) the feasible region is shown hashed. The objective function z = 3x1 + 3x2 is shown plotted with z = 6. As z increases this moves away from the origin and last intersects the feasible region at B. Calculating the coordinates of B from the intersection of 6x1 + 4x2 = 24 and 2x1 + 4x2 = 12 gives B(3, 1.5) and hence the maximum value of z = 3(3) + 3(1.5) = 13.5. (b) In Fig. A.1(b) the objective function z = 2x1 + 6x2 is shown plotted with z = 12. As z increases this moves away from the origin and last intersects the feasible region at A which has coordinates (0, 3), hence the maximum value of z = 2(0) + 6(3) = 18. (a) x2 5 x2 (b) 5 6x1 + 4x2 = 24 3x1 + 2x2 = 12 ... ... (redundant) ... ... P ... ... ... ... ... ... ... ... . 7 7 7 5 2x1 + 2x2 = 8 z = 6 = 3x1 + 2x2 x1 + 0.5x2 = 3 A ........ ... ...... B ... ....... ... ....... 2x1 + 4x2 = 12 ... . . . . ....... ... ....... ... ....... ... ....... ... . ..... .. x1 µ µ 5 z = 6 = 3x1 + 3x2 z = 12 = 2x1 + 6x2 x1 Figure A.1: Feasible regions hashed. Objective functions dotted (a) z = 10 max at P (2, 2) (b) z = 2x1 + 6x2 max at A(0, 3), value 18. z = 3x1 + 3x2 max at B(3, 1.5), value 13.5. 3. Identify the problem In this problem the questions to be addressed are listed, however if the problem was just ’investigate’ then a list of such questions would need to be constructed. A good starting point to try and understand any problem is to collect together the data, in this case in the form of a table, as follows: Formulate the model APPENDIX A. WORKSHEETS Type P100 P150 Available time 5 Line 1 3 6 480 Line 2 4 2 480 Profit £42 £87 Table A.1: Processing times in minutes per item and profit in £ per item. Total of 480min processing time available for each type Let p1 and p2 denote the number of P100 and P150 printers produced in a given shift. The problem will involve maximizing the profit which is given by z = 42p1 + 87p2 . The constraints due to the limitation of production time on each line are: 3p1 + 6p2 ≤ 480, 4p1 + 2p2 ≤ 480 p1 , p2 ≥ 0 (A.1) Carry out Mathematics (a) The feasible region given by the inequalities in Eq(A.1) is shown in the graph in Figure A.2(a). The objective function is shown with z = 3654 = 42p1 + 87p2 . Since it is not clear whether z is max at A or B we can either evaluate z at these points or compare the gradient of AB with that of z. Coordinates of A are (106 23 , 26 32 ) and give z = 6800. Coordinates of B are (0, 80) and give z = 6960. Hence the recommendation is to produce eighty P150 in the eight hour shift and none of the P100 model. This gives a profit of £6960. This may not be acceptable since it is not good marketing strategy to only have one product. (b) For the additional constraint p1 ≥ p2 the new feasible region is show in Figure A.2(b). It is clear in this case that the objective function is maximum at C. The coordinates of C are (53 31 , 53 13 ) and at this point z = 6880 Thus if the company is to produce at least as many P100 models as P150 then they should produce 53 units of each. This will give a little slack in the system and will lead to a profit of £6837.(no rounding analysis carried out) (c) The production time for line 1 is 3p1 + 6p2 which with p1 = p2 = 53 gives 477mins. The exact value at C giving 480 which is binding. The production time for line 2 is 4p1 + 2p2 which p1 = p2 = 53 gives 318 mins , showing a considerable amount of slack on this line. (this doesn’t improve much if we use the exact values from the coordinates of C). Clearly therefore the production lines are not balanced and this will lead to idle labour which cannot be considered as a good thing. (d) The idea of a fully occupied workforce and the production of both types of product are now to be thought more important than just theoretically making a maximum profit. A happy workforce and long term sales are obviously important. To this aim the company APPENDIX A. WORKSHEETS 6 p2 p2 (a) 24 (b) 24 4p1 + 2p2 = 480 4p1 + 2p2 = 480 p1 = p2 8 B 8 ....... ....... A ....... ....... ....... ¸ ............ ..... 12 z = 3654 = 42p1 + 87p2 16 p1 3p1 + 6p2 = 480 B C ....... ....... A ....... ....... ....... .. ¸ .............. . 12 z = 3654 = 42p1 + 87p2 16 p1 3p1 + 6p2 = 480 Figure A.2: Scale on both axes 1:10 now imposes a constraint so that there is no more than 30min difference between the two production lines. Thus the additional constraint is |(3p1 + 6p2 ) − (4p1 + 2p2 )| ≤ 30 ⇒ |4p2 − p1 | ≤ 30 ⇒ −30 ≤ 4p2 − p1 ≤ 30 Thus the feasible region has to also lie between the lines −30 = 4p2 − p1 and 4p2 − p1 = 30. This is shown in Figure A.3(a) The objective function is now maximum at T which has coordinates (96 23 , 31 32 ) which gives z = 6815 Without doing any rounding analysis we could suggest they produced 96 P100 and 31 P150 to satisfy the added requirements. (e) Figure A.3(b) is simply Figure A.2(a) with a different objective line. It is clear that the maximum now occurs at A. The coordinates of A are (106 23 , 26 32 ) and the corresponding value of z is £6800. Since A lies on both the bounding lines for the availability of time on the two lines the constraints are binding. Thus the two lines have no slack and hence in balance. 4. Identify the problem Again the problem states quite specifically which questions to address. However the problem has a lot data associated with it, this is best extracted and displayed by forming tables. APPENDIX A. WORKSHEETS 7 p2 p2 (a) 24 (b) 24 4p1 + 2p2 = 480 4p1 + 2p2 = 480 p1 = p2 8 4p2 − p1 = 30 B C T ....... ....... A ....... ....... ....... ....... ....... . > . 12 8 B A 4p2 − p1 = −30 16 16 p1 12 3p1 + 6p2 = 480 z = 80 = p1 + p2 z = 3654 = 42p1 + 87p2 3p1 + 6p2 = 480 Figure A.3: Scale on both axes 1:10 Body-Firm Mach/Weld(hr) Paint/Fin(hr) Ass/Test/Pk(hr) Cost(£) Frame 4 2 450 Press 2 1 300 Pec-Dec 2 2 250 Total 8 5 2 1000+pk=1050 Table A.2: Construction time and costs for the Body-Firm equipment. Packaging (pk) £50/item Formulate the model Let F and S be the number of Body-Firm and Body-Strong pieces of equipment produced. Using the data from Table A.2, TableA.3 and Table A.4 for the amount of resource used to produce each item and the amount of resource available we can write down the following constraints: 8F + 12S ≤ 600 5F + 10S ≤ 450 2F + 2S ≤ 140 F, S ≥ 0 (A.2) The profit function is the difference of the cost and the revenue. Bearing in mind that the company only gets 70% of the RRP the revenue from selling F and S is given by: Revenue = 2700 × 70% × F + 3500 × 70% × S = 1680F + 2450S The cost of material plus packaging is given by 1050F + 1575S and the cost of labour in the three construction areas is given by: Labour Cost = (8F + 12S)20 + (5F + 10S)15 + (2F + 2S)12 = 259F + 414S p1 APPENDIX A. WORKSHEETS Body-Strong Mech/Weld(hr) Paint/Fin(hr) Ass/Test/Pk(hr) Cost(£) Frame 5 4 650 8 Press 3 2 400 Pec-Dec 2 2 250 Leg-Press 2 2 200 Total 12 10 2 1500+pk=1575 Table A.3: Construction time and costs for the Body-Strong equipment. Packaging (pk) £75/item Mech/Weld(hr) Paint/Fin(hr) Ass/Test/Pk(hr) Available time(hr) 600 450 140 Labour Costs(£/hr) 20 15 12 Table A.4: Available construction times(hr) and associated labour costs (£/hr) Thus the Total Cost = 1309F + 1989S Thus the profit function is given by Profit = Revenue−Cost = z = 371F + 461S (A.3) Finnally the requirement that the Body-Strong product is at least 25% of the total production gives: S+F S≥ ⇒ F − 3S ≤ 0 (A.4) 4 Thus the problem is to maximize the profit function in Eq(A.3) subject to the constraints of Eq(A.2) and Eq(A.4). Carry out the Mathematics (a) From Figure A.4 the dotted objective function is clearly a maximum at A or C. By calculating the coordinates of these points we find that z is maximum at A, which has coordinates (16 23 , 50), giving z = 26233 13 . Thus the company should aim to produce 16 Body-Strong and 50 Body-Firm machines. This will yield £25926. (without rounding analysis) (b) If the constraint F ≤ 3S is dropped the feasible region is enlarged and becomes the polygon ORBACD. z will now be maximum at B or R. Calculating the coordinates of these points and calculating the corresponding values of z the maximum occurs at B which has coordinates (10, 60) with z = £26870. Thus if the constraint is lifted the company can increase its profit. (c) Assuming all constraints are in place, as in (a), then the maximum at A can be increased by causing A to move away from the origin. This can be done by increasing the effort in the Machine and Welding department. APPENDIX A. WORKSHEETS 9 F F + 2S = 90 Paint/Finish 90 F = 3S R ... ... B ... ... ... ... A ... ... ... ... ... ... C ... ... ... ... ... ... ... > .... ... ... O D z = 20000 = 371F + 461S Profit F + S = 70 Assemble/Test 70 S 2F + 3S = 150 Mech/Weld Figure A.4: A.3 Worksheet 2 The problems on this sheet should be done using Solver in Excel. 1. Maximize z = 120x1 + 80x2 + 14x3 subject to 4x1 + 8x2 + x3 ≤ 200 2x2 + x3 ≤ 300 32x1 + 4x2 + 2x3 = 400 x1 , x2 , x3 ≥ 0 2. Minimize z = −4x1 + 5x2 + 5x3 subject to x2 + x3 ≥ 2 − x1 + x2 + x3 ≥ 1 x3 ≥ 1 x1 , x2 , x3 ≥ 0 3. ”Frosties” sells three different types of ice cream, chocolate vanilla and banana. Due to extremely hot weather and a high demand for its products, Frosties has run short of its supply of ingredients: milk, sugar and cream. Hence Frosties will not be able to fill all the orders received from its retail outlets. Due to these circumstances Frosties decides to make the most profitable amounts of the three flavours, given the constraints on the supply of the basic ingredients. The company will then ration its supply of ice cream to its outlets. APPENDIX A. WORKSHEETS 10 The following table gives the ingredients and profit per gallon of ice cream of each type. Type Profit £ Milk (gallons) Sugar (pounds) Cream (gallons) Chocolate Vanilla Banana 1 0.90 0.95 0.45 0.50 0.40 0.50 0.40 0.40 0.1 0.15 0.20 200 150 60 Availability (a) Determine the optimal production mix for Frosties (b) By how much should the profit on chocolate be raised to ensure that Frosties produce this line. (c) In which resource would you endeavor to make a small increase in order to have the most effect on the profit? (d) Is it useful if any amount of extra milk becomes available? (e) If the availability of sugar is increased to 175 pounds and cream to 70 gallons find the new optimal production. A.4 Worksheet 2 - Solution In questions one and two you should be aware that the value of the optimum is unique whereas the values of x1 , x2 . . . may not be. 1. Maximum value of z = 2800 at x1 = 10, x2 = 20 and x3 = 0 2. Maximum value of z = 6 at x1 = 1, x2 = 0 and x3 = 2 3. In this problem the questions to be addressed are clearly given and the data is already presented in a table, thus we can easily proceed to the formulate the model stage. Note however the phrase ’ration its supply ....’ is simply indicating that they can sell all that they produce. This is a basic assumption in all our problems. Formulate the Model Let x1 , x2 and x3 be respectively the number of gallons of chocolate, vanilla and banana ice cream to be produced from the available supply of ingredients. Profit: From the profit column of the data the objective function to be maximized is given by: z = x1 + 0.9x2 + 0.95x3 APPENDIX A. WORKSHEETS 11 and represents the profit measured in £. Constraints From the other three columns of the table the constraints on the availability of material are given by: Mlk: 0.45x1 +0.5x2 +0.4x3 ≤ 200 Sug: 0.5x1 +0.4x2 +0.4x3 ≤ 150 Crm: 0.1x1 +0.15x2 +0.2x3 ≤ 60 As usual the non-negative condition x1 , x2 , x3 ≥ 0 is assumed. Carry out the Mathematics In this problem we simply run solver to give the output in Table A.5 and Table A.6. Report (a) From the Answer Report of Table A.5 the Final Value of the Target Cell is 341.25. Hence optimal return is £341.25 From the Final Value column of the Adjustable Cells section, the optimal amount of chocolate(x1 ) is zero, of vanilla(x2 ) is 300 gallons and banana(x3 ) is 75 gallons. (b) Since the amount of chocolate is zero we can, by increasing the profit on chocolate, make it worthwhile to produce some. The reduced cost is precisely the amount by which this amount should be changed to give a solution that involves a non-zero production of chocolate. From the Adjustable Cells section of the Sensitivity Report the reduced cost for x1 is -0.0375. That is to say the profit on chocolate should be reduced by a negative amount, which we take as an increase of 4p. Thus Frosties would need to adjust their price of chocolate to make a profit of 1.04p/gallon. (c) From the Constraints section of the Sensitivity Report the largest shadow (dual) price is for Sugar. Thus for every 1 lb increase in the availability of sugar the company can make an extra £1.875. Thus in the first instance an increase in sugar supply is the most advantageous. (d) In the Constraints section of the Sensitivity Report the allowable increase for Milk is infinite (1E+30), no change in the solution no matter how much more milk we have. This also follows from the Constraints section of the Answer Report as Milk is listed as not Binding. That is to say there is already slack in the system at this optimum and increasing the supply is only going to produce more slack. (e) In Table A.6 the new optimum value is now £397.05 and the production levels are 28.57 gallons of Chocolate, 264.28 gallons of Vanilla and 137.5 gallons of Banana. APPENDIX A. WORKSHEETS 12 Microsoft Excel 9.0 Answer Report Worksheet: [OR_Ex21_ASW_p274.xls]Sheet1 Report Created: 08-Feb-06 09:52:23 Target Cell (Max) Cell $H$13 Name z riginal Valu Final Value 2.85 341.25 Adjustable Cells Cell $A$13 $B$13 $C$13 Name x1 x2 x3 riginal Valu Final Value 1 0 1 300 1 75 Constraints Cell $E$5 $E$6 $E$7 Name Cell Value Formula Status 180 $E$5<=$F$Not Binding Milk Consu 150 $E$6<=$F$Binding Sugar Cons 60 $E$7<=$F$Binding Cream Con Slack 20 0 0 Microsoft Excel 9.0 Sensitivity Report Worksheet: [OR_Ex21_ASW_p274.xls]Sheet1 Report Created: 08-Feb-06 09:52:23 Adjustable Cells Cell $A$13 $B$13 $C$13 Name x1 x2 x3 Cell $E$5 $E$6 $E$7 Name Milk Consu Sugar Cons Cream Con Final Value 0 300 75 Reduced Objective Allowable Allowable Cost Coefficient Increase Decrease -0.0375 1 0.0375 1E+30 0 0.9 0.05 0.0125 0 0.95 0.021429 0.05 Final Value 180 150 60 Shadow Constraint Allowable Allowable Price R.H. Side Increase Decrease 0 200 1E+30 20 1.875 150 10 30 1 60 15 3.75 Constraints Microsoft Excel 9.0 Limits Report Worksheet: [OR_Ex21_ASW_p274.xls]Sheet1 Report Created: 08-Feb-06 09:52:23 Cell $H$13 Cell $A$13 $B$13 $C$13 Adjustable Name x1 x2 x3 Target Name z Value 0 300 75 Value 341.25 Lower Limit 0 0 0 Target Result 341.25 71.25 270 Table A.5: Output for Q3. (a)-(d) Upper Limit 2.96E-10 300 75 Target Result 341.25 341.25 341.25 APPENDIX A. WORKSHEETS 13 Microsoft Excel 9.0 Answer Report Worksheet: [OR_Ex21_ASW_p274.xls]Sheet1 Report Created: 08-Feb-06 10:02:21 Target Cell (Max) Cell $H$13 z Adjustable Cells Cell $A$13 $B$13 $C$13 Name riginal ValuFinal Value 384.9107 397.0536 Name x1 x2 x3 riginal ValuFinal Value 85.71429 28.57143 292.8571 264.2857 37.5 137.5 Name Milk Consumption Sugar Consumption Cream Consumption Cell Value 200 175 70 Constraints Cell $E$5 $E$6 $E$7 Formula Status $E$5<=$F$Binding $E$6<=$F$Binding $E$7<=$F$Binding Slack 0 0 0 Microsoft Excel 9.0 Sensitivity Report Worksheet: [OR_Ex21_ASW_p274.xls]Sheet1 Report Created: 08-Feb-06 10:02:21 Adjustable Cells Cell $A$13 $B$13 $C$13 x1 x2 x3 Name Cell $E$5 $E$6 $E$7 Name Milk Consumption Sugar Consumption Cream Consumption Final Reduced Objective Allowable Allowable Value Cost Coefficient Increase Decrease 28.57143 0 1 0.0375 0.290625 264.2857 0 0.9 0.2325 0.0125 137.5 0 0.95 0.021429 0.121429 Constraints Final Value 200 175 70 Shadow Constraint Allowable Allowable Price R.H. Side Increase Decrease 0.107143 200 10 30.83333 1.660714 175 37 5 1.214286 70 5 13.75 Microsoft Excel 9.0 Limits Report Worksheet: [OR_Ex21_ASW_p274.xls]Sheet1 Report Created: 08-Feb-06 10:02:21 Cell $H$13 Cell $A$13 $B$13 $C$13 Adjustable Name x1 x2 x3 Target Name z Value 28.57142857 264.2857143 137.5 Value 397.0536 Lower Limit 0 0 0 Target Result 368.4821 159.1964 266.4286 Upper Limit 28.57143 264.2857 137.5 Table A.6: Output for Q3 (e) Target Result 397.0536 397.0536 397.0536 APPENDIX A. WORKSHEETS A.5 14 Worksheet 3 1. The standard or canonical form of the linear programming problem is: Given Ax = b such that x ≥ 0, b ≥ 0 maximize or minimize z = cT x Write the following problems in standard form: (a) Maximize z = −x1 − 2x2 + x3 subject to: 3x2 + 2x1 + x3 ≤ 3 (i) x1 + x2 + x3 ≤ 1 (ii) x1 , x2 x3 ≥ 0 (b) Maximize z = 2x1 + 4x2 + x3 subject to: x1 + x2 + x3 = 1 2x1 + x2 − x3 ≤ 2 x1 + x2 ≥ −4 x2 + x3 ≥ 1 With x1 , x2 ≥ 0 and x3 unrestricted 2. Use Solver to find the solutions to the problems in Q1. (note that it is not necessary to write the problem in standard form to use solver - this is done automatically inside solver 3. Given: µ x1 1 2 ¶ µ + x2 3 1 ¶ µ + x3 1 1 ¶ µ = 4 3 ¶ use the direct method of solving simultaneous equations (non-matrix) to obtain the three basic solutions to the problem. 4. (This question was intended to give you a geometric idea of basic feasible solutions, however it seem to just cause more problems - I suggest you ignore it if its not obvious. Its not the sort of question that will appear in the exam.) The points satisfying x1 + x2 + x3 ≤ 4 x1 ≤ 2 x2 ≤ 1 and x1 , x2 , x3 ≥ 0 (A.5) are all the points inside and on the solid shown in Fig. A.5. Writing Eqs(A.5) in the form x1 + x2 + x3 + s1 = 4, x1 + s2 = 2 and x2 + s3 = 1 write down the basic variables at each of the points A, B, C and D in Fig. A.5. Apply row reduction to 1 1 1 1 0 0 4 1 0 0 0 1 0 2 0 1 0 0 0 1 1 to emulate moving from A to B, B to C and C to D. Use your matrix to write down the values of the basic variables at each point. Do these values agree with what you expect from the diagram. APPENDIX A. WORKSHEETS 15 x3 .. ... .. .. .. x1 + x2 + x3 = 4 .. .. .. .. j .. .. .. .. .. .. .. 9 ... .. D . x1 = 2 .. ........... .. A z . . . . ... . . . . . ...... ...... B C x2 = 1 x2 x1 Figure A.5: 5. For Q1(a) write down the augmented matrix (A b) in the form (D I b), for suitable matrix D and identity matrix I. Additionally let s1 be the slack variable for (i) and s2 the slack variable for (ii). (a) Use your augmented matrix to write out b in terms of the basic variables s1 , s2 and the standard ordered basis e1 and e2 in R2 . (give the values of s1 and s2 ) (b) Use row reduction to make x1 and s2 basic variables. Hence write out b in terms of the original columns of A. (c) Use one more row reduction to try and make x1 and x3 basic variables. Why does this process fail to give an answer to the problem? A.6 Worksheet 3 - Solutions 1. (a) Introduce slack variables s1 ≥ 0 and s2 ≥ 0 to give: 2x1 + 3x2 + x3 + s1 = 3 Thus: µ where x = (x1 , x2 , x3 , s1 , s2 )T 2 3 1 1 0 1 1 1 0 1 x1 + x2 + x3 + s2 = 1 ¶ µ x= 3 1 ¶ and z = −x1 − 2x2 + x3 + 0s1 + 0s2 (b) Introduce slack variable s1 ≥ 0, and surplus variables s2 ≥ 0, s3 ≥ 0 . Since x3 is − + − unrestricted set x3 = x+ 3 − x3 with x3 , x3 ≥ 0. Thus the constraints become: APPENDIX A. WORKSHEETS − x1 + x2 + x+ 3 − x3 + − 2x1 + x2 − x3 + x3 + s1 −x1 − x2 + s2 − x2 + x+ 3 − x3 − s3 16 = = = = 1 2 4 1 ⇒ − T where x = (x1 , x2 , x+ 3 , x3 , s 1 , s 2 , s 3 ) 1 1 1 −1 2 1 −1 1 −1 −1 0 0 0 1 1 −1 0 1 0 0 0 0 0 0 x = 1 0 0 −1 1 2 4 1 − z = 2x1 + 4x2 + x+ 3 − x3 + 0s1 + 0s2 + 0s3 and 2. (a) Use solver to give x1 = x2 = 0, x3 = 1, zmax = 1 (b) Use solver to give x1 = 0, x2 = 1.5, x3 = −0.5, zmax = 2.5 3. The three basic solutions are obtained as follows (a) Selecting the first two columns and setting x3 = 0 we need to solve: µ ¶ µ ¶ µ ¶ 1 3 4 x1 + 3x2 = 4 x1 + x2 = ⇒ ⇒ 2 1 3 2x1 + x2 = 3 x1 = x2 = 1 Basic solution: x1 = x2 = 1, x3 = 0 (b) Selecting the first and last column and setting x2 = 0 gives: µ ¶ µ ¶ µ ¶ 1 1 4 x1 + x3 = 4 x1 + x3 = ⇒ 2 1 3 2x1 + x3 = 3 ⇒ x1 = −1, x3 = 5 Basic solution: x1 = −1, x2 = 0, x3 = 5 (c) Selecting the last tow column and setting x1 = 0 gives: µ ¶ µ ¶ µ ¶ 3 1 4 3x2 + x3 = 4 x2 + x3 = ⇒ 1 1 3 x2 + x3 = 3 ⇒ x2 = 1/2, x3 = 5/2 Basic solution: x1 = 0, x2 = 1/2, x3 = 5/2 4. The basic variables are A(s1 , s2 , s3 ), B(s1 , x1 , s3 ), C(s1 , x1 , x2 ) and D(x3 , x1 , x2 ). At A: 1 1 1 [1] 0 0 4 1 0 0 0 [1] 0 2 0 1 0 0 0 [1] 1 ⇒ s1 = 4, s2 = 2, s3 = 1 To move to B introduce x1 and take out s2 . Thus row reduce to make column 1 (the x1 col) = e2 . (notation: standard ordered basis ei .) At B: 0 1 1 [1] −1 0 2 [1] 0 0 0 1 0 2 0 1 0 0 0 [1] 1 ⇒ x1 = 2, s1 = 2, s3 = 1 To move to C introduce x2 and take out s3 . Thus row reduce to make column 2 (the x2 col) = e3 . APPENDIX A. WORKSHEETS At C: 17 0 0 1 [1] −1 −1 1 [1] 0 0 0 1 0 2 0 [1] 0 0 0 1 1 ⇒ x1 = 2, x2 = 1, s1 = 1 To move to D introduce x3 and take out s1 . Thus row reduce to make column 3 (the x3 col) = e1 . (no row reduction actually necessary, just relabel pivot) At D: 0 0 [1] 1 −1 −1 1 [1] 0 0 0 1 0 2 0 [1] 0 0 0 1 1 ⇒ x1 = 2, x2 = 1, x3 = 1 Recall that non-basic variable are, by design, always zero. Thus picking off the x-coordinates of the points A, B, C and D from above gives: At A (x1 , x2 , x3 ) = (0, 0, 0) At C (x1 , x2 , x3 ) = (2, 1, 0) At B (x1 , x2 , x3 ) = (2, 0, 0) At D (x1 , x2 , x3 ) = (2, 1, 1) These are seen to correspond to the coordinates of the points on the diagram. 5. . 2 3 1 .. [1] 0 (D I b) = . 1 1 1 .. 0 [1] .. . 3 .. . 1 (a) In general: µ b= 3 1 ¶ µ = x1 2 1 ¶ µ + x2 3 1 ¶ µ + x3 1 1 ¶ µ + s1 1 0 ¶ µ + s2 0 1 ¶ (A.6) Starting with basic variables s1 and s2 , thus all the x variables have been set to zero gives µ ¶ 3 b= = s1 e1 + s2 e2 ⇒ s1 = 3, s2 = 1 1 (b) Introduce x1 and take out s2 . That is to say use row reduction to make col(1) = e2 . µ ¶ 0 1 −1 [1] −2 1 [1] 1 1 0 1 1 With x1 and s1 as basic variables and all the others zero, the pivots [1] in the matrix give x1 = 1 and s1 = 1. Thus from Eq(A.6) µ ¶ µ ¶ µ ¶ µ ¶ µ ¶ 2 1 2 1 3 + s1 = + = b = x1 1 0 1 0 1 (c) Introduce x3 and take out s1 by making col(3)=e1 : µ ¶ 0 −1 [1] −1 2 −1 [1] 2 0 1 −1 2 APPENDIX A. WORKSHEETS 18 Thus the basic variables are x1 = 2 and x3 = −1, all other variables set equal to zero. Thus Eq(A.6) gives: µ ¶ µ ¶ µ ¶ µ ¶ µ ¶ 3 2 1 2 1 = b = x1 + x3 =2 − 1 1 1 1 1 This is not a feasible solution since the variable are not all non-negative, namely x3 < 0. A.7 Worksheet 4 1. Simplex - all slack variables Given 4x1 + 3x2 + 3x3 ≤ 12 3x1 + 4x2 + 4x3 ≤ 12 x3 ≤ 1 x 1 , x2 , x3 ≥ 0 this question asks you to investigate the maximization of the objective function z = 2x1 + 2x2 + 3x3 using the Simplex Method as follows: (a) Write the constraints in the standard form Ax = b where A is a suitable matrix of the form (D I) and I is the identity matrix. x and b are suitable column vectors such that x ≥ 0 and b ≥ 0. (b) Set up the Simplex Tableau and hence solve the problem. (c) Use the final tableau to i. Obtain the dual (shadow) values corresponding to each of the first three constraint. ii. Find the feasible ranges of each of the components of b iii. The range of optimality for each of the coefficients in the objective function z. 2. Simplex - Artificial variables Consider the problem: Maximize z = 2x1 + x2 subject to x1 + x2 ≤ 2 (i) x1 + 3x2 ≥ 3 (ii) x1 , x2 ≥ 0 (a) Introducing a slack variable s1 and a surplus variable s2 write the problem in the form Ax = b, and z = cT x, where x, b ≥ 0. Why is it not possible to initially use s1 and s2 as basic variables? (b) Introduce an additional artificial variable a1 ≥ 0, such that a1 and s1 can be used as initial basic variables. (c) Introducing the variable M in the objective function write down the Simplex Tableau for this problem. Hence solve using the Simplex Method. APPENDIX A. WORKSHEETS 19 (d) Using the optimal tableau write down the shadow values for the problem. (e) Solve the problem graphically. Indicate the order in which the Simplex Method visited the corners of the feasible region. Use your graph to find the maximum value of z if in constraint (i) the righthand side is increased to 3. Is this consistent with your results for the dual values in (d). A.8 Worksheet 4 - Solutions 1. (a) Introducing slack variables s1 , s2 , s3 ≥ 0 the inequalities become: 4x1 + 3x2 + 3x3 + s1 = 12, 3x1 + 4x2 + 4x3 + s2 = 12, x3 + s3 = 1, x1 , x2 , x3 ≥ 0 In the required matrix form: 4 3 3 1 0 0 12 Ax = (D|I)x = 3 4 4 0 1 0 x = 12 = b 0 0 1 0 0 1 1 Where x = (x1 , x2 , x3 , s1 , s2 , s3 )T and z = cT x = 2x1 + 2x2 + 3x3 + 0s1 + 0s2 + 0s3 . (b) The first simplex tableau: Basic Var s1 s2 s3 zj ∆z cj 0 0 0 x1 2 4 3 0 0 2 x2 2 3 4 0 0 2 x3 3 3 4 1 0 [3] s1 0 1 0 0 0 0 s2 0 0 1 0 0 0 s3 0 0 0 1 0 0 b b a ratio 12 12 1 z= 0 4 3 [1] Table A.7: Since this is a maximization problem, add to the basic set the variable corresponding to the maximum positive value in the final row. Remove from the basic set the variable corresponding to the smallest non-negative value in the final column. In the final row (variable columns), [3] is the maximum value, thus introduce x3 into the basic set. The ratio column consists of the d column elements divided by the corresponding terms in the x3 column. Select the variable corresponding to the smallest non-negative value in the ratio column, namely s3 , to remove from the basic set. Row reduce to make the x3 column into the old s3 column, that is to say row reduce to make the x3 column equal to e3 . In Table A.8 there are two positive maximum values in the final row, hence it is equally acceptable to add either x1 or x2 to the basic set: I have add x1 to the basic set. The smallest non-negative value in the final column corresponds to s1 , hence remove s1 from the basic set. APPENDIX A. WORKSHEETS Basic Var s1 s2 x3 zj ∆z cj 0 0 3 x1 2 4 3 0 0 [2] 20 x2 2 3 4 0 0 2 x3 3 0 0 1 3 0 s1 0 1 0 0 0 0 s2 0 0 1 0 0 0 s3 0 −3 −4 1 3 −3 d a d ratio 9 8 1 z= 3 [9/4] 8/3 ∞ Table A.8: This table shows the next step is to add x1 to the basic set and remove s1 . Basic Var x1 s2 x3 zj ∆z cj 2 0 3 x1 2 1 0 0 2 0 x2 2 3/4 7/4 0 3/2 [1/2] x3 3 0 0 1 3 0 s1 0 1/4 −3/4 0 1/2 −1/2 s2 0 0 1 0 0 0 s3 0 −3/4 −7/4 1 3/2 −3/2 d a d ratio 9/4 5/4 1 z= 15/2 3 [5/7] ∞ Table A.9: This table shows that the next step is to add x2 to the basic set and remove s2 . Thus row reduce to make the x1 column equal to the old s1 column, that is to say make column 1 equal to e1 . Thus row reduce to make the x2 column equal to the old s2 column, that is to say column 2 becomes e2 Basic Var x1 x2 x3 zj ∆z cj 2 2 3 x1 2 1 0 0 2 0 x2 2 0 1 0 2 0 x3 3 0 0 1 3 0 s1 0 16/28 −3/7 0 (2/7) −2/7 s2 0 −12/28 4/7 0 (2/7) −2/7 s3 0 0 −1 1 (1) −1 d d a ratio 48/28 5/7 1 z= 55/7 Table A.10: Since the final row (variable columns) has no positive elements the process terminates. The final row indicates that ∆z is either zero or negative, thus no change will improve the value of z and hence the optimum is reached. From the table the maximum value of z = 7 67 and the values of the variables are x1 = 12/7, x2 = 5/7, x3 = 1. (c) i. The dual variables are indicated in Table A.10 with(). Thus corresponding to the three constraints the dual variables are respectively 2/7, 2/7, 1. ii. δ ∆b = 0 0 12/7 4/7 δ −3/7 + 5/7 ≥ 0 1 0 ⇒ δ ≥ −3 and − 3δ + 5 ≥ 0 ⇒ 5/3 ≥ δ ⇒ APPENDIX A. WORKSHEETS 21 Thus −3 ≤ δ ≤ 5/3 ⇒ 12 − 3 ≤ b1 ≤ 12 + 5/3 0 ∆b = δ 0 −3δ + 12 ≥ 0 ⇒ 9 ≤ b1 ≤ 13 2 3 ⇒ ⇒ −3/7 12/7 δ 4/7 + 5/7 ≥ 0 0 1 δ ≤ 4 and 4δ + 5 ≥ 0 ⇒ ⇒ δ ≥ −5/4 Thus −5/4 ≤ δ ≤ 4 ⇒ 12 − 5/4 ≤ b2 ≤ 12 + 4 0 ∆b = 0 δ 3 10 ≤ b2 ≤ 16 4 ⇒ ⇒ 0 12/7 δ −1 + 5/7 ≥ 0 1 1 ⇒ −δ + 5/7 ≥ 0 ⇒ δ ≤ 5/7 and δ + 1 ≥ 0 ⇒ δ ≥ −1 −1 ≤ δ ≤ 5/7 ⇒ 1 − 1 ≤ b3 ≤ 1 + 5/7 0 ≤ b3 ≤ 1 Thus ⇒ 5 7 iii. To calculate the range of optimality for each of the coefficients in the original objective function replace in turn the c values in the final tableau with α. To ensure the tableau remains optimal impose the condition on α such that the final row remains non-positive. For the c-coefficient of x1 in the objective function z the optimal table (Table A.10) becomes: Basic Var x1 x2 x3 zj ∆z cj α 2 3 x1 α 1 0 0 α 0 x2 2 0 1 0 2 0 x3 3 0 0 1 3 0 s1 0 16/28 −3/7 0 4α/7 − 6/7 −4α/7 + 6/7 s2 0 −12/28 4/7 0 −3α/7 + 8/7 3α/7 − 8/7 s3 0 0 −1 1 1 −1 d d a ratio 48/28 5/7 1 z= 31+12α 7 Table A.11: The final row must remain non-positive for the table to remain optimal From Table A.11 −4α/7 + 6/7 ≤ 0 and 3α/7 − 8/7 ≤ 0 the table to remain optimal. Thus 3/2 ≤ α ≤ 8/3 must be satisfied for The interval of optimality for c1 , the c-coefficient of x1 , is [ 23 , 83 ]. Repeating the above with, in turn, α replacing the c-coefficient of x2 and then x3 gives: Range of optimality for c2 is [ 23 , 83 ] and for c3 is [2, ∞). APPENDIX A. WORKSHEETS 22 2. (a) Introducing s1 , s2 ≥ 0 the inequalities become: x1 + x2 + s1 = 2 (i) x1 + 3x2 − s2 = 3 which can be written in matrix form: µ ¶ µ ¶ 1 1 1 0 2 x= 1 3 0 −1 3 (ii) x1 , x2 ≥ 0 x≥0 where x = (x1 , x2 , s1 , s2 )T and the objective function z = 2x1 + x2 + 0s1 + 0s2 . The simplex method tries to starts with s1 and s2 as basic variables by setting x1 = x2 = 0. However (ii) implies that s2 = −3 < 0, thus this is not a valid starting point as it is not in the feasible region. (b) The problem of finding a feasible starting value is overcome by the introduction of an artificial variable a1 ≥ 0 into (ii). (ii) becomes: x1 + 3x2 − s2 + a1 = 3. Thus initially the non-basic variable are taken to be x1 , x2 , s2 (all set equal to zero) and the basic variables are s1 and a1 , which clearly have the values 2 and 3 respectively. The key point is that the starting values are now in the feasible set. (c) As a1 is an artificial variable we require it to vanish from the final solution, this can be done by introducing M >> 0 into the objective function (relabel z 0 )as: z 0 = x1 + 3x2 + 0s1 + 0s2 − M a1 Clearly the −M a1 term will tend to suppress the value of z, thus when maximizing, this term will have the least affect when a1 = 0. That is to say the maximization process will tend to force a1 to zero. To set up the first tableau order the variables so that the ’body’ of the table looks like (D|I). That is to say the first three variables are the non-basic variables and the last two are the basic variables. Basic Var s1 a1 zj ∆z cj 0 −M x1 2 1 1 −M 2+M x2 1 1 3 −3M [1 + 3M ] s2 0 0 −1 M −M s1 0 1 0 0 0 a1 −M 0 1 −M 0 d d a ratio 2 3 0 z = −3M 2 [1] Table A.12: For sufficiently large M maximum positive value in the last row is [1 + 3M ], thus add x2 to the basic set. Smallest non-negative term in the final column corresponds to a1 , hence remove a1 from the basic set. To bring in x2 and take out a1 row reduce to make the x2 column equal to the old a1 column, namely e2 . (See Table A.13) APPENDIX A. WORKSHEETS Basic Var s1 x2 zj ∆z cj 0 1 x1 2 2/3 1/3 1/3 [5/3] 23 x2 1 0 1 1 0 s2 0 1/3 −1/3 −1/3 1/3 s1 0 1 0 0 0 a1 −M −1/3 1/3 1/3 −M − 1/3 d d a ratio 1 1 0 z = 1 [3/2] 3 Table A.13: The next step is to bring in x1 and remove s1 Basic Var x1 x2 zj ∆z cj 2 1 x1 2 1 0 2 0 x2 1 0 1 1 0 s2 0 1/2 −1/2 1/2 −1/2 s1 0 3/2 −1/2 (5/2) −5/2 a1 −M −1/2 1/2 (−1/2) −M + 1/2 d d a ratio 3/2 1/2 z0 = 3 12 Table A.14: Since the final row (corresponding to the variables) contains no positive terms the tableau is optimal To bring in x1 and take out s1 row reduce to make the x1 column equal to the old s1 column, namely e1 . (See Table A.14) From Table A.14 the maximum value of z = 3 12 with x1 = 3/2 and x2 = 1/2. (d) The shadow or dual variables are denoted by ( ) in Table A.14. Thus corresponding to the constraint containing s1 the shadow variable is 5/2 and corresponding to the constraint containing the artificial variable a1 the shadow variable is −1/2. (e) In Figure A.6(a) the objective function has been drawn with z = 2 and is shown dotted. Clearly the maximum value of z is at P. Solving x1 + 3x2 = 3 and x1 + x2 = 2 gives P(3/2,1/2) and z = 3 21 . The same solution as above. The order in which the simplex method evaluates the problem is given by looking at each table. Table A.12 at O; Table A.13 at A; Table A.14 at P. In Figure A.6(b) the maximum is now at Q(3,0) with z = 6. The dual variable for this constraint was 2.5 thus in changing the righthand side from 2 to 3 we would expect an increase in z by 2.5. This is clearly the case as z increases from 3.5 to 6. (note this assumes that an increase of 1 is within the feasible range for this particular constraint) APPENDIX A. WORKSHEETS x2 24 x2 (b) (a) x1 + x2 = 3 .. .. .. .. .. .. .. .B 2 .... .. .. .. .. . 1 A .... .. .. .. .. .. .. .. O .. .. .. .. z = 2 = 2x1 + x2 3 x1 + 3x2 = 3 1 A P C 2 3 x1 O x1 + 3x2 = 3 x1 + x2 = 2 Figure A.6: Feasible region shown hashed z = 4 = 2x1 + x2 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..C .. .. 2 ... . Q x1 3 APPENDIX A. WORKSHEETS A.9 25 Worksheet 5 1. Use Prim’s algorithm to obtain the minimum spanning tree for the following undirected network in Fig. A.7 together with its value. The edges are numbered with the distances between nodes. 2 5 1 2 2 9 4 4 2 3 3 7 4 1 3 1 3 5 6 5 8 5 10 Figure A.7: 2. Repeat question 1 using Kruskal’s algorithm. 3. The network in Fig. A.8 is a directed graph with distances between nodes along each edge. Use Dijkstra’s Algorithm to find the shortest route from node(a) to all the other nodes. In each case give the shortest path and its length. 3 µ 2 b 9 a 2 q c 6 3 - g - d 3 1 - e : 9 Figure A.8: 2 - f 3 U - h 3 1 APPENDIX A. WORKSHEETS 26 4. The network in Fig. A.9 is a mixed graph with edges numbered with the distance between the nodes. Use Floyd’s algorithm to find the shortest routes between all pairs of the nodes giving the routes and distances. 2 > 2 1 3 1 w - 4 6 3 3 4 Figure A.9: 5. Use the min cut max flow theorem to construct by inspection a possible maximum flow in the following mixed network Fig. A.10(a); numbers refer to capacities. Give the value of the maximum flow. Fig (a) 6 a S } µ 3 2 - c 9 R - b 2 2 7 + 5 3 3 d Fig (b) 1 d s - f R - 4 1 a 1 T 6 q - b : 2 S > 6 5 3 z 3 c * 6 ? d 4 7 2 - e 3 3 q ? : T 4 Figure A.10: 6. Use the Ford-Fulkerson algorithm to find a maximum flow from source S to sink T for the directed network in Fig. A.10(b); numbers refer to capacities. APPENDIX A. WORKSHEETS A.10 27 Worksheet 5 - Solutions 1. Figure A.11 shows the minimal spanning tree formed using Prim’s algorithm. The length of the tree is 22. 2 1 2 1 1 1 1 2 2 1 2 3 1 1 3 5 4 2 1 1 1 5 2 3 3 3 4 4 2 2 7 3 5 1 1 6 3 7 4 4 2 2 6 7 1 3 3 2 3 3 4 2 5 1 2 2 1 2 1 3 3 3 3 1 4 2 4 5 1 1 2 1 2 3 8 6 2 9 8 1 6 2 1 1 5 4 4 2 3 3 3 2 6 7 2 9 8 4 10 Figure A.11: Prim’s Algorithm adding the closest node at each stage 2. Figure A.12 shows the construction of the minimal spanning tree for the same network as Q1 but using Kruskal’s algorithm. This process has given the same spanning tree, however minimum spanning trees are not neces- APPENDIX A. WORKSHEETS 2 28 5 1 2 1 1 1 4 1 1 2 5 1 2 3 3 2 6 2 3 9 6 7 2 4 1 3 2 4 2 1 7 5 2 9 5 1 1 1 3 3 7 2 4 8 4 2 3 2 6 9 4 10 Figure A.12: Kruskal’s Algorithm adding links (with node) in ascending order 1,2... sary unique, the same network can give rise to different trees. The important point is that the size of the minimum spanning tree is unique for the given network. All minimum spanning trees for this problem will be of size 22. 3. The notation in Figure A.13 is [distance from a, predecessor node] for a temporary label and [distance from a, predecessor node] for a permanent node. The initial node(a) is labelled [0,a] and then made permanent since at this point in the process it is the only temporary node, and hence is the smallest. At each stage the nodes adjacent to the last created permanent node are labelled with a temporary label if not already labelled. However if the adjacent node already has a temporary label it is replaced with the new label provided the new label has a smaller distance value. Finally if the adjacent node has a permanent label it is not relabelled. Thus with reference to Figure A.13: (a) node(b), node(c) and node(e) are given temporary labels. Node(c) is made permanent since it is the smallest temporary label. (b) Since node(c) is the last permanent label, node(e) and node(f) are given temporary labels. Note that the label on node(e) replaces the already existing label since it is of a shorter distance value. Node(b) is made permanent since it is the smallest temporary label. (c) Since node(b) is the last permanent label, node(d) is given a temporary label. Node(d) is made permanent since it is the smallest temporary label. (d) Since node(d) is the last permanent label, node(g) is given a temporary label. Node(e) or node(g) can now be made permanent since they are equally nearest to node(a) (distance =8). Make node(e) permanent. APPENDIX A. WORKSHEETS 29 (a) [3,a] 2 b 3 g - d [0,a] [9,a] 9 6 2 q c (c) [3,a] 2 b [0,a] (e) 3 µ 2 b 9 a 6 q [0,a] 2 c [2,a] (d) [0,a] 1 2 - f [5,b] 2 - f 9 2 b [5,b] U - h 3 [10,e] 1 [9,a] 9 a [0,a] 2 q c 6 1 3 3 1 - e : [8,c] 9 [2,a] [11,c] U - h 3 [8,d] 3 g - d 3 µ 3 3 [11,c] (f) [3,a] 1 3 1 [8,c] [2,a] U - h 3 [8,d] 3 g - e : 6 2 q c 3 [11,c] - d 9 3 g 3 - f 9 2 a [8,d] - e : 9 [8,c] [9,a] [11,c] - d [8,c] 1 - f [5,b] [9,a] U - h 3 2 2 3 µ 3 1 9 [3,a] 6 b 3 [8,c] [2,a] 2 q c 1 - e : [3,a] - e : 6 2 q c [0,a] 3 g [9,a] 9 9 a [5,b] - d 3 [9,a] [2,a] 3 µ a 1 - f 9 [2,a] U - h 3 2 - e : 3 g - d 3 µ 3 1 2 b 3 3 µ a (b) [3,a] U 2 - f - h 3 [10,e] 1 [11,c] Figure A.13: (e) Since node(e) is the last permanent label, node(h) is given a temporary label. Node(g) is made permanent since it is the smallest temporary label. (f) Since node(g) is the last permanent label we look to give node(h) a label. Since the temporary label on node(h) is less than the incoming label no relabelling takes place. Node(h) is made permanent since it is the smallest temporary label. Finally since node(h) is the last permanent label we look to give node(f) a label. Since the incoming label is the same value as the temporary label already on node(f) no change is made. Node(f) is then made permanent. The process terminates since all nodes are now permanent. The labels can be used to trace back the path from each node to node(a) to give: a → b : 3, a → b → d : 5, a → b → d → g : 8, a → c → e : 8, APPENDIX A. WORKSHEETS a→c: 2, 30 a→c→f : 11, a→c→e→h: 10. 4. Floyd’s method requires two matrices, one representing the state of the current network (Di ) and one monitoring the changes made (Mi ). Start at node(1): If di,1 + d1,j < di,j , that is to say path. ∗ ∞ D0 = 3 ∞ if there a shorter path via node(1), then make a replacement 2 ∗ 3 ∞ 3 3 ∗ 4 6 1 4 ∗ 1 1 M0 = 1 1 2 2 2 2 3 3 3 3 4 4 4 4 For node(1) no replacement necessary. Move to node(2). If di,2 + d2,j < di,j , that is to say if there is a shorter path via node(2), then make a replacement path. ∗ 2 3 − − 63 1 2 3 − − 42 ∞ ∗ 3 1 1 2 3 4 D1 = M1 = 3 3 ∗ 4 1 2 3 4 1 2 3 4 ∞ ∞ 4 ∗ Move to node(3): If di,3 + d3,j < di,j , that is to say if there path. 3 ∗ 2 6 − ∞ − ∗ 3 D2 = 3 3 ∗ − ∞ −7 − ∞ −7 4 is a shorter path via node(3), then make a replacement 3 1 4 ∗ 1 2 3 − − 1 2 M2 = 1 2 − − 13 − − 23 3 3 3 3 2 4 4 4 Move to node(4): If di,4 + d4,j < di,j , that is to say if there is a shorter path via node(4), then make a replacement path. ∗ 6 D3 = 3 7 2 ∗ 3 7 3 3 ∗ 4 3 1 4 ∗ 1 3 M3 = 1 3 2 2 2 3 3 3 3 3 2 4 4 4 For node(4) no replacement necessary. Thus D3 gives the matrix of shortest distances between nodes and M3 gives us the route for this path from node to node. APPENDIX A. WORKSHEETS 1 → 2 = 2, 31 2 → 3 → 1 = 6, 2 → 3 = 3, 3 → 2 = 3, 1 → 3 = 3, 3 → 1 = 3, 1 → 2 → 4 = 3, 2 → 4 = 1, 4 → 3 → 2 = 7, 3 → 4 = 4, 4→3→1=7 4→3=4 5. Figure A.14 shows a flow of 9 and a cut of 9, thus by the max-flow min-cut theorem the network is at its maximum. [3,6] a } µ [3,3] S [2,2] - b [2,2] [1,2] - c [0,7] + [3,5] 3 d [3,4] R - T > [3,3] [4,9] R e [1,1] s - f [4,6] cut=9 Figure A.14: 6. With reference to Figure A.15: (a) The network starts with zero flow in each arc, notation [flow, capacity]. A flow augmenting path is then constructed using the algorithm, with the nodes being labelled (predecessor node, max possible additional flow). In this diagram the augmenting path is S → b → T and has value 2. The flow in the network is them increased along this path by 2. The network is then redrawn with the updated flows and the process repeated until no flow augmenting path can be found. (b) The flow augmenting path is S → c → T with value 3. The path is shown updated. (c) The flow augmenting path is S → a → b → T with value 1. The path is shown updated. (d) The flow augmenting path is S → d → e → T with value 2. The path is shown updated. (e) In this final network the algorithm stops before reaching T . As seen it is not possible to augment from node(b) to node(T) or node(c) to node(T) since the links are saturated. Additionally it is not possible to get to node(e) and on to node(T) since the path from node(d) to node(e) is saturated and the reverse path from node(c) to node(e) has zero flow. APPENDIX A. WORKSHEETS (a) 32 (b) (S,1) (S,∞) S [0,3] [0,6] [0,1] 1 a (S,2) q [0,2][2,2] - b : (S,5) [0,5] z [0,3] c [0,3] * 6 ? d (S,3) (c) [0,7] [0,2] [2,3] [0,4] - e [0,3] q ? : T [0,4] (b,2) S [0,3] ? d (S,3) [0,1] a [1,1] 1 [2,2] (S,2) [3,5] z c (S,∞) S [0,3] ? d (S,3) [0,1] 1 a [2,2] [3,5] (S,5) [0,5] z c [0,6] (a,1) q - b : [0,3] [2,3] [3,3] * 6 [0,3] q ? [0,4] : T [0,7] [0,4] - e (c,3) [0,2] (d) (S,1) (S,∞) (S,1) [0,6] [1,6] (a,1) a [1,1] 1 [2,2] (S,2) [3,5] z c (S,∞) q - b : S [0,3] [3,3] * 6 [3,3] q ? [2,3] [0,4] : T [0,7] [0,4] - e (b,1) [0,2] (d,2) [0,3] [2,3] [1,6] (c,2) q - b : [0,3] [3,3] [3,3] q ? [0,4] : T [0,7] [0,4] - e (e,2) [0,2] [2,4] [2,2] (d,2) * 6 ? d (S,3) (e) (S,∞) S [2,3] a [1,1] 1 [2,2] (S,2) [3,5] z c [1,6] [0,3] * 6 ? [0,7] d (S,1) [2,2] (c,2) q - b : cut = 8 [3,3] q ? [0,4] [3,3] : T - e [2,4] (e,2) Figure A.15: Hence the final network with maximum flow of 8 is seen in Figure A.15(d). Just for interest I have included a cut in Figure A.15(e) with value 8. This is therefore a minimum cut since we know the max flow is also 8. Note that the flow from node(e) to node(c) does not contribute to the value of the cut as it is in the reverse direction, that is to say it is leaving and not entering the cut region containing T . APPENDIX A. WORKSHEETS A.11 33 Worksheet 6 - Class Example - No solution given 1. Using the methodology of dynamic programming we are required to find for the network below: (i) The shortest path from node(1) to node(10). (ii) The longest path from node(1) to node(10). (iii) The path from node(1) to node (10) containing the shortest legs. Before carrying out the calculations identify the following; • Suitable stages for the process. • The decision set Di at each stage. • The state variables xi at each stage. • The optimization function for each of (i), (ii) and (iii) above. Carry out the calculations for (i), (ii) and (iii) by annotating Figures A.16 to A.18. 7 2 7 - 6 4 9 9 9 6 s 3 8 5 5 8 8 3 - 4 ^ 10 7 6 R - 10 8 µ 10 w 12 12 ~ 1 - 7 3 7 s - 4 Figure A.16: Use for (i) 9 APPENDIX A. WORKSHEETS 34 7 2 7 - 6 4 9 9 9 6 12 12 ~ 1 - 7 3 7 s - 8 3 8 5 5 8 µ 10 w - 3 ^ 10 7 6 4 R - 10 8 s - 4 9 Figure A.17: Use for (ii) 7 2 7 - 6 4 9 9 9 6 s - 8 3 8 5 5 8 10 w 3 - 4 12 12 ~ 1 - 7 3 7 ^ µ 10 7 6 R - 10 8 s - 4 Figure A.18: Use for (iii) 9 Appendix B Past Exam - May 2008 B.1 Question Paper Full marks for correct solutions to any FOUR or the SIX questions - 2 14 hours Question 1 The 2-bit computer company makes two types of computer, laptop and desktop. The computers are produced at 2-bit’s plant which is semi-automated and uses two manufacturing lines. One line assembles the computers whilst the other finishes, tests and packages them. The assembly time for a laptop is 30 mins and 15 mins for a desktop. The finishing, packaging and testing times are 20 mins for a laptop and 20 mins for a desktop. Both assembly lines are available for 8 hrs a day and it is projected that the profit on a laptop is £250 and on a desktop £100. (i) Using the above data formulate and solve graphically the linear programming problem to obtain the maximum profit and the associated production levels in each 8 hour shift. Why might this result not be acceptable to 2-bit? [7 marks ] (ii) Calculate the ’reduced costs’ associated with each type of computer. By how much would the profit on a desktop need to be increased in order to make its production worthwhile. What would be the new maximum profit and production levels if this increase were made? [3 marks ] (iii) Write down the dual of the original problem, interpreting the dual decision variables, objective function and constraints in terms of the production problem. Solve the dual problem graphically and say if it is more profitable to make a marginal increase in the amount of time on the assembly line or on the finishing, testing and packaging line. [5 marks ] (iv) The marketing people at 2-bit decide that it is desirable to produce at least as many desktops as laptops. 35 APPENDIX B. PAST EXAM - MAY 2008 36 Express this constraint mathematically and hence amend your graph in (i) to show the new feasible region. What is the new maximum profit and the associated production levels in the 8 hour shift. Comment on the total time used on each production line in the 8 hr shift and say why this might be of concern to 2-bit. [5 marks ] (v) The management wish to ensure that in any 8 hr shift the difference in the times the two production lines are in use is no more than 20 minutes. Express this constraint mathematically and hence add to your graph to obtain the new levels of production and maximum profit. [5 marks ] [25 marks in total ] Question 2 The Finance Director of a large company has to make provision for the early retirement packages that are being offered to its employees over the next eight years. At the closing date for the acceptance of such packages the required funds (in £1000) at the start of each year are given in Table F.16. year required funds 1 450 2 400 3 250 4 220 5 200 6 180 7 220 8 250 9 300 Table B.1: The amounts, in thousands of pound, required at the start of each year. It is the Finance Director’s task to work out how much to set aside at the start of the process, including the amount required for the first payment, in order to meet the rest of the payments. In order to generate income the Finance Director can either invest in government bonds, which make payments at the end of each year, or invest in a cash account at 4.5% per annum. There are four types of bonds available to him, each with a par value of £100 but with different annual rates and different lengths of time to maturity. The details of the types of bonds are given in Table F.17. Bond Type 1 2 3 4 Price £ 115 100 125 135 Annual Rate % 8.5 5.5 10.0 11.5 Years to Maturity 4 6 7 8 Table B.2: Present purchase price of the four types of bond, their various maturity dates and their annual return. APPENDIX B. PAST EXAM - MAY 2008 37 Let S be the total amount, in units of one thousand pounds, that has to be set aside, including the first payment, to fund the scheme. Let b1 , b2 , b3 and b4 be the number of bonds of each type purchased at the start of the process; this is the only time at which bonds are purchased. Let si i = 1, . . . 9 be the amount, in units of one thousand pounds, held as a cash deposit at the start of each year. Note that money, generated as income from the investments or maturing bonds may be added to the cash account at the start of each year, or if necessary withdrawn from the cash account to help meet the payments. The variable s9 would represent money left over at the end of the scheme. Using the above variables construct, with explanation, the linear programming problem that minimizes the total amount S that the Finance Director has to put aside. [10 marks ] The output from solving the linear programming problem is given in Table B.3. Since the bonds are of low value you may, for the purpose of this problem, ignore the fact that it is not possible to buy parts of a bond. Answer the following question with reference to the output. (i) How much did the Finance Director spend on bonds and how much cash did he initially place on deposit. [3 marks ] (ii) Determine the reduction of the amount of cash on deposit at the start of each subsequent year. [3 marks ] (iii) What is the initial value of £1 paid out at the start of year 9. [2 marks ] (iv) If the amount required at the start of year 9 was in fact £400,000, by how much should S be increased in order to accommodate this change. [2 marks ] (v) What is the minimum decrease in the price of type 1 bonds to make their purchase worthwhile? [2 marks ] (vi) As he is about to purchase the bonds the Finance director discovers that the price of type 4 bonds has increased. What is the maximum increase that he can sustain in order to retain the levels of his original investment strategy. [3 marks ] APPENDIX B. PAST EXAM - MAY 2008 Variables Name b1 b2 b3 b4 s1 s2 s3 s4 s5 s6 s7 s8 s9 Constraints Name Yr 2 Yr 3 Yr 4 Yr 5 Yr 6 Yr 7 Yr 8 Yr 9 38 Final Value 0.00 1577.41 2264.17 2690.58 843.33 543.54 380.26 239.63 112.67 0.00 0.00 0.00 0.00 Reduced Cost 0.00065 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.05109 0.01686 0.02973 0.61453 Objective Coefficient 0.115 0.1 0.125 0.135 1 0 0 0 0 0 0 0 0 Allowable Increase 1E+30 0.00516 0.00177 0.00317 0.00568 0.00586 0.00605 0.00626 7.22569 1E+30 1E+30 1E+30 1E+30 Allowable Decrease 0.00065 0.00162 0.00295 0.06852 0.04905 0.04941 0.04979 0.05020 0.05063 0.05109 0.01686 0.02973 0.61453 Final Value 400 250 220 200 180 220 280 300 Shadow Price 0.95694 0.91573 0.87630 0.83856 0.80245 0.71901 0.67191 0.61453 Constraint R.H. Side 400 250 220 200 180 220 280 300 Allowable Increase 1E+30 1E+30 1E+30 1E+30 1E+30 2258.48423 1366.38296 1324.79739 Allowable Decrease 881.28011 567.99849 397.36920 250.41159 117.74088 166.41663 249.05830 300.00000 Total Sum S Value 2097.32062 Objective function Table B.3: Output from solving the Linear Programming problem. [25 marks in total ] APPENDIX B. PAST EXAM - MAY 2008 39 Question 3 (a) For a Euclidean space E define what is meant by: (i) L is a line segment from x1 to x2 . (ii) C is a convex subset of E. (iii) a is an extreme point of C If A is an m × n matrix, m ≤ n, with m independent rows, define what is meant by saying that x is a basic feasible solution of Ax = b , x ≥ 0. Given x 1 0 0 1 1 3 0 1 0 1 x2 = 2 x3 0 0 1 1 1 x4 x≥0 obtain all basic feasible solutions. State briefly how an extreme point and a basic feasible solution are related when solving a linear programming problem. [8 marks ] (b) Consider the following problem: Maximize z = 2x1 + 3x2 + x3 subject to the constraints: x1 + x2 + x3 ≤ 2 (1) x1 + 2x2 + 2x3 ≤ 3 (2) x1 , x2 , x3 ≥ 0 (3) (i) Introduce two slack variables s1 and s2 to write the problem in the matrix form: Maximize z = cT x, subject to Ax = b, x ≥ 0. State clearly the values of c, x, b and A. [2 marks ] (ii) Write down the first Simplex Tableau. [4 marks ] (iii) Find the optimal solution to the problem using the Simplex Method. [6 marks ] (iv) From your final tableau find the feasible range for the righthand side of constraint (1). [5 marks ] [25 marks in total ] APPENDIX B. PAST EXAM - MAY 2008 40 Question 4 (a) A car hire company wishes to develop a strategy for replacing its fleet over a five year period. The projected data for replacing a car is given in Table B.4. For example the cost of replacing a car bought at the start of 2009 and replaced after two years at the start of 2011 would be £6000. Assume that the scheme starts with a new car at the start of 2008 and that the company only changes its cars at the end of one, two or three years. The company’s objective is to find the minimum replacement cost and associated strategy so that at the start of 2013 a new car is purchased. Car bought start of 2008 2009 2010 2011 2012 Replacement cost (£) for given years of service 1 2 3 4500 5500 8500 4625 6000 9000 4750 6500 9500 4875 7000 − 5000 − − Table B.4: Replacement cost of a car after a given number of years of service as a function of the year of its purchase Construct a network for this problem such that the solution to the problem is obtained by identifying a path of minimum length through the network. Define carefully the meaning of the vertices and edges in your network. Hence demonstrate and use Dijkstra’s algorithm to solve the problem. [12 marks ] (b) For a graph G define the terms: Tree, Spanning Tree, Minimal Spanning Tree. [3 marks ] A University campus has two computing centres which must be connected by a direct link. The other buildings on the campus can either be connected directly to one or other of the computer centres or indirectly via the computing facilities of other buildings. The network in Figure B.1 indicates the cost, in thousands of pounds, of making connections between the various buildings. The computing centres are labeled C1 , C2 and the other buildings B1 , . . . B8 . As can be seen it is not possible to connect all building directly to each other or to a computing centre. Use Prim’s algorithm to establish the most cost effective method of making the connections such that all the sites are in some way interconnected. State the level of this cost. Comment on the uniqueness of Prim’s algorithm in establishing the optimum solution. [10 marks ] APPENDIX B. PAST EXAM - MAY 2008 41 3 B1 B6 2 C1 4 6 1 B2 6 5 3 B7 2 7 B5 4 2 4 3 2 6 C2 3 B4 B3 1 B8 5 Figure B.1: Diagram of potential connections. [25 marks in total ] Question 5 The network in Figure B.2 represents the transfer of oil from three refineries, R1 , R2 and R3 , via pumping stations, P1 and P2 , to the oil terminals, T1 and T2 , where it is stored prior to distribution. The pipelines along which the oil travels have varying maximum capacity, each being able to only transfer a certain number of barrels of oil per day. These capacities are indicated on the arcs in thousands of barrels per day. With the exception of the pumping station P1 , all the other pumping stations can, if necessary, deal with the maximum amount of oil that its supply pipes can deliver. Pumping station P1 is being upgraded and at present can only deal with 8 thousand barrels per day. R1 4 q P2 : R2 3 5 R3 5 4 - T1 > 4 ? q P1 : 6 6 ~ - T2 6 Figure B.2: Diagram of links between refineries, pumping stations and terminals. (i) Show how the network can be redrawn to convert it into a standard network with a single source, single sink and unrestricted nodes. APPENDIX B. PAST EXAM - MAY 2008 42 Denoting the flow from node i to node j by fi,j , where i and j are the node labels, write down an expression for the value of the flow in the network. [5 marks ] (ii) Define what it meant by a ’Flow Augmenting Path’ for the standard network described in (i). [2 marks ] (iii) Construct an example of a non-zero flow in your standard network. [2 marks ] (iv) Use the Ford-Fulkerson algorithm to find the maximum flow in the network and show clearly how it is attained. Hence state how much oil the refineries should produce and what storage capacity is needed at the terminals to ensure that the pipelines are best utilized. [10 marks ] (v) State the Max-Flow Min-Cut theorem and hence ’by inspection’ construct a cut that establishes that the flow obtained in (iv) is indeed maximum. [6 marks ] [25 marks in total ] Question 6 A building maintenance firm carries out four types of work (plumbing, joinery, building and drainage) and is the primary subcontractor for the Local Authority. The Local Authority has a list of jobs that need completing in the next ten days and gives the firm the first choice of jobs for which it wishes to contract. The remaining jobs will then be contracted out to other building firms. In the following table the number of available jobs of each type is listed along with the time in days it will take the contractor to complete a single job of a given type and the amount of profit the contractor will make carrying out such a job. The firm has to decide how many jobs of each type it should undertake in order to maximize its return whilst completing the work in the given time frame. However the firm is not large enough to be able to carry out more than one job at a time. Job Type Drainage Building Plumbing Joinery Number of Available Jobs 3 2 5 5 Time/job in days 8 5 2 1 profit/job £1000 50 15 10 5 (i) In the context of a dynamic programming approach to the above problem identify the following: (a) The four decision stages, i = 1 . . . 4. (b) The state variable xi at each stage. APPENDIX B. PAST EXAM - MAY 2008 43 (c) The decisions at each stage. (d) An optimization functional fi (xi ) and a defining backward recursion relation. [7 marks ] (ii) Draw a suitable network to illustrate the above problem, indicating clearly the four stages. Hence use your network, by making suitable annotations at each node, to obtain the optimal strategy and return for the problem. (Show all your working.) [18 marks ] [25 marks in total ] APPENDIX B. PAST EXAM - MAY 2008 B.2 44 Solutions Solutions May 2007 1. (i) Let xL and xD be the number of laptops and desktops produced each day; thus xL , xD ≥ 0 The profit is given by: z = 250xL + 100xD Minutes assembling = 30xL + 15xD ≤ 480 Minutes finishing = 20xL + 20xD ≤ 480 ⇒ ⇒ 2xL + xD ≤ 32 xL + xD ≤ 24 xD Q(0, 24) P (8, 16) xL R(16, 0) 2xL + xD = 32 Calculating z at P , Q and R gives: zQ = 2400, zP = 3600, zR = 4000 Thus the maximum profit is £4000 consisting of 16 laptops and 0 desktops. Producing no desktops may not be acceptable to 2-bit. xL + xD = 24 [7 marks ] (ii) Reduced cost for laptops is zero since xL 6= 0 at optimum. Since xD = 0 at optimum, change coefficient of xD in z such that the objective function has the same slope as 2xL + xD = 32, thus making P optimum. Let α be the reduced cost, thus: 250 = −2 ⇒ α = −25 100 − α Thus the profit on a desktop must be increased by £25 to make its production worthwhile. The production is 8 laptops and 16 desktops with a profit of £4000. − [3 marks ] (iii) The dual problem: Let yA be the cost/min on the assembly line and yF be the cost per minute on the finishing line. Then the dual problem is: Minimize z = 480yA + 480yF subject to: 30yA + 20yF ≥ 250 15yA + 20yF ≥ 100 yA , yF ≥ 0 30yA + 20yF is the cost of producing 1 laptop and 15yA + 20yF is the cost of producing 1 desktop, in each case this cost is greater than the profit. [3 marks ] APPENDIX B. PAST EXAM - MAY 2008 45 yF P (0, 25/2) Q(25/3, 0) 3yA + 4yF = 20 The value of z at P and Q is given by zP = 6000 and zQ = 4000. The minimum z is £4000, with yA = 25/3 and yF = 0. Thus better to increase the time on the assembly line. [2 marks ] yA 3yA + 2yF = 25 (iv) xD Q(0, 24) xD = xL P (8, 16) S xL R(16, 0) 2xL + xD = 32 xL + xD = 24 The constraint is xD ≥ xL hence add xD = xL to the graph in (i). At S(10 23 , 10 23 ) the value of z = 3733 31 , thus max at S. The time on the assembly line is now 480 mins and on the finishing line 426 23 mins. The finishing line staff are idle for too long. [5 marks ] (v) The constraint is given by: xD |30xL + 15xD − 20xL − 20xD | ≤ 20 ⇒ 10xL − 5xD = −20 10xL − 5xD = 20 −20 ≤ 10xL − 5xD ≤ 20 Plot the two equations on the graph in (iv). New max at T (9, 14) with z = 3650 Hence 2-bit should produce 9 laptops and 14 desktops per day. xD = xL Q(0, 24) P T S xL R(16, 0) 2xL + xD = 32 xL + xD = 24 [5 marks ] 2. We wish to minimize the outlay, S, at the start of the first year, given by: S = 450 + 0.115b1 + 0.100b2 + 0.125b3 + 0.135b4 + s1 [2 marks ] We must have sufficient funds to meet the payments at the start of each subsequent year. (Since any excess funds can be placed on deposit the constraints can be just = though ≤ also acceptable in the following.) • start yr 2: 400 = 0.0085b1 + 0.0055b2 + 0.01b3 + 0.0115b4 + 1.045s1 − s2 • start yr 3: 250 = 0.0085b1 + 0.0055b2 + 0.01b3 + 0.0115b4 + 1.045s2 − s3 APPENDIX B. PAST EXAM - MAY 2008 • start yr 3: 46 220 = 0.0085b1 + 0.0055b2 + 0.01b3 + 0.0115b4 + 1.045s3 − s4 • type 1 bonds now mature thus at start of year 4: 200 = 0.1085b1 + 0.0055b2 + 0.01b3 + 0.0115b4 + 1.045s4 − s5 • start yr 5: 180 = 0.0055b2 + 0.01b3 + 0.0115b4 + 1.045s5 − s6 • type 2 bonds now mature thus at start of year 6: 220 = 0.1055b2 + 0.01b3 + 0.0115b4 + 1.045s6 − s7 • type 3 bonds now mature thus at start of year 7: 250 = 0.11b3 + 0.0115b4 + 1.045s7 − s8 • type 4 bonds now mature thus at start of year 8: 300 = 0.1115b4 + 1.045s8 − s9 All variables are greater or equal to zero. [8 marks ] (i) s1 = £843, 330 place initially on deposit. Spend on bonds=£803,990.55 [3 marks ] (ii) Reductions: start of year 2 £299,790; start of year 3 £163,280; start of year 4 £140,630; start of year 5 £126,960; start of year 6 £112,670; and then no more cash deposits. [3 marks ] (iii) This is the dual price for year 9 payment = £0.61453 ≈ 61.5p. [2 marks ] (iv) This is the present day value of £100,000 at year 9 = 100000 × 0.61453 = £61, 453 [2 marks ] (v) Reduced cost = 0.00065, thus we need the price of type 1 bond to decrease by 65p. [2 marks ] (vi) Allowed increase of type 4 bond is 0.00317, thus we can sustain an increase of £3.17 and still retain our buying levels etc. [3 marks ] 3. (a) (i) L = {x ∈ E : x = x1 + λ(x2 − x1 ) 0 ≤ λ ≤ 1} (ii) C is a convex subset of E if for any two points x1 and x2 in C the line segment joining the two points lies entirely in C. (iii) a is an extreme point of C if a ∈ C and there is no line segment in C such that a is an interior point of the line segment. [3 marks ] A basic feasible solution is a solution of Ax = b, x ≥ 0 formed by selecting m independent columns of A, setting the variables associated with the other n − m columns equal to zero, and solving the m independent equations so formed. [1 mark ] Directly: x4 = 0, x1 = 3, x2 = 2, x3 = 1 feasible. 1 0 0 1 3 1 0 0 1 3 0 1 0 1 2 → −1 1 0 0 −1 0 0 1 1 1 −1 0 1 0 −2 x1 = 0, x2 = −1, x3 = −2, x4 = 3 not fsbl APPENDIX B. PAST EXAM - MAY 2008 0 1 0 −1 1 0 → 0 −1 1 0 0 −1 0 → 0 −1 2 1 0 −1 0 −1 47 x1 = 1, x2 = 0, x3 = −1, x4 = 2 1 1 1 1 0 −2 1 0 −1 not feasible x1 = 2, x2 = 1, x3 = 0, x4 = 1 feasible [3 marks ] For a linear programming problem the optimum occurs at an extreme point and basic feasible solutions correspond to extreme points. [1 mark ] (b) (i) In terms of non-negative variables the problem can be written as: Maximize z = 2x1 + 3x2 + x3 + 0s1 + 0s2 subject to x1 + x2 + x3 + s1 = 2 and x1 + 2x2 + 2x3 + s2 = 3. In matrix form: x1 x2 µ ¶ µ ¶ 1 1 1 1 0 2 T x z = (2, 3, 1, 0, 0) x Ax = x = =b = c 3 1 2 2 0 1 3 s1 s2 [2 marks ] (ii) Basic s1 s2 zj ∆zj cj 0 0 x1 2 1 1 0 2 x2 3 1 2 0 [3] x3 1 1 2 0 1 s1 0 1 0 0 0 s2 0 0 1 0 0 d r 2 3 z= 0 2 [1.5] Table B.5: [3] max in final row hence bring in x2 ; [1.5] smallest in final col thus take out s2 . [4 marks ] (iii) Basic s1 x2 zj ∆zj cj 0 3 x1 2 1/2 1/2 3/2 [1/2] x2 3 0 1 3 0 x3 1 0 1 3 −2 s1 0 1 0 0 0 s2 0 −1/2 1/2 3/2 −3/2 d r 1/2 3/2 z= 9/2 [1] 3 [1/2] max in final row hence bring in x1 ; [1] smallest in final col thus take out s1 . APPENDIX B. PAST EXAM - MAY 2008 48 [3 marks ] Basic x1 x2 zj ∆zj cj 2 3 x1 2 1 0 2 0 x2 3 0 1 3 0 x3 1 0 1 3 −2 s1 0 2 −1 1 −1 s2 0 −1 1 1 −1 d r 1 1 z= 5 Final row ≤ 0 thus optimal. The optimal solution is x1 = 1, x2 = 1, x3 = 0 and zmax = 5. [3 marks ] µ ¶ 2 −1 (iv) From the final tableau the transformation matrix M = −1 1 Thus if δ is the change in the first component of b corresponding to a change in the righthand side of constraint (1): µ 1 1 ¶ µ + 2 −1 −1 1 ¶µ δ 0 ¶ ≥0 ⇒ 1 + 2δ ≥ 0, 1 − δ ≥ 0 ⇒ 1 − ≤δ≤1 2 Thus the range of feasibility for the righthand side of constraint (1) is [3/2, 3]. [5 marks ] 4. (a) Let the vertices represent the year a new car is purchased and let the edges show the replacement cost determined by the new car data at its associated vertices. [2 marks ] [09, 13500] [08, 4500] [10, 12000] 9000 09 12 6000 5500 08 6500 5000 4625 4500 9500 10 13 [08, 5500] [10, 15000] 4875 4750 [S, *] 7000 8500 11 [08, 8500] APPENDIX B. PAST EXAM - MAY 2008 49 [4 marks ] Dijkstra’s Method Notation: Temporary label: [previous vertex, dist back to (08)]; underline to make into a permanent label. Start at (08) with permanent label [S, *] Label all vertices adjacent to (08) with temporary labels. Make smallest, [08, 4500] on (09), permanent Label all vertices adjacent to (09) that don’t have a permanent label, with a temporary label, replacing any existing temporary labels of higher value. Make smallest temporary label, [08, 5500] on (10), permanent. Label all vertices adjacent to (10) that don’t have a permanent label, with a temporary label, replacing any existing temporary labels of higher value. Make smallest temporary label, [08, 8500] on (11), permanent. Label all vertices adjacent to (11) that don’t have a permanent label, with a temporary label, replacing any existing temporary labels of higher value. Make smallest temporary label, [10, 12000] on (12), permanent. Finally make (13) permanent. [5 marks ] The permanent label [10, 15,000] on (13) corresponds to a minimum cost of £15,000, and as indicated by the network, the shortest route 08 → 10 → 13 corresponds to a strategy of replacing after 2 years and then again after 3 years. [1 marks ] (b) A tree is a simply connected subgraph of G with no cycles. [1 mark ] A spanning tree for a connected graph G is a subgraph of G that is a tree containing all nodes of G. [1 mark ] A minimum spanning tree for G is a spanning tree for G such that the sum of the values of its edges is a minimum. [1 mark ] First connect the two centres together, since this direct link is mandatory. From the point of view of Prim’s algorithm this coupled pair is considered as a single node. [2 marks ] APPENDIX B. PAST EXAM - MAY 2008 50 B2 2 C1 C1 6 6 C2 C2 2 C1 1 1 B2 1 B2 6 6 C2 B2 C2 2 2 B2 C1 B2 2 C1 B3 B2 C1 1 6 B2 2 1 B5 6 C2 B2 2 B5 1 C2 2 2 B3 2 B2 B3 3 B7 C1 B8 B4 2 1 6 B2 2 3 B5 B8 1 C2 2 B3 [ 5 marks ] B8 The minimum cost is £22,000 [2 marks ] (if they do not connect C1 and C2 initially they get £20,000 - allow follow through) Prim’s does not give a unique tree since at each stage the vertex added may not be unique, however the value of the final spanning tree is unique. If the values of each edge is different then the minimal spanning tree is unique. [1 mark ] 5. R1 4 S 8 6 R3 R2 cut = 15 .. .. .. .. . 4 ... .. .. .. P2 .. .. .. .. ..................... .. 3 .. 4 .. .. .. ... 5 0 P1 .... .. 8 .. .. 6 5 T1 11 4 T 6 P100 6 T2 10 Figure B.3: (i) Introduce a source S with outgoing edges to R1 , R2 and R3 with capacities equal to the total output capacity of respectively each of the vertices R1 , R2 and R3 ...see figure APPENDIX B. PAST EXAM - MAY 2008 51 Similarly introduce a sink T with incoming edges from T1 and T2 with capacities equal to the total input capacity of respectively each of the vertices T1 and T2 ...see figure Replace P1 with two vertices, P10 and P100 , and an edge between with capacity 8..see figure The flow f is given by either X fS,i or i out of S X fi,T i into T [5 marks ] (ii) A path S → T , from source S to sink T , consisting of unsaturated forward flows and non-zero reverse flows is called a flow augmenting path for the network. [2 marks ] (iii) Any example that shows a flow from S to T that obeys the conservation law at vertices, doesn’t exceed the capacity of any edge and states the value of the flow. They may use the notation [flow, capacity] to label the edges to indicate the actual flow along an edge and the capacity of the edge. [2 marks ] (iv) To implement the Ford-Fulkerson algorithm introduce: on on edge the notation [flow, capacity], where the flow is the actual flow along the edge and capacity is the capacity of the edge; at a vertex the label (previous vertex, spare capacity), where spare capacity is the spare capacity along the path from S to the vertex supporting the label and previous vertex is the penultimate vertex on the path from S to the labeled vertex. The first diagram shows the initial application of the F-F algorithm to form and update a flow augmenting path. It shows the creation of the initial vertex label (S, ∞). This label becomes a checked vertex by adding labels to all adjacent unlabeled accessible vertices. An unchecked vertex label is chosen, (R1 ), and turned into a checked node. The process is repeated by choosing (P2 ) and then (T1 ). The process terminates at T and the network is updated using the [flow, capacity] notation. All vertex labels are removed and the process started again from S. [6 marks ] The process continues until the fourth diagram, afterwhich there are no flow aumenting paths, the algorithm cannot reach T . [1 mark ] The maximum flow in the final diagram is 15 [1 mark ] APPENDIX B. PAST EXAM - MAY 2008 52 (S, 4) (R1 , 4) 4 R1 [4,4] [4,4] 4 (P2 , 4) 5 P2 [4,5] (S, 8) S 8 (S, ∞) R1 [4,4] (S, 8) S (S, ∞) R2 8 [3,8] 3 [6,6] T1 [4,5] 4 P10 [6,8] P100 6 [6,6] (R3 , 6) [6,8] 8 P100 6 [6,6] (P10 , 6) 6 (S, 2) S [6,10] [9,10] (P2 , 3) [3,8] [5,8] P2 (P100 , 6) [3,4] 4 [2,5] 5 P10 (R2 , 2) [6,6] T1 [4,5] [3,3] R2 [6,6] R3 10[6,10] T2 (P100 , 2) [4,4] (T2 , 3) (S, ∞) T2 P10 [8,8] [6,8] P100 [2,6] 6 [6,6] [4,11] [6,11] T2 (P10 , 2) The refineries R1 , R2 and R3 should produce respectively 4000, 5000 and 6000 barrels per day. The terminals T1 and T2 will respectively need to be able to store or deal with 6000 and 9000 barrels per day. [2 marks ] (v) The maximum flow= minimum cut (T2 , 6) T R1 T 6 [6,6] [4,11] 4 5 [4,4] [4,11] [3,4] T1 [4,5] 4 3 (S, 6) R3 (P2 , 1) 4 8 6 [6,6] P2 (R2 , 5) [6,6] (P2 , 4) R2 (S, ∞) 6 P2 (S, 8) S 10 T2 (R2 , 3) [3,3] 5 R3 8 (P2 , 4) 6 [4,4] T P100 [4,4] (T1 , 4) 6 P10 (S, 6) R3 [4,11] 4 5 6 11 4 3 R2 (P100 , 6) R1 [4,4] T1 [1 mark ] The cut in Figure B.3 has the value 15 which is the same as the flow found by the F-F method. Thus 15 is indeed the max flow. Note that in the cut the flow from P2 → P10 is not in the direction from S to T and thus is not included in the value of the cut.[5 marks ] (T1 , 2) T [9,10] APPENDIX B. PAST EXAM - MAY 2008 6. 53 (i) (a) Let the first stage, i = 1, be the decision of how many drainage type jobs to undertake. Let the second stage, i = 2, be the decision of how many building type jobs to undertake. Let the third stage, i = 3, be the decision of how many plumbing type jobs to undertake. Let the fourth stage, i = 4, be the decision of how many joinery type jobs to undertake. [2 marks ] (b) Let xi be the number of remaining days available when selecting type i jobs.[1 mark ] (c) Let di be the number of type i jobs allocated at stage i. [1 mark ] (d) Let fi (xi ) = the maximum return from stage i to the end of stage 4, for given input xi . Thus fi (xi ) = max{fi+1 (xi+1 ) + di × profit on job type i } f5 (x5 ) = 0 where xi+1 = xi − di × time for job i [3 marks ] (ii) Label each vertex as (xi ), indicating the number of available days at the start of each stage. At the end of stage 4 the vertices show the number of days not used. Label each edge with di , the number of jobs of type i allocated. Use the vertex labeling [fi (xi ), xi+1 ] [3 marks ] [10,0] 2 0 [10,2] 2 0 0 0 [5,0] [15,0] 0 2 0 [50,10] 1 [0,0] 2 4 5 5 0 10 [50,2] 5 [25,0] 1 3 0 [20,0] 4 2 1 0 [25,1] 6 [25,3] 8 [25,5] 10 stage 1 .. .. .. .. .. .. . stage 2 .. .. .. .. .. . 0 3 3 [25,1] 10 1 1 1 10 0 1 2 [10,2] [60,2] 2 [0,0] stage 3 .. .. .. .. .. . 5 5 5 stage 4 - 1 3 5 .. .. .. .. .. . APPENDIX B. PAST EXAM - MAY 2008 54 [8 marks ] Show working to demonstrate how the maximum is selected at each vertex. For example f3 (2) = max{f4 (2) + 0 × 10 = 10; f4 (0) + 1 × 10 = 10} = 10 Note the choice of the label [10,2] on vertex (2) at stage 3 is not unique, it could have been [10,0], giving the same profit but a different strategy. [5 marks ] The maximum path in the figure is given by 1 10 - 2 0 - 2 0 - 2 2 - 0 representing that the company undertake 1 drainage job and 2 joinery jobs at a profit of £60,000.(other strategies giving the same profit are possible) [2 marks ] Appendix C Past Exam - May 2007 C.1 Question Paper Full marks for correct solutions to any FOUR or the SIX questions - 2 14 hours Question 1 A company sells two types of multivitamin tablets, each type containing a combination of vitamins A and C. The Regular tablets contain 0.1 milligrams of vitamin A and 0.2 milligrams of vitamin C, whereas the Extra tablets contain 0.3 milligrams of vitamin A and 0.2 milligrams of vitamin C. The average cost of the tablets to the customer is 0.5p for a Regular tablet and 1.2p for an Extra tablet. In a given week the minimum recommended amounts of each vitamin is 1.7 milligrams of vitamin A and 1.8 milligrams of vitamin C. (i) Set up a Linear Programming problem to calculate the amounts of each tablet the customer should consume per week to minimize the cost whilst at the same time consuming at least the recommended dose of each vitamin. [5 marks ] (ii) Use graphical means to solve the Linear Programming problem, stating how many types of each tablet the customer should consume per week and the total cost of the tablets. [5 marks ] (iii) State the Dual problem of the above and discuss how this corresponds to a rival company wishing to set the price of marketing single vitamin tablets that contain 1 milligram of either vitamin A or vitamin C. [5 marks ] (iv) By expressing both the primal and dual problem in matrix and vector form, show that the cost of a week’s supply of multivitamins is never less than the revenue collected by the rival company selling a week’s supply of the single vitamin tablets. [5 marks ] (v) Solve the dual problem graphically and use the results to decide if the consumer would financially benefit more by a small decrease in the recommended weekly dose of vitamin A or vitamin C. [5 marks ] [25 marks in total ] 55 APPENDIX C. PAST EXAM - MAY 2007 56 Question 2 (a) (i) If A is an m × n, m ≤ n, matrix with m independent rows, define what is meant by a basic solution of Ax = b. [2 marks ] (ii) Given µ 1 0 2 0 1 1 ¶ µ ¶ x1 x2 = 1 1 x3 write down a basic solution. Calculate two other basic solutions. [3 marks ] (iii) What is the maximum possible number of basic solutions for the general problem described in (i) above? Comment on the relevance of this result in the Simplex Method. [2 marks ] (b) Consider the following problem: Maximize z = 2x1 + x2 + 2x3 subject to the constraints: x1 + x2 + x3 = 1, 4x1 + 2x2 + x3 ≤ 3, x1 + x2 + 2x3 ≤ 2 x1 , x2 , x3 ≥ 0. (i) Introduce an artificial variable a1 , two slack variables s1 and s2 and a large constant M to write the problem in the matrix form: Maximize z = cT x, subject to Ax = b, x ≥ 0. State clearly the values of c, x, b and A. [2 marks ] (ii) Write down the first Simplex Tableau. [4 marks ] (iii) Find the optimal solution to the problem using the Simplex Method. [7 marks ] (iv) From your final tableau find the range of optimality for the coefficient of x1 in the objective function. [5 marks ] [25 marks in total ] Question 3 (a) For a graph G define the terms: Tree Spanning Tree Minimal Spanning Tree A TV cable company wishes to connect seven housing estates, 1 . . . 7, with lines running either directly from the Company’s centre C or indirectly via the relay/boosting equipment that is installed on each estate. The graph in Fig.F.1 indicates the estimated costs of making various connections. (not all logical connections are practical). By constructing a minimal spanning tree for the network using Prim’s algorithm, determine how the APPENDIX C. PAST EXAM - MAY 2007 57 connections should be made in order to minimize the total cost. State this cost. It turns out that it is not possible to make any direct connections between estate 1 and estate 2 or between estate 3 and estate 4. Rework the problem using Kruskal’s algorithm to determine a new strategy and new cost. 2 6 3 7 2 2 4 3 2 C 2 1 3 4 2 2 1 5 1 1 4 2 4 3 Figure C.1: The graph shows the cost in tens of thousands of pounds to establish the indicated links [11 marks ] (b) The graph in Fig.F.2 indicates the probability of the trains being on time when travelling in either direction between the given nodes that represent the five cities London, Birmingham, Peterborough, Nottingham and Leeds. By first transforming the network using logarithms, demonstrate the use of Dijkstra’s algorithm to calculate the most punctual routes from London to each of the other cities. Give the probability in each case of having a journey without delay. [14 marks ] 0.8 B 0.85 L 0.75 0.75 0.95 N 0.9 0.8 P Lds 0.9 Figure C.2: The graph shows the probability of the trains being on time when travelling between the five cities represented by the five nodes [25 marks in total ] APPENDIX C. PAST EXAM - MAY 2007 58 Question 4 (a) For a flow problem define the term basic network. For a basic network: (i) Write down the conditions that must be satisfied by the flow fi,j from node(i) to node(j). (ii) With explanation, give an expression for the flow in the network. [6 marks ] (b) State the Max-Flow Min-Cut theorem and hence for the network in Fig.D.7 construct by trial a cut and a flow to establish the maximum flow in the network. [7 marks ] 1 B 3 > 2 3 A 6 - E ? 2 ~ C 2 = 4 R D 3 RG > 2 1 5 ~ ? - F 7 Figure C.3: The numbers indicate the capacities of each arc. The arrows indicate the direction of flow in each arc. (c) The graph in Fig. D.8 represents a one-way road network taking traffic from point S to point T in the directions indicated by the arrows and passing through the four roundabouts R1 , R2 , R3 and R4 . The average maximum capacity of each road is shown on the diagram in terms of vehicles per minute and with the exception of R4 the roundabouts can deal with all possible flows of traffic. Although the roundabout R4 is scheduled to be updated, at present it can only deal with 20 vehicles per minute. 50 R1 60 > - R2 > 30 ~ S 3 40 50 ~R 3 100 30 ~ - R4 T 50 Figure C.4: Arrows indicate the direction of traffic flow; numbers indicate the maximum flow in vehicles/min for each road. (i) Redraw the network so that it consist entirely of unrestricted nodes. APPENDIX C. PAST EXAM - MAY 2007 59 (ii) Demonstrate the application of the Ford-Fulkerson algorithm to the amended graph to establish the maximum flow. Hence determine the maximum flow and the associated flows on each road. [12 marks ] [25 marks in total ] Question 5 A company has an equipments policy that stipulates that no office computers should be more than five years old. The value to the company of an individual machine is dependent on its age; the older machines requiring more hardware and software maintenance and hence slowly becoming less efficient. The company sets up a temporary office several miles from its base with the intention of closing it down after three years, at which time all the office equipment will be sold off. The computers in this office are initially all three years old and you are asked, using dynamical programming techniques, to formulate an optimal replacement policy over the next three years. Although you should assume that all the computers are replaced at the same time it may not be the best solution to wait until the computers are five years old before making the replacement. The following table indicates the annual dependency of the revenue, maintenance cost and resale value in pounds sterling of a computer with respect to time. Additionally the cost of a new computer is £3000. Age in years t 0 1 2 3 4 5 Revenue r(t) 2500 2300 2200 1900 1500 − Maintenance cost c(t) 25 40 80 120 180 − Resale value s(t) − 2000 1500 1250 1000 600 Table C.1: The annual revenue and operating cost relate to a computer which is t years old at the start of the year. The resale value relates to a computer of t years old. (i) In the context of a dynamical programming approach using backward recursion, identify the following: (a) The four decision stages, i = 1 . . . 4. (b) The state variable xi at each stage. (c) The decisions at each stage. (d) An optimization functional fi (xi ) and a defining recursion relation. [7 marks ] APPENDIX C. PAST EXAM - MAY 2007 60 (ii) Draw a suitable network to illustrate the above problem, indicating clearly the four stages. Hence use your network, by making suitable annotations at each node, to obtain the optimal strategy and return for the problem. (Show all your working.) [18 marks ] [25 marks in total ] Question 6 Polycrock is a company making various items of crockery and cutlery out of plastic and polystyrene. Next week the polystyrene cup department is to make exactly 125,000 small sized cups, 80,000 medium sized cups and 100,000 large sized cups. The cup department has three machines, M1, M2 and M3, on which to produce the cups. Each machine is capable of producing any size of cup but can only produce one cup size at any one time. The amount of waste produced in making each cup varies from cup size to cup size and machine to machine. Table C.2 gives the amount of waste measured in milligrams per cup for all possible modes of production. The time for Machine M1 M2 M3 Small cup 25 25 30 Medium cup 10 30 35 Large cup 30 10 30 Table C.2: The amount of waste per cup measured in milligrams each type of machine to produce each type of cup also varies with respect to machine and cup. Table C.3 gives the number of items produced on each machine per minute. The availability Machine M1 M2 M3 Small cup 40 50 60 Medium cup 30 30 50 Large cup 25 20 40 Table C.3: Production rates measured in items per minute of machine time during the week is 40 hours for machine M1, 40 hours for machine M2 and 45 hours for machine M3. Polycrock wish to know how to schedule the work across the three machines during the coming week in order to minimize the amount of waste. For the coming week denote the number of small cups produced on machine Mi by xS,i , the number of medium cups produced on machine Mi by xM,i and the number of large cups produced on machine Mi by xL,i where in each case i = 1, 2, 3. APPENDIX C. PAST EXAM - MAY 2007 61 (a) Formulate the linear programming problem in terms of these nine variables to determine the optimal production strategy for the coming week. Show clearly the derivation of the constraints and the objective function. [9 marks ] (b) The data in Table C.4 is the computer output from solving the problem. Use this data to answer the following questions: (i) What is the optimal strategy and how much waste, expressed in kilograms, is produced? [4 marks ] (ii) State which constraints are binding and which are not. [2 marks ] (iii) Three of the shadow prices are positive and three are negative, explain in terms of the problem why this should be so. [2 marks ] (iv) If it is possible to increase the available time on just one machine by 30 minutes, which machine should this be? Hence calculate the improvement in the objective function in this case. [2 marks ] (v) If it is required to produce 1000 more small cups how much more waste is produced? [2 marks ] (vi) Calculate the feasible range for the number of small cups produced. [2 marks ] (vii) From the table no small cups are produced on M3. By making the production of small cups on M3 less wasteful is it possible, within the optimum strategy, to start making small cups on M3? Comment similarly on the production of medium and large cups on M2. [2 marks ] APPENDIX C. PAST EXAM - MAY 2007 62 Variables Name Final Value Reduced Cost Objective Allowable Allowable Coefficient Increase Decrease xS,1 5000 0 25 36.25 105.75 xS,2 120000 0 25 105.75 1E+30 xS,3 0 36.25 30 1E+30 36.25 xM,1 26250 0 10 23.81 1E+30 xM,2 0 176.25 30 1E+30 176.25 xM,3 53750 0 35 1E+30 23.81 xL,1 35000 0 30 1E+30 21.75 xL,2 xL,3 0 401.87 10 1E+30 401.87 65000 0 30 21.75 1E+30 Name Final Value Shadow Price Constraint R.H. Side Small 125000 493.75 125000 1400.00 2333.33 Med 80000 635.00 80000 1093.75 1750.00 Large 100000 780.00 100000 875.00 1400.00 M1 2400 -18750.00 2400 58.33 35.00 M2 M3 2400 2700 -23437.50 -30000.00 2400 2700 46.67 35.00 28.00 21.88 Constraints Allowable Allowable Increase Decrease Objective function Waste Value z 8268750 Table C.4: Output from computer solution of Q6. The constraints Small, Med and Large relate to the requirements that a fixed number of different types of cup are to be produced. The constraints M1, M2 and M3 relate to the availability of the different types of machine. [25 marks in total ] APPENDIX C. PAST EXAM - MAY 2007 C.2 63 Solutions Solutions May 2007 1. (i) Let y1 denote the number of Regular tablets per week and y2 the number of Extra tablets per week. Therefore the amount of Vit A/week = 0.1y1 + 0.3y2 and the amount of Vit C/week = 0.2y1 + 0.2y2 . Thus to meet the recommended amounts: µ ¶ µ ¶µ ¶ 0.1 0.3 y1 1.7 0.1y1 + 0.3y2 ≥ 1.7 0.2y1 + 0.2y2 ≥ 1.8 ⇒ ≥ =c 0.2 0.2 y2 1.8 The total cost of the tablets is given by z = 0.5y1 + 1.2y2 = bT y (a) [5 marks ] (b) y2 x2 0.3x1 + 0.2x2 = 1.2 (5, 4) 0.1y1 + 0.3y2 = 1.7 ( 72 , 34 ) 0.1x1 + 0.2x2 = 0.5 y1 0.2y1 + 0.2y2 = 1.8 z = 6 = 0.5y1 + 1.2y2 x1 z = 4 = 1.7x1 + 1.8x2 Figure C.5: (a): primal minimization problem [3 marks ] (b): Dual maximization problem [3 marks ] (ii) From Fig.C.5(a) the objective function is minimum at (5, 4). Thus we should buy 5 Reg tablets and 4 Extra tablets at a cost of 7.3p/wk. [2 marks ] (iii) The dual problem is maximize z = cT x = 1.7x1 + 1.8x2 subject to : µ ¶ µ ¶ 0.5 0.1 0.2 =b x≤ 1.2 0.3 0.2 [2 marks ] In terms of the problem let x1 denote the price in pence per mg of vitamin A and x2 the price in pence per mg of vitamin C. The manufacturer will try and maximize the cost of the recommended weekly supply of vitamins, namely z = 1.7x1 + 1.8x2 APPENDIX C. PAST EXAM - MAY 2007 64 Supplied separately the cost of the vitamins in the Regular tablet is given by 0.1x1 + 0.2x2 which to be competitive with the Regular tablet must cost no more than a Regular tablet. Thus 0.1x1 + 0.2x2 ≤ 0.5 Similarly arguing for the Extra tablet 0.3x1 + 0.2x2 ≤ 1.2 [3 marks ] (iv) It is required to prove that cT x ≤ bT y, given x ≥ 0, y ≥ 0, c ≤ AT y and Ax ≤ b. c ≤ AT y ⇒ cT ≤ y T A which, since x ≥ 0 ⇒ cT x ≤ y T Ax ≤ y T b = bT y [5 marks ] (v) From FigC.5(b) the maximum is at ( 27 , 34 ). Since the dual variable x1 is the greater it is more advantageous for the consumer if the recommended amount of vitamin A is reduced. [2 marks ] 2. (a) (i) A basic solution is obtained by selecting m independent columns of A, setting all other non-associated variables equal to zero and solving the m equations in m unknowns. [2 marks ] (ii) By inspection col(1) and col(2) independent thus x1 = x2 = 1 and x3 = 0 basic solution. Select the final two columns, set x1 = 0 solve to get x2 = x3 = 1/2 Select the first and last columns, set x2 = 0 solve to get x1 = −1, x3 = 1 [3 marks ] (iii) At most n Cm basic solutions. In the simplex method the optimal value occurs at a feasible basic solution thus there are only a finite number of steps to reach the solution. [2 marks ] (b) (i) In matrix form: z = (2, 1, 2, −M, 0, 0) x1 x2 x3 a1 s1 s2 1 1 1 1 0 0 1 = cT x Ax = 4 2 1 0 1 0 x = 3 = b 1 1 2 0 0 1 2 [2 marks ] APPENDIX C. PAST EXAM - MAY 2007 65 (ii) Basic a1 s1 s2 zj ∆zj cj −M 0 0 x1 2 1 4 1 −M [2 + M ] x2 1 1 2 1 −M 1+M x3 2 1 1 2 −M 2+M a1 −M 1 0 0 −M 0 s1 0 0 1 0 0 0 s2 0 0 0 1 0 0 d r 1 3 2 z= −M 1 [3/4] 2 Table C.5: 2 + M max in final row hence bring in x1 (or x3 ); 3/4 smallest in final col thus take out s1 . [4 marks ] (iii) Basic a1 x1 s2 cj −M 2 0 x1 2 0 1 0 x2 1 1/2 1/2 1/2 zj 2 1− ∆zj 0 M 2 M 2 x3 2 3/4 1/4 7/4 − 3M 4 + [ 32 + 1 2 3M 4 ] a1 −M 1 0 0 s1 0 −1/4 1/4 −1/4 s2 0 0 0 1 d r 1/4 3/4 5/4 [1/3] 3 5/7 −M M 4 0 z= 0 −M 4 + 0 + 1 2 −M 4 − 1 2 3 2 [ 32 + 3M 4 ] max in final row hence bring in x3 ; [1/3] smallest in final col thus take out s1 . [3 marks ] x1 x2 Basic cj 2 1 x3 2 0 2/3 x1 2 1 1/3 s2 0 0 −2/3 zj 2 2 ∆zj 0 −1 Final row ≤ 0 thus optimal. x3 2 1 0 0 2 0 a1 −M 4/3 −1/3 −7/3 2 −M − 2 s1 0 −1/3 1/3 1/3 0 0 The optimal solution is x1 = 2/3, x3 = 1/3, x2 = 0 and zmax = 2. s2 0 0 0 0 0 0 d r 1/3 2/3 2/3 z= 2 [3 marks ] [1 mark ] (iv) To obtain the range of optimality recalculate the last tableau with the x1 coefficient replaced by α, this only affects the final two rows. APPENDIX C. PAST EXAM - MAY 2007 66 x1 α 0 1 0 x2 1 2/3 1/3 −2/3 zj α 4 3 ∆zj 0 Basic x3 x1 s2 cj 2 α 0 + α 3 − 13 − α 3 x3 2 1 0 0 a1 −M 4/3 −1/3 −7/3 8 3 2 0 − 23 + α 3 − −M − s1 0 −1/3 1/3 1/3 8 3 + α 3 2 3 − To remain optimal α must be such that the final row ≤ 0. Since −M − 83 + α3 is always less than zero, require α such that: 1 α − − ≤ 0, 3 3 2 α − ≤0 3 3 ⇒ 2≤α ⇒ α 3 α 3 s2 0 0 0 0 d 1/3 2/3 2/3 0 z= 0 2 [3 marks ] range optimality [2, ∞) [2 marks ] r APPENDIX C. PAST EXAM - MAY 2007 67 3. (a) A tree is a simply connected graph with no cycles. [1 mark ] A spanning tree for a connected graph G is a subgraph of G that is a tree containing all nodes of G. [1 mark ] A minimum spanning tree for G is a spanning tree for G such that the sum of the values of its edges is a minimum. [1 mark ] Fig.C.6(a) show the minimum tree of 11. [4 marks ] Fig.C.6(b) shows that with two fewer links the minimum distance is 13. [4 marks ] (a) 3 C C 2 2 2 1 2 2 3 C 2 1 3 1 5 1 C 2 1 2 1 2 5 1 3 C 1 1 2 4 2 3 C 2 5 4 1 7 2 2 1 1 2 1 2 1 5 6 4 (b) 1 2 1 3 5 1 2 3 2 C 1 2 3 2 C 3 4 1 5 1 5 2 2 1 6 2 7 2 2 1 6 2 7 Figure C.6: (a): the diagram shows the addition of one node at a time using Primm’s Algorithm; in the final diagram two nodes were added (b): the three diagram shows the addition of edges value 1, 2 and 3 using Kruscal’s Algorithm. (b) Let the components of any path from L have respectively probabilities p1 , p2 . . . pk of being on time. The probability of the journey being on time is given by P = p1 × p2 . . . pk ⇒ APPENDIX C. PAST EXAM - MAY 2007 68 ln(P ) = ln(p1 ) + ln(p2 ) + . . . ln(pk ). Since ln pi ≤ 0 consider minimizing − ln P . Hence draw a graph with edge lengths − ln pi . [3 marks ] Fig.C.7 shows the application of Dijkstra’s method to find the shortest path from L to each of the other nodes. This enables us to write down the most reliable paths. London - Birmingham L → B Probability = 0.85 London - Peterborough L → P Probability = 0.95 London - Nottingham L → P → N Probability = 0.95 × 0.8 = 0.76 London - Leeds L → P → Lds Probability = 0.95 × 0.9 = 0.855 [3 marks ] [0.3390, P ] [0.2621, Lds] [0.3856, B] [0.1625, L] [0.4444, Lds] 0.2231 B 0.1625 N 0.1054 0.2877 L [0.2744, P ] [0, L] 0.2877 0.2231 0.0513 P Lds 0.1054 [0.0513, L] [0.1567, P ] Figure C.7: Nodes labelled [d, n ], where n is the previous node and d is the distance from S. Underline indicates label is permanent. [8 marks ] APPENDIX C. PAST EXAM - MAY 2007 69 4. (a) Definition Basic Network: directed graph with at most a single edge between nodes; to each edge from node(i) to node(j) associate ci,j ≥ 0.; Two special nodes S with no incoming and T with no out going arcs. [2 marks ] (i) fi,j ≥ 0; fi,j ≤ ci,j ; except for S and T flow into a node = flow out of a node. [2 marks ] (ii) The above implies that the total out of S equals the total into T . This amount is P P called the flow of the network and is equal to i fS,i or i fi,T [2 marks ] (b) Maximum flow in a network is equal to the value of a minimum cut. [1,1] B E [1,2] [1,3] [0,2] [0,4] D [0,3] A [1 mark ] [1,1] [1,2] [0,2] [6,6] C [5,5] F G [6,7] Figure C.8: Notation [flow, capacity]; value of cut = 7 [3 marks ]; value of flow = 7 [3 marks ]; thus optimal flow. (c) The node at R4 is split into two nodes R40 and R400 with a single link with capacity 20 between them. See Fig.C.9(a). [2 marks ] From Fig.C.9(d) the maximum flow is 110. In terms of the problem the flow from R4 to T is 20. [2 marks ] APPENDIX C. PAST EXAM - MAY 2007 (a) (S,60) [50, 60] R1 [60, 60] * [0, 50] [0, 30] R3 [0, 30] ~ - R40 (S,10) (R2 ,50) [50, 60] * 6 [0, 40] S [0, 50]~ (b) [50, 50] (R1 ,50) [50, 100] [0, 50] [0, 100] - R2 - T > 70 [0.20] - R00 4 [50, 50] R1 (R3 ,40) [90, 100] [50, 100] - R2 > [0, 50]~ [40, 50] R3 [0, 50] [0, 30] [0, 30] ~ - R40 - R00 4 [0.20] (S,50) (c) (d) (S,10) [60, 60] R1 [50, 60]* [50, 50] - R2 > - T (R400 ,10) 6 [40, 50] ~ [0, 50] [10, 50] [0, 30] [10, 30] R3 (S,10) [0, 30] ~ - R40 [50, 50] [90, 100] [40, 40] S - R00 4 [0.20] (R1 ,10) [10.20] [60, 60]* R1 [90, 100] - T (R400 ,10) 6 [40, 40] S [40, 50] ~ R3 [50, 50] (R40 ,10) - R2 > [10, 50] [20, 50] [10, 30] ~ - R40 - R00 4 [10.20] [0, 30] (S,10) [10, 30] (R3 ,10) [20.20] Figure C.9: Notation: [flow,capacity]; (previous node, max possible increase) 5. 6 [0, 40] [40, 40] S (S,50) - T (R2 ,40) (i) (a) Let i be the start of the ith year (R40 ,10) [8 marks ] [1 mark ] (b) xi is the age of the machine at the start of ith year. [1 mark ] (c) Decisions are to Keep or Replace. [1 mark ] (d) Let fi (xi ) be the total revenue from stage i in state xi to the final salvage, i = 1 . . . 4. ½ ¾ r(xi ) − c(xi ) + fi+1 (xi + 1) Keep fi (xi ) = Max i = 1, 2, 3 f4 (x4 ) = s(x4 ), r(0) − c(0) + s(xi ) − 3000 + fi+1 (1) Replace [4 marks ] (ii) Stage 3 5 − R − 1 2500 − 25 + 600 − 3000 + 2000 = [2075] 2 − R − 1 2500 − 25 + 1500 − 3000 + 2000 = 2975 2 − K − 3 2200 − 80 + 1250 = [3370] 1 − K − 2 2300 − 40 + 1500 = [3760] 1 − R − 1 2500 − 25 + 2000 − 3000 + 2000 = 3475 Stage 2 [4 marks ] APPENDIX C. PAST EXAM - MAY 2007 71 1 − R − 1 2500 − 25 + 2000 − 3000 + 3760 = 5235 1 − K − 2 2300 − 40 + 3370 = [5630] [3 marks ] 4 − R − 1 2500 − 25 + 1000 − 3000 + 3760 = [4235] 4 − K − 5 1500 − 180 + 2075 = 3395 Stage 1 3 − R − 1 2500 − 25 + 1250 − 3000 + 5630 = [6355] [2 marks ] 3 − K − 4 1900 − 120 + 4235 = 6015 In the above the optimal option (max value) is indicated using [] for each decision. These values are then placed on the relevant node in Fig.C.10. [5630,2] R 3 1 R K 3 [6355,1] x1 K [4235,1] R 4 K x2 - 1 3 K q K R [1250,T] 2 - 5 [2075,1] (stage 2) - 2 R [3370,3] j (stage 1) [1500,T] [3760,2] x3 s T * - 3 R ~ q 1 (stage 3) Figure C.10: Notation: [fi (xi ),next node] [2000,T] x4 (stage 4) [8 marks ] The return is £6355 per machine with the strategy of Replace, Keep, Keep, Salvage. [1 mark ] 6. (a) Small cups = 125000 = xs,1 + xs,2 + xs,3 (i) Medium cups = 80000 = xm,1 + xm,2 + xm,3 Small cups = 100000 = xL,1 + xL,2 + xL,3 (ii) (iii) Available time: M1: 2400 ≥ M2: 2400 ≥ M3: 2700 ≥ 1 40 xs,1 1 50 xs,2 1 60 xs,3 + + + 1 30 xm,1 1 30 xm,2 1 50 xm,3 + + + 1 25 xL,1 1 20 xL,2 1 40 xL,3 (iv) (v) (vi) The constraints are given by (i) − (vi) plus the non-negative condition on all variables. [7 marks ] The amount of waste is given by: z = 25xs,1 + 25xs,2 + 30xs,3 + 10xm,1 + 30xm,2 + 35xm,3 + 30xL,1 + 10xL,2 + 30xL,3 The problem is to minimize this subject to the given constraints. (b) (i) Final values of variables give optimal strategy: Small cups: 5000 on M1; 120000 on M2; 0 on M3 [2 marks ] APPENDIX C. PAST EXAM - MAY 2007 72 Medium cups: 26250 on M1; 0 on M2; 53750 on M3 Large cups: 350000 on M1; 0 on M2; 65000 on M3 Waste = 8.269 kg [4 marks ] (ii) All constraints are binding since RH side=Final Value. [2 marks ] (iii) If more time is available on a given machine then reschedule to reduce waste - no point in changing otherwise - thus expect shadow prices to be negative for the time constraints. If we increase the number of cups then we are bound to produce more waste, thus the shadow price for the number of cups expected to be positive. [2 marks ] (iv) Most negative shadow price for available time is -3000 for M3 thus waste reduced by: 30 × 3000 = 900g. [2 marks ] (v) 1000 more small cups increases z by 1000 × 493.75 = 493.75g. [2 marks ] (vi) Feasible range for number of small cups: = [125000 − 2333.33, 125000 + 1400] = [122667, 126400]. [2 marks ] (vii) Waste in producing a small cup on M3 is 30mg. Since the reduced cost for this item is 36.25 it is not possible to reduce the amount of waste by this amount. Similarly the reduced costs of the other two processes are greater than the actual amounts of waste already being produced. [2 marks ] Appendix D Past Exam - May 2006 D.1 Question Paper Full marks for correct solutions to any FOUR or the SIX questions - 2 14 hours Question 1 (a) A university wishes to install a computer network on its campus, connecting several buildings to the main server in the computer centre. Links do not necessarily have to be direct, a building is able to tap into a nearby building. The following network gives the distance of the routes between the buildings along which it is possible to make links. As the required 2 1 1 3 6 3 2 2 C 1 2 5 5 4 2 3 4 1 Figure D.1: Computer centre C; Departments numbered 1 . . . 6; distances given in km. underground cabling will be expensive the university wishes to minimize the total amount of trenching needed. (i) Explain why a minimum spanning tree will give the solution to the problem. (ii) Using Prim’s or Kruskal algorithm construct such a tree and report your findings. (b) A company wishes to deliver orders to its clients across town. The delivery of each order will consist of a single journey to the client with no other client being serviced during the trip. There are several routes available to the company, however on each leg of the route there is a possibility of delay. The company decides that the routes that maximize the 73 APPENDIX D. PAST EXAM - MAY 2006 74 chance of no delay are the ones that should be selected, even if not the shortest. The following network shows the various routes from the supplier to the clients with each arc being labelled with the probability of not being delayed. 0.4 1 3 0.5 0.4 0.7 S 0.2 0.3 0.5 2 0.2 4 Figure D.2: Supplier S; Clients numbered 1 . . . 4; Probabilities of no delays given. (i) Using logarithms construct a suitable network such that the company’s problem can be solved by using a minimum path algorithm. Explain you reasoning. (ii) Apply Dijkstra’s algorithm to your network to find the minimum paths from S to the other nodes. Write down the optimal paths and their probabilities. (25 marks in total) Question 2 The following network represents the pumping of oil from two sources, S1 and S2 , to a single terminal T, via intermediate pumping stations P1 , P2 , P3 and P4 . The direction of flow through the network and the capacities of each link are given in the diagram. 2 S1 3 2 S2 4 - P1 > ~ - P2 4 - P3 > 3 3 5 6 j - P 4 T 4 Figure D.3: Sources S1 and S2 , sink T ; Direction of flow and capacities indicated on arcs. (i) Show how the network can be converted into a standard network with a single source and single sink. Draw the new network. (ii) Construct an example of a non-zero flow in your standard network in (i). (iii) Starting with zero flow in the standard network use the Ford-Fulkerson algorithm to find the maximal flow. APPENDIX D. PAST EXAM - MAY 2006 75 State the Max-Flow Min-Cut theorem and hence by inspection obtain a cut that establishes that the maximum flow given by (iii) satisfies the theorem. (25 marks in total) Question 3 The following network represents the available times of flights between centres when travelling from London to Sydney, additional time has been included in the numbers to take account of the average amount of time spent changing at each centre. 12 2 1 1 > 3 - 11 5 3 3 13 12 j - 7 R 4 8 4 14 6 >7 9 j - 4 15 2 - s - 9 3 5 R z 10 10 13 Figure D.4: Node(1) - London, Node(10) - Sydney; Times of flights include an amount for changes. (i) State Bellman’s Principle of Optimality. Interpret this principle in terms of a network problem such as the one above. (ii) Split the above problem into stages suitable for analysis using Dynamical Programming. Identify the input state variables xi associated with each stage i. For each stage list the set of possible decisions. (iii) For each of the following define in words a functional fi (xi ) suitable for use in the Dynamical Programming approach to the problem. (a) To compute the route of shortest time (b) To compute the route of longest time (iv) Denoting the time of the direct link from the kth node to the jth node by dk,j , write down the recurrence relations defining fi (xi ) for each of (a) and (b) in (iii) above. (v) Using the Dynamical Programming approach find the shortest and longest routes from London to Sydney along with their times. (25 marks in total) APPENDIX D. PAST EXAM - MAY 2006 76 Question 4 A surveyor visits two types of property, commercial and domestic. Commercial properties take longer to inspect due to their size and the increased number of health and safety regulations. On average a domestic property takes 10 minutes and a commercial property 40 minutes. In a given working day the surveyor is not prepared to spend more than five hours per day on inspections and one hour per day in the evenings carrying out the paper work generated by the day’s activities. On average the time to process the paperwork for a domestic property is 3 minutes and for a commercial property 7 minutes. Although the surveyor is paid a salary there is a bonus scheme which pays an extra £3 for each domestic property inspected and £10 for each commercial property inspected. Given that there are always properties of each type to inspect and based only on the times to carry out the inspections and the times to process the paperwork set up the Linear Programming problem to calculate how the surveyor should proceed in order to maximize the bonus. Use graphical means to solve the Linear Programming problem, stating how many types of each property the surveyor should inspect per day and the value of the bonus generated. Write down the dual problem for the above and hence interpret from the point of view of the surveyor’s employer. Solve the dual problem using graphical means. Use your solution to the dual problem to decide whether or not the surveyor would be better off, from the point of view of increasing the bonus, by increasing the number of hours per day inspecting or by increasing the number of hours per evening doing paperwork. (25 marks in total) Question 5 Consider the following problem: Maximize z = 2x1 + x2 + x3 subject to the constraints: x1 + x2 ≥ 1, x1 + x2 + 2x3 ≤ 4, x1 , x2 , x3 ≥ 0. (i) Introduce a surplus variable s1 , an artificial variable a1 , a slack variable s2 , and a large constant M to write the problem in the augmented matrix form: Maximize z = cT x, subject to Ax = b, x ≥ 0. State clearly the values of c, x, b and A. (ii) Why does the Simplex Method require the extra artificial variable? (iii) Write down the first Simplex Tableau. (iv) Find the optimal solution to the problem using the Simplex Method. APPENDIX D. PAST EXAM - MAY 2006 77 (v) From your final tableau: (a) Write down the values of the dual variables. (b) Obtain the feasible range for each component of b. (c) Find the range of optimality for the coefficient of x1 in the objective function. (25 marks in total) APPENDIX D. PAST EXAM - MAY 2006 78 Question 6 An investment advisor has the following model for investing a client’s funds. The portfolio will contain shares, unit trusts and cash, with the risk indices and assumed (estimated) annual return rates given by the following table. The risk index for the portfolio is given by forming the sum Investment Shares Unit Trusts Cash Annual % Return Rate 12 4 3 Risk Index 0.8 0.3 0 Table D.1: Assumed annual returns; Risk indices of the products of the proportion of each type of investment in the portfolio with its risk index. Thus a portfolio containing 50% shares, 20% unit trusts and 30% cash would have a risk index of 0.5(0.8)+0.2(0.3)+0.3(0.0)=0.46. The advisor’s rules for the investment portfolio are: Rule 1: The portfolio may contain no more than 50% shares. Rule 2: The amount of investment in unit trusts must be at least half that invested in shares. Rule 3: The amount of cash must be at least 10% of the total fund. Rule 4: The amount of cash must be no more than 25% of the total fund. Let x1 be the proportion of shares, x2 the proportion of unit trusts and x3 the proportion of cash in the portfolio. If the advisor decides to construct a portfolio with risk index of 0.4 write down four constraining inequalities corresponding to the four rules, one constraint corresponding to the given risk index and one final constraint corresponding to the fact that the sum of proportion of the products in the portfolio must be one. Express all the constraints with constant non-negative righthand side. The objective of the advisor is to maximize the total annual rate of return subject to the constraints, hence write down the objective function for the problem. The computer output from the linear programming software is given in Table D.2. Using this output answer the following: (i) What is the optimal portfolio and its annual return? (ii) Calculate the feasible range for the righthand side of the constraint for rule 4. (iii) Is it more beneficial for the advisor to increase the risk by 0.05 or to raise the proportion of cash invested by ten percentage points? In each case state clearly what the annual return would be. (iv) Explain what is meant by reduced cost and say why in this case they are all zero. (v) Write down the ranges of optimality for the three objective function coefficients. APPENDIX D. PAST EXAM - MAY 2006 79 (vi) If the annual rate of return on the unit trusts is taken to be 7% calculate the new optimum annual return on the portfolio. Why is it not possible to carry out this calculation without re-running the software if the rate of return is increased to 8%. Optimal Values Variables Final Reduced Objective Name Value Cost Coefficient x1 0.250 0.000 0.12 x2 0.500 0.000 0.04 x3 0.250 0.000 0.03 Constarints Final Name Value Rule 1 0.25 Rule 2 -0.375 Rule 3 0.25 Rule 4 0.25 Risk 0.4 Prop 1 Dual Price 0 0 0 0.07 0.2 -0.04 Constraint R.H. Side 0.5 0 0.1 0.25 0.4 1 Allowable Allowable Increase Decrease 1E+30 0.07 0.035 1E+30 1E+30 0.07 Allowable Allowable Increase Decrease Status 1E+30 0.25 Not Binding 1E+30 0.375 Not Binding 0.15 1E+30 Not Binding 0.15 0.15 Binding 0.1 0.1 0.25 0.15 Slack 0.25 0.375 0.15 0 0 0 Objective function Value Annual Rate 0.0575 z Table D.2: Computer output for Question 6 (25 marks in total) APPENDIX D. PAST EXAM - MAY 2006 D.2 80 Solutions Solutions May 2006 Question 1 (a) (i) Need to minimize the total length, connect all nodes, have no redundant loops. [2 marks] (ii) Use either algorithm to produce Fig. F.1. Total length =10, make the connections as per the diagram. C 3 2 1 [4 marks] [1 mark] 2 2 3 5 1 1 4 1 6 Figure D.5: (b) (i) The probability of no delay along a path of length k is given by P = p1 × p2 × . . . p k Maximizing P ∼ Maximizing ln P ∼ Maximizing ln p1 + ln p2 + . . . ln pk ∼ Minimizing (− ln p1 ) + (− ln p2 ) · · · + (− ln pk ). [3 marks] Thus redraw the network for − ln pi . Fig. F.2 [2 marks] [S, 0.92] 1 0.92 [S, ∗] 0.92 0.69 0.36 S 0.69 [2, 1.89] [1, 1.84] 3 1.61 1.20 2 [S, 0.69] 1.61 4 [1, 1.61] [2, 2.3] Figure D.6: Nodes labelled [n, d ], where n is the previous node and d is the distance from S. Underline indicates label is permanent. (ii) · Label S with the permanent label [S, ∗]. APPENDIX D. PAST EXAM - MAY 2006 81 · Label 1 as [S, 0.92] and 2 as [S, 0.69] · Since label on 2 is temporary and less than label 1 make 2 permanent and label as [S, 0.69] · Label nodes adjacent to 2 that are unlabelled, or not permanent or have greater temporary node. Thus Label 3 as [2, 1.89] and 4 as [2, 2.30]. Make 1 permanent, since smallest temporary node and label as [S, 0.92]. · Label nodes adjacent to node 1 the are unlabelled, or not permanent or have greater temporary node. Thus label 3 as [1, 1.84] and change label 4 to [1, 1.61]. Make the smallest temporary label permanent, thus label 4 as [1, 1.61]. · Look at nodes adjacent to 4, no more changes · make the last temporary label permanent, thus change the label on 3 to [1, 1.84]. [9 marks] Recover paths and probabilities: S → 1 prob= 0.4, S → 2 prob= 0.5 S → 1 → 3 prob= 0.16, S → 1 → 4 prob= 0.2 [4 marks - (2 paths, 2 values) ] APPENDIX D. PAST EXAM - MAY 2006 82 Question 2 (i) Introduce a source S and two edges of capacity 5 and 6, as shown in Fig. D.7. The new network should be as in Fig. D.8. [3 marks] 5 * 6 j S1 S S2 Figure D.7: Insert artificial source node S with capacities 5 and 6. (ii) A flow of 2 is given in Fig. D.8. The points to note are that no capacity is exceeded and conservation of flow at each node is maintained. The diagram uses the notation [f low, capacity] for non-zero flows or just shows the capacity on a link with zero flow. [3 marks] [2, 2] [2, 5]* S1 3 - P1 > [2, 4] P3 > S 2 6 ~ S2 4 ~ - P2 3 3 5 [2, 6] j - P4 T 4 Figure D.8: (iii) The arcs in the network are labelled [f low, capacity] and the nodes (previous node, spare capacity). In each diagram the round node brackets are added according to the algorithm until T is reached. The path so found is then updated and the respective square brackets shown as being replaced. APPENDIX D. PAST EXAM - MAY 2006 (a) (S, 5) [2, 2] [0, 2] [2, 5] S [0, 5]* 1 [0, 3] 83 (S1 , 2) - P1 [2, 4] [0, 4] (P1 , 2) - P3 > > [2, 6] [0, 6] (P3 , 2) j S [0, 2] (S, ∞) [0, 6] ~ S2 [0, 3] [0, 4] ~ - P2 [2, 2] S1 [0, 3] - P1 - P 4 [2, 4] > [0, 2] - P3 > [0, 6] ~ [4, 6] S2 (S, 6) [0, 4] [4, 4] (S2 , 4) [0.5] [4, 5] [2, 6] j 3 [0, 3] ~ - P 2 [0, 4] (P2 , 3) S (S, ∞) T (P2 , 3) (S2 , 2) (S, 3) [2, 5]* [0.5] (S1 , 3) (S, 6) (b) 3 - P 4 (P4 , 4) T [0, 4] [4, 4] (P2 , 4) Figure D.9: (a) Shows the initial zero flow and the creation of the flow augmenting path S → S1 → P1 → P3 → T which is then updated by 2 units (b) Show the creation of the flow augmenting path S → S2 → P2 → P4 → T which is augmented by 4 units APPENDIX D. PAST EXAM - MAY 2006 84 (S2 , 2) (S, 3) (c) [2, 5]* [2, 2] S1 [0, 3] - P1 [4, 4] [2, 4] (P1 , 2) - P3 > > S (S, ∞) [0, 2] [6, 6] ~ [4, 6] S2 (S, 2) [4, 4] [4, 5] (S1 , 3) j - P 4 (P3 , 2) T 3 [0, 3] ~ - P 2 [2, 2] [4, 6] [2, 6] [4, 4] (P2 , 1) cut = 10 (S, 3) (d) [4, 5] S [2, 5]* 1 [0, 3] [4, 4] - P1 > [2, 3] S (S, ∞) [2, 2] [6, 6] ~ - P3 > [2, 3] [2, 2] S2 (S, 2) (P2 , 3) [4, 4] (S1 , 3) [4, 5] j 3 [0, 3] ~ - P 2 [4, 6] [6, 6] - P 4 (P3 , 2) T [4, 4] (P2 , 1) Figure D.10: In Fig. D.10(d) the process is terminated as there are no more flow augmenting paths to create. [12 marks - 3/diagram] As can be seen the maximal flow is 10. [2 marks] The maximal flow theorem states that in a standard network the maximal flow is equal to the minimum cut. As can be seen a cut of 10 has been constructed in Fig. D.10(d) which is equal to the flow from the Ford-Fulkerson method; confirming that the flow found by the algorithm is indeed max. [5 marks - (2 cut, 3 Thrm) ] APPENDIX D. PAST EXAM - MAY 2006 85 Question 3 (i) A optimal policy has the property that whatever the initial state and initial decision are, the remaining decisions must constitute an optimal policy with regards to the state resulting from the first decision. [2 marks] In this problem if node(i) is on the optimal path for the problem then using the same criteria of optimality all the nodes after i are on the optimal path. [3 marks] (ii) Stage Stage Stage Stage 4 3 2 1 with with with with input input input input {1} and output {2, 3, 4} {2, 3, 4} and output {5, 6, 7} {5, 6, 7} and output {8, 9} {8, 9} and output {10} The state variable xi is the input to stage i [2 marks] At each stage i choose for input xi one of the elements of Di of the form (xi , ∗) where the decision sets are given by: D4 = {(1, 2), (1, 3), (1, 4)} D3 = {(2, 5), (2, 6), (3, 6), (3, 7), (4, 7)} D2 = {(5, 8), (5, 9), (6, 8), (6, 9), (7, 8), (7, 9)} D3 = {(8, 10), (9, 10)} [2 marks] (iii) (a) Let fi (xi ) stand for the shortest distance of the input node xi at stage i to node(10). (b) Let fi (xi ) stand for the longest distance of the input node xi at stage i to node(10). [2 marks] (iv) (a) fi (xi ) = min {di,i−1 + fi−1 (xi−1 )} i = 1, . . . 4 x0 = 10, f0 (x0 ) = 0 xi links (b) fi (xi ) = max {di,i−1 + fi−1 (xi−1 )} i = 1, . . . 4 x0 = 10, f0 (x0 ) = 0 xi links [4 marks] (v) Using the notation [total min distance to 10, next node in path] and (total max distance to 10, next node in path) Fig. D.11 shows the completed network starting from node(10) and working back to node(1). Shortest path 1 → 2 → 6 → 8 → 10 min distance = 22 [5 marks] Longest path 1 → 3 → 7 → 8 → 10 max distance = 34 [5 marks ] APPENDIX D. PAST EXAM - MAY 2006 86 (27,5) [21,6] (34,3) 3 (31,7) 3 - 1 12 2 1 > [22,2] 4 3 [22,6] 2 (4,10) (15,8) [14,9] 15 R 4 - [4,10] 11 5 9 (18,8) 14 j - 6 13 [18,8] 12 j - 7 10 - 8 >7 4 s - 9 3 (5,10) [5,10] R z 5 10 13 (16,8) [15,9] (29,7) [28,7] Figure D.11: Question 4 Linear Programming Problem [5 marks ] Let x1 ≥ 0 be the number of domestic dwellings inspected and x2 ≥ 0 the number of domestic dwelling inspected per day. The constraint for the time to inspect is 10x1 + 40x2 ≤ 300 The constraint for the time to do the associated paperwork is 3x1 + 7x2 ≤ 60 Bonus for doing the inspections z = 3x1 + 10x2 Solution Diagram Fig. D.12(a) [2 marks ] Verify that the max is at P with x1 = x2 = 6 and z = £78. [2 marks ] Dual Problem Minimize z = 300y1 + 60y2 subject to: 10y1 + 3y2 ≥ 3 40y1 + 7y2 ≥ 10, y1 , y2 ≥ 0 [5 marks ] Interpretation of Dual y1 is the amount of bonus paid per minute for carrying out inspections. y2 is the amount of bonus paid per minute for doing the paperwork APPENDIX D. PAST EXAM - MAY 2006 87 (a) (b) x2 y2 40y1 + 7y2 = 10 3x1 + 7x2 = 60 7.5 10y1 + 3y2 = 3 B 1 A P P A O 20 x1 30 B 0.25 O y1 0.3 x1 + 4x2 = 30 Figure D.12: (a) Primal problem (b) Dual problem Company would like to minimize the amount of bonus earned in a day, that is to say minimize z = 300y + 60y2 . However they will still need to pay at least £3 per domestic inspection and £10 per commercial inspection. Thus: domestic 10y1 + 3y2 ≥ 3 commercial 40y1 + 7y2 ≥ 10 [5 marks ] Solution of Dual The solution to the dual problem is given in Fig. D.12(b) Verify that the min is at P with: y1 = 9 50 , y2 = 2 5 [2 marks ] and z = £78. [2 marks ] The dual solutions are the shadow or dual prices of the primal problem. Since y2 > y1 it is therefore more beneficial for the surveyor to allocate more time to paperwork. [2 marks ] Question 5 (i) Introducing the extra variables: x1 + x2 − s1 + a1 = 1 Thus: µ ¶ 1 1 0 −1 1 0 A= 1 1 2 0 0 1 x1 + x2 + 2x3 + s2 = 4 µ b= 1 4 z = 2x1 + x2 + x3 − M a1 ¶ cT = (2, 1, 1, 0, −M, 0) xT = (x1 , x2 , x3 , s1 , a1 , s2 ) [3 marks ] APPENDIX D. PAST EXAM - MAY 2006 88 (ii) To start the simplex method at the x-space origin would, without a1 , imply that s1 negative, thus not feasible. [1 mark ] (iii) Basic a1 s2 zj ∆zj cj −M 0 x1 2 1 1 −M [2 + M ] x2 1 1 1 −M 1+M x3 1 0 2 0 1 s1 0 −1 0 M −M a1 −M 1 0 −M 0 s2 0 0 1 0 0 d r 1 4 z= −M (1) 4 Table D.3: [4 marks ] (iv) In Table E.2 since [2 + M ] is the largest value on the bottom row and (1) is the smallest value in the end column bring x1 into the basic solution and take a1 out. Basic x1 s2 zj ∆zj cj 2 0 x1 2 1 0 2 0 x2 1 1 0 2 −1 x3 1 0 2 0 1 s1 0 −1 1 −2 [2] a1 −M 1 −1 2 −M − 2 s2 0 0 1 0 0 d r 1 3 z= 2 −1 (3) Table D.4: [2 marks ] Since the [2] is the largest element in the last row and (3) the smallest non-negative value in the last column bing s1 into the basic solution and take s2 out. Basic x1 s1 zj ∆zj cj 2 0 x1 2 1 0 2 0 x2 1 1 0 2 −1 x3 1 2 2 4 −3 s1 0 0 1 0 0 a1 −M 0 −1 [0] −M s2 0 1 1 [2] −2 d r 4 3 z= 8 Table D.5: [2 marks ] All the values in the final row of Table 2 are non-positive thus an optimum solution has been reached with: x1 = 4, x2 = x3 = 0 and z = 8 [2 marks ] (v) (a) Dual variables y0 = 0 and y1 = 2 respectively for constraints; terms in [ ] in Table 2 [2 marks ] APPENDIX D. PAST EXAM - MAY 2006 (b) For b1 : µ For b2 : µ ¶ 4 3 µ +δ 4 3 ¶ ¶ 0 −1 µ +δ 1 1 89 ≥0 ⇒ δ≤3 ⇒ b1 ∈ (−∞, 4] [2 marks ] ¶ ≥0 ⇒ δ ≥ −3 ⇒ b2 ∈ [1, ∞) [2 marks ] (c) To investigate the range of optimality for x1 replace the coefficient of x1 in the objective function with α in the final tableau. This gives Table E.5 from which: Basic x1 s1 zj ∆zj cj α 0 x1 α 1 0 α 0 x2 1 1 0 α 1−α x3 1 2 2 2α 1 − 2α s1 0 0 1 0 0 a1 −M 0 −1 0 −M s2 0 1 1 α −α d r 4 3 z= 4α Table D.6: [3 marks ] For the solution to remain optimal the final row must remain non-positive, thus: 1−α≤0 1 − 2α ≤ 0 −α≤0 ⇒ 1≤α Thus the range of optimality is [1, ∞). [2 marks ] Question 6 The inequality constraints are: x1 ≤ 0.5 x2 − x1 ≥0 2 x3 ≥ 0.1 x3 ≤ 0.25 The equation constraints are: (risk) 0.8x1 + 0.3x2 = 0.4 (sum=1) x1 + x2 + x3 = 1 Objective function to maximize the rate of return z = 0.12x1 + 0.04x2 + 0.03x3 Variables non-negative. [7 marks ] (i) From the data x1 = x3 = 0.25 and x2 = 0.5. Thus investment is: 50% unit trust Annual return is 5.75% 25% cash and 25% shares [3 marks ] APPENDIX D. PAST EXAM - MAY 2006 90 (ii) From the data the change in rhs rule4 is ±0.15 Thus the feasible range for the righthand side of rule4 is given by: 0.25 − 0.15 ≤ rhs ≤ 0.25 + 0.15 ⇒ [0.1, 0.4] [2 marks ] (iii) Dual price for Risk = 0.2 thus increase in z due to an increase of 0.05 is = 0.2 × 0.05 = 0.01 ⇒ Return = 6.75%. Dual price of investing cash = 0.07 thus the increase in z due to an increase of 10% points, that is to say 0.1, is 0.007 ⇒ Return = 6.45% Thus increase the level of risk. [4 marks ] (iv) Reduced cost of a particular variable is the change in the corresponding coefficient in the objective function such that there exists an optimal solution with the value of this variable non-zero. If the variables are already non-zero at the optimal solution, as in this example then no changes are needed and hence all the reduced costs are zero. [2 marks ] (v) If z = 0.12x1 + 0.04x2 + 0.03x3 = c1 x1 + c2 x2 + c3 x3 then the data gives the possible increases and decreases of ci . c1 : 0.12 − 0.07 ≤ c1 < ∞ ⇒ c2 : −∞ < c2 ≤ 0.04 + 0.035 c3 : 0.03 − 0.07 ≤ c3 < ∞ ⇒ [0.05, ∞) ⇒ (−∞, 0.075] [−0.04, ∞) [3 marks ] (vi) 7%=0.07 is inside the range of optimality for c2 thus the solution is still valid and thus the new value of z given by: z = 0.25 × 0.12 + 0.5.07 + 0.25 × 0.03 = 0.0725 = 7.25% [3 marks ] 8%=0.08 is outside the optimal range for c2 thus the problem would need to be resolved. [1 mark ] Appendix E Specimen Exam Type Questions and Solutions E.1 Specimen Questions The following questions are intended to give you an idea of the type of problem I will expect you to be able to solve. In the exam the the problems are balanced to be all about the same length, in the following this is not the case. That is to say some of the following problems will be shorter and some longer than those found in the exam E.1.1 Minimal spanning tree problem A spanning tree links all nodes in a network and has no cycles. Associating a positive value with each edge of the network gives the idea of a minimum spanning tree. Such a tree is therefore the most economical arrangement, in terms of the associated edge values, for connecting all nodes. 1 1 2 3 1 E 2 6 2 5 4 3 2 5 6 4 1 2 3 9 3 7 4 8 1 10 Figure E.1: 1. Figure E.1 gives the layout of all possible routes for telephone links between the main exchange E and local substations (distances in km). All substations need to be linked to E either directly or via another substation. 91 APPENDIX E. SPECIMEN EXAM TYPE QUESTIONS AND SOLUTIONS 92 Since the links are to be underground find the layout that involves the least amount of tunnelling. (That is find the minimum spanning tree for the network). (a) Using Prim’s algorithm (b) Using Kruskal’s algorithm Give the value of the minimum spanning tree. 2. Using either method find the minimum spanning trees for each of the networks in Figure E.2. (a) 1 3 2 2 2 3 4 4 2 (b) 1 1 4 1 5 1 1 6 4 3 2 4 4 1 5 6 2 2 5 5 3 1 7 Figure E.2: In each case try and produce two minimum spanning trees, hence verifying that the minimum value is unique. E.1.2 Shortest distance problem Given a network, to which a positive value is assigned to each edge, we considered two algorithms that found the shortest path through the network. In the case of Dijkstra’s algorithm the shortest paths from a given node to all the other nodes is calculated whereas Floyd’s algorithm calculates the shortest path between each pair of nodes. The choice of algorithm depends on the problem at hand, if indeed we do only require the shortest path from a given node then Dijkstra’s algorithm is the obvious choice. Floyd’s algorithm is longer but much shorter than applying Dijkstra’s algorithm to each node in turn. In our examples the networks were either mixed or directed, this will tend to be the case in these problems. 3. Dijkstra For each of the networks in Figure E.3 find the shortest paths and their values from the node S to each of the other nodes. Note that (a) is a directed network whereas (b) is a mixed network. This does not affect the algorithm but you need to keep this in mind when, in the algorithm, you are looking at the nodes directly connected to the last permanent node created. APPENDIX E. SPECIMEN EXAM TYPE QUESTIONS AND SOLUTIONS (a) 1 µ S 1^ 2 (b) 5 - 2 4 5 7 4R 3 2 2 2 - 4 7 5 2 ° µ 1 1 1 S ^ - 6 3 3 93 2 4 3 ^ - 2 Figure E.3: 4. Most Reliable Route Problem Classically we are given a directed network and each edge value corresponds to a probability of success in traversing the edge. The the probability of total success in traversing a path in the network is the product of these probabilities. (typically these probabilities could be the probabilities of not being delayed). The problem is to find the paths from a given node to all the other nodes such that the probability of total success along each path is a maximum. This is achieved by considering an auxiliary network where the edge value are −logarithm of the original edge values. The problem is then reduced to a minimum path problem. Given the network in Figure E.4 the numbers represent the probability of some form of success when traversing the arcs. • Construct an auxiliary network where the edge values are −logarithm of the original values. • Hence find the paths of maximum success in traversing the network from H to each of the other nodes. (use Dijkstra) 0.2 0.4 * 1 H 0.6 0.5 0.3 0.4 0.2 w 4 : 2 3 º ^ 0.1 3 Figure E.4: 5. Floyd’s algorithm Using Floyd’s algorithm find the routes and values of the minimal paths between each pair of APPENDIX E. SPECIMEN EXAM TYPE QUESTIONS AND SOLUTIONS 94 nodes for the network in Figure E.5. 4 1 3 1 4 1 1 2 2 4 Figure E.5: E.1.3 Maximum Flow - Minimum Cut - Ford-Fulkerson These problems concern directed networks in which associated with each edge is a positive capacity and a non-negative flow. In its simplest form this problem is best visualizes as oil or gas flowing down a pipe in a given direction. The problem is to discover the maximum possible flow through a network. Ford and Fulkerson developed an algorithm to calculate the maximum flow. Alternatively the idea of a cut was introduced and the Max-Flow Min-Cut theorem tell us that the value of the maximum flow is equal to that of the minimum cut. It does not tell us how the max flow can be achieved. 6. The numbers on the edges of the directed network in Figure E.6 represent the capacities of each edge. (a) The network is shown to have a single source S, redraw the network to also have a single sink T . That is to say redraw it as a basic network (b) In general nodes in a basic network have no restriction of flow through them. However if node(1) has a restricted capacity of 5 redraw your network in (a) using only unrestricted nodes and edges with capacities. (c) In your network in (b) construct a flow of 6 units. (this may be done in several ways) (d) For your network in (c) construct two cuts of different value. What can you say about the maximum flow in the network? (e) Use the Ford-Fulkerson algorithm to find the maximum flow in the network, stating how this maximum flow can be achieved. 7. For the network in Figure E.7, with source S and sink T , the arcs are labelled [flow, capacity]. By inspection identify a ’flow augmenting path’. Increase the flow along this path to the point of saturation. Continue to identify flow augmenting paths and increase to saturation until none exist. Hence write down the maximal flow for the network. APPENDIX E. SPECIMEN EXAM TYPE QUESTIONS AND SOLUTIONS 4 1 7 3 95 - 3 3 2 S 5 4 s 2 3 j - 4 Figure E.6: [2,4]3 [1,4] 1 [1,3] S - 3 [0,3] ~ [1,3] [0.5]s 2 + [1,3] j - 4 T 3 [2,4] Figure E.7: 8. Apply the Ford-Fulkerson algorithm to the network in Figure E.8 to find the maximal flow and show how it is achieved. [0,7] 3 [0,5] 1 [0,3] - [0,4] 3 [0,5] S [0,3] - 5 [0,5] [0,8] s T > [0.6] s 2 + [0,9] j - 4 ª [0,6] R - 6 [0.6] Figure E.8: E.1.4 Dynamic Programming The methodology of Dynamic Programming requires that the problem is split into stages with each stage having input and output. The input and output variables are called the state variables for the system. At each stage a decision is made using an optimal policy. Bellman’s principle APPENDIX E. SPECIMEN EXAM TYPE QUESTIONS AND SOLUTIONS 96 is used to create a sequence of decisions that usually involves maximizing or minimizing an optimization functional which is defined via a recurrence relation. 9. The network in Figure E.9 represents possible routes between towns for a journey from town S to town T . Using the methodology of Dynamic Programming find: (i) The shortest path from S to T (ii) The path from S to T that minimizes the longest leg on the route. (Such a path would be of interest if for some reason a person did not wish to travel in a single step more than necessary even at the expense of a longer journey.) First however carry out the following: • Identify suitable stages for the dynamic programming process • The decision sets Di at each stage. • The state variables for each stage. • The recurrence relation for the optimization functional for each of (i) and (ii) 1 µ 4 7 3 2 S 1 2 4 1 2 z 3 4 2 R 4 s - 5 * 2 j - 6 3 3 Á 6 q * 5 2 j 4 j 5 8 5 6 q : 10 q : 9 * 11 T 6 2 3 Figure E.9: 10. PhotoShop is to develop an equipment replacement policy over the next three years for its super colour printer. The cost of a new printer is £ 25,000 and the companies policy is to not run a printer that is more than five years old. As the printer ages its ability to generate revenue decreases (due mainly from it being down for repair and the clearing of paper jams ) and the cost of the maintenance contract increases. Table 2gives the annual revenue r(t) and maintenance cost c(t) for a machine that is t years old at the start of the year. Also the table gives the trade in value s(t) of a machine that is t years old. APPENDIX E. SPECIMEN EXAM TYPE QUESTIONS AND SOLUTIONS Age of Machine t years 0 1 2 3 4 5 Revenue r(t) 15 14 12 9 5 − Operating Cost c(t) 1 1.2 1.4 1.7 2.1 − 97 Trade in Value s(t) − 19 14 11 9 7 Table E.1: Costs in thousands of pounds sterling. Using the ideas of Dynamical Programming: • Construct a network to define the problem. Identify the stages, state variables and decisions. Define a suitable optimization functional fi and hence write out the recurrence relation defining each fi . • Assuming the shop starts with a three year old printer, obtain the optimal policy for this problem over the three year period. The trade in value at the end of the period should be considered as a contribution to the total revenue. 11. Simple Knapsack Problem A cargo ship can carry up to 6 tons of cargo and is to be loaded with one or more of three types of cargo. The weights in tons and return in thousands of pounds on one item of each cargo type is given in Table E.2. cargo type i 1 2 3 weight tons wi 3 4 1 return per item ri 30 50 15 Table E.2: Weight in tons per item for each type of cargo; profit per item of each type. Using the knapsack problem from dynamic programming find how best to load the ship in order to maximize return. That is to say how many items of each type should be loaded to give a maximum return; what is this return. APPENDIX E. SPECIMEN EXAM TYPE QUESTIONS AND SOLUTIONS E.1.5 98 Linear Programming The following problems illustrate the types of problem we have covered. The two dimensional problems can be solved using a graph. For problems with more than two dimensions the question may ask you to derive the constraints and objective function and then give you the solution in the form of an Excel report, as seen in the class problems and coursework. Finally the solution using the simplex method and the use of the final tableau to investigate the problem will be tested, as seen in the final coursework and notes. 12. Using graphical means solve the following linear programming problem. Maximize z = 3x1 + 2x2 subject to: x1 + x2 ≤ 3 (i) x1 + 2x2 ≤ 4, 2x1 + x2 ≤ 4 x1 , x2 ≥ 0 • Which constraints are binding • If (i) is replaced with x1 + x2 ≤ 3 + δ with δ ≥ 0 such that the same constraints remain binding, calculate ∆z δ , where ∆z is the change in z due to the introduction of δ. In the theory of linear programming what is this quantity referred to. 13. Using graphical means solve the following linear programming problem. Maximize z = 3x1 + 2x2 subject to: x1 + x2 ≤ 3 2x1 + x2 ≤ 4 x1 , x2 ≥ 0 • Write down the dual of the problem. • Use graphical means to solve the dual problem 14. City University pay me separately to work in each of the two departments, Mathematics and Actuarial Science. For every one hour lecture I give in the Mathematics Department I am paid £5 and for every one hour lecture I give in the Department of Actuarial Science I am paid £7. Unfortunately each lecture generates extra preparatory work, those in mathematics taking an extra 1hr per lecture and those in Actuarial Science an extra 1 12 hrs per lecture. In any given week I am not prepared to give more than 15hrs lectures or spend more than 19hrs on preparation. How should I best arrange my time between the two departments in order to maximize my return. (Solve using a graph) Write down the dual problem and solve graphically. Interpret the dual problem from the point of view of City University as an employer. 15. Given µ x1 1 2 ¶ µ + x2 −1 1 ¶ µ + x3 2 1 ¶ µ = 4 1 ¶ obtain all three sets of basic solutions to the problem. Which, if any, of these sets would be a feasible basic solution for a standardized linear programming problem? APPENDIX E. SPECIMEN EXAM TYPE QUESTIONS AND SOLUTIONS 99 It is not necessary to use row reduction. You can see that any pair of columns on the left hand side are independent, hence in turn, set the other variable equal to zero and solve the simple simultaneous equations in two variables 16. Use the Simplex Method to Maximize z = 2x1 + x2 + x3 subject to x1 + x2 + x3 ≤ 4, x1 − 2x2 + x3 ≤ 3 x1 , x2 , x3 ≥ 0 From the optimal table: • Write down the dual variables. • Calculate the range of optimality for the coefficients in the objective function. • Calculate the feasible range for the righthand sides of the two constraints. • Write down the dual problem and hence write down its optimal solution. • Verify your result by solving the dual problem graphically. 17. Consider the problem: Maximize z = 2x1 + x2 subject to x1 + x2 ≤ 4, x1 + 2x2 ≥ 6 x1 , x2 ≥ 0 • Introduce a slack, surplus and artificial variable to write the constraints in a form suitable for solution by the Simplex Method. • Introducing a large positive constant M write down a suitable objective function for use in the Simplex Method • Solve the problem using the Simplex Method • Write down the dual variables. • Calculate the range of optimality for the coefficients in the objective function. • Calculate the feasible range for the righthand sides of the two constraints. 18. A firm makes three different types of confectionary, milk chocolate, plain chocolate and toffee. The production line consists of five departments (a) - (e). The amount of time taken to process one tonne (1000 kg) of each of the three types in each of the five departments is given in Table E.3. Additionally the total number of hours available in each department during the next week is given in the final column of the table. The profit on 1kg of milk chocolate is £1.25, the profit on 1kg of plain chocolate is £1.50 and on 1kg of toffee is £0.75. Write down the constraints in this problem for production over the next week and the objective function used to maximize the profit. The output from solving this problem using Solver is given at the end of this question, use this data to: • Write down the optimum production plan and the maximum profit obtained. • In which department is it most advantageous to increase the available time by a small amount. What is the maximum amount by which this department could be expanded. APPENDIX E. SPECIMEN EXAM TYPE QUESTIONS AND SOLUTIONS Dept (a) (b) (c) (d) (e) Milk Choc 2 3 1 2 3 Plain Choc 1 1 1 3 1 Toffee 1 4 1 1 0 100 Available Time 35 40 30 60 20 Table E.3: Processing times in hrs for 1000kg of each type of confectionary in the five departments; Availability of time in each department in hrs for the next production period • Explain what is meant by reduced cost an why are all these zero. • Write down the dual problem. • Use the output to write down the solution to the dual problem. APPENDIX E. SPECIMEN EXAM TYPE QUESTIONS AND SOLUTIONS Name z Original Value 3500 Adjustable Cells Name Original Milk Plain Toffee Constraints Name (a) (b) ( c) (d) (e) Value 1.000 1.000 1.000 Cell Value 24.29 40.00 23.57 60.00 20.00 Final Value 31429 Final Value 0.714 17.857 5.000 Formula $C$3<=$B$3 $C$4<=$B$4 $C$5<=$B$5 $C$6<=$B$6 $C$7<=$B$7 Status Not Binding Binding Not Binding Binding Binding Slack 10.714 0.000 6.429 0.000 0.000 Adjustable Cells Name Milk Plain Toffee Final Value 0.71 17.86 5.00 Reduced Cost 0.000 0.000 0.000 Objective Coefficient 1250 1500 750 Allowable Increase 3250.00 200.00 142.86 Allowable Decrease 90.909 1083.333 285.714 Final Value 24.29 40.00 23.57 60.00 20.00 Shadow Price 0.000 71.429 0.000 464.286 35.714 Constraint R.H. Side 35 40 30 60 20 Allowable Increase 1E+30 36 1E+30 5 20 Allowable Decrease 10.714 20.000 6.429 41.667 1.818 Constraints Name (a) (b) ( c) (d) (e) 101 APPENDIX E. SPECIMEN EXAM TYPE QUESTIONS AND SOLUTIONS E.2 102 Solutions 1. The following two trees in Fig. E.10 are possible minimum spanning trees, (a) using Prim’s method and (b) using Kruskal’s. They are not unique however the value of each and indeed any other minimum spanning tree is unique and equal to 18. (a) 6 (b) 3 3 9 1 10 2 2 E 2 1 5 2 3 2 1 E 8 6 9 4 1 8 7 1 10 3 2 2 3 2 5 2 1 2 3 4 1 1 1 1 7 Figure E.10: (a) Using Prim’s algorithm. (b) Using Kruskals algorithm. Value = 18 2. For (a) there is only one minimum spanning tree as seen in Fig. E.11(i). For (b) there are two as shown in Fig. E.11(ii)(iii). In (i) the value is 9 and in (ii) and (iii) the values are both 12. (i) 1 (ii) 1 2 1 3 1 2 2 4 1 2 2 5 1 5 1 3 4 6 6 4 (iii) 5 1 2 2 4 1 1 7 1 3 2 5 6 5 1 Figure E.11: 3. In Fig. E.12 are the two final networks with their permanent labels. • For (a) the paths are: S → 1 length = 2, S → 1 → 2 length = 7, S → 3 length = 4 S → 1 → 5 length = 3, S → 3 → 4 length = 6 S → 1 → 5 → 6 length = 7, 7 APPENDIX E. SPECIMEN EXAM TYPE QUESTIONS AND SOLUTIONS 103 • For (b): S → 1 length = 1, S → 1 → 4 → 2 length = 6, S → 3 length = 2, S → 1 → 4 length = 3, [2, S] (a) [7, 1] 5 1 [0, S] µ 2 1^ S 4R 3 [4, S] 2 4 5 7 1 - [3, 1] 2 - 4 (b) [0, S] [1, S] 1 1 S 2 [7, 5] ^ - 6 2 7 5 2 ° µ 3 3 [6, 3] 4 2 [2, S] [3, 1] 3 ^ - 2 [6, 4] Figure E.12: 4. Fig. E.13 shows the auxiliary network, that is the one with − ln(p) on each arc, and the final permanent labels obtained by Dijkstra’s method. The paths of max probabilities are given as: H → 1 P = 0.4, H → 2 P = 0.6, H → 1 → 3 P = 0.2, H → 4 P = 0.2. The probabilities can either be retrieved from the value in the label, exp(−value), or by looking at the actual route on the original network and forming the appropriate product of the probabilities on the arcs. [0.916, H] [0.511, H] 1.609 0.916 * [0, H] H : 2 3 º 1 0.511 1.204 0.916 1.609 w 0.693 - 4 2.303 [1.609, H] ^ 3 [1.609, 1] Figure E.13: 5. This network is so simple there are no changes in the D or M matrix until D4 and M4 . The APPENDIX E. SPECIMEN EXAM TYPE QUESTIONS AND SOLUTIONS final matrices are given in Eq(F.1). ∗ 3 3 ∗ D4 = 2 1 1 2 2 1 ∗ 1 1 2 1 ∗ 1 4 M4 = 4 1 4 2 2 2 4 3 3 3 4 4 4 4 104 (E.1) The routes are: 1 → 4 → 2 = 2 → 4 → 1 = 3, 1→4→3=3→4→1=2 1 → 4 = 4 → 1 = 1, 2→3=3→2=1 2 → 4 = 4 → 2 = 2, 3→4=4→3=1 6. (a) In Fig. E.14(a) an artificial sink has been introduced, the capacities on the arcs being the sum of the respective ingoing arcs to nodes 3 and 4. (b) The restricted node has been replaced with a two free nodes 1’ and 1” and an arc with capacity 5, the same value as the restriction in node 1. (c) In Fig. E.14(a) a flow of 6 is shown, you may have a different flow of 6. (d) The cuts have value 9 and 10. The Max-Flow Min-Cut theorem tells us that the max flow must be less than or equal to 9. replacement nodes and arc capacity 5 (a) [4, 7] * 1’ [4, 4] [4, 5] 1” [0, 2] - 3 3 [4, 9] artificial sink s T * [2, 5] S [0, 5] z 2 [2, 4] cut=9 cut=10 (b) [5, 7] * 1’ j - 4 [2, 3] [4, 4] [5, 5] 1” [1, 2] - 3 3 S [4, 5] [4, 4] z 2 [0, 3] j - 4 [8, 9] s T * [1, 5] Figure E.14: (e) Fig. E.14(b) shows the final network in the Ford-Fulkerson method. The max flow is 9 and is achieved as indicated. APPENDIX E. SPECIMEN EXAM TYPE QUESTIONS AND SOLUTIONS 105 7. The following paths are flow augmenting paths and can be increased by the amount shown. The final network is in Fig. E.15 where a cut has been inserted in order to verify that the flow obtained was indeed a max. S → 1 → 3 → T , increase by 2 S → 2 → 4 → T , increase by 2 S → 2 → 3 → T , increase forward arcs by 1 and reduce backward arcs by 1 Flow is now 7, which as the given cut shows is in fact the maximum flow for the network. cut=7 [4,4] 3 [3,4] 1 - [1,3] 2 [3,3] ~ T 3 [4,4] [0,3] S [3.5] s 3 j - 4 + [3,3] Figure E.15: 8. The final flow is shown in Fig. E.16. You will find that the algorithm will come to an end because it cannot find a path from S to T that is flow augmenting. cut = 10 [4,7] 3 [4,5] 1 - [4,4] 3 - 5 [0,5] [0,3] [0,5] S [4,8] s [0,3] T > [6.6] s 2 + [6,9] j - 4 ª [6,6] R - 6 [6.6] Figure E.16: I have added a cut to the diagram just to show that the flow of 10, which is found by the F-F algorithm is indeed a max flow. APPENDIX E. SPECIMEN EXAM TYPE QUESTIONS AND SOLUTIONS 106 9. Define the following sets: S6 = {T }, S5 = {10, 11}, S4 = {7, 8, 9}, S3 = {5, 6}, Stage i is defined to have input Si and output Si+1 S2 = {1, 2, 3, 4}, S1 = {S} i = 1 . . . 5. The decisions at each stage are ’which arc is chosen’ thus the decision sets are: D5 = {(10, T ), (11, T )}, D4 = {(7, 10), (8, 10), (8, 11), (9, 11)}, D2 = {(1, 5), (2, 5), (2, 6), (3, 5), (3, 6), (4, 6)}, D3 = {(5, 8), (6, 7), (6, 8), (6, 9)} D1 = {(S, 1), (S, 2), (S, 3), (S, 4)} The state variables at stage i are the elements of the set Si , that is to say the input nodes at each stage. Optimization functional: (i) fi (xi ) is the value of the shortest path from stage i with input xi to T . This is defined by: fi (xi ) = min arcs(xi ,xi+1 ) {fi+1 (xi+1 ) + dist(xi , xi+1 )} f6 (x6 ) = 0 (ii) fi (xi ) is the value of longest arc on the path from stage i with input xi to T that has the smallest longest link. This is defined by: fi (xi ) = min arcs(xi ,xi+1 ) {max[fi+1 (xi+1 ), dist(xi , xi+1 )]} (6,5) [17,5] (5,10) [8,10] 1 µ 3 2 S 4 (5,4) 2 4 [13,6] [15,2] 1 2 (5,6) 2 z 3 2 1 4 [15,5] (5,6) R 4 f6 (x6 ) = 0 (6,8) [13,8] 7 Á s - 5 6 [7,10] 2 * q 8 5 * j - 6 5 (5,10) 4 3 6 j [12,8] 2 9 (5,7) 3 3 [8,11] (6,11) (5,T) [5,T] q : 10 q 11 : 5 j * T 6 [6,T] (6,T) [15,6] (5,6) Figure E.17: For (i) I have used the notation [fi (xi ), xi+1 ] with square brackets and for (ii) the notation (fi (xi ), xi+1 ) with round brackets. With this type of problem, that it to say a small network, you can put the labels straight on the diagram, as seen in Fig. E.17, starting at nodes 11 and 10 and working back to S. Whenever there is a tie for a choice of arc then randomly select one. Thus the two solutions are: APPENDIX E. SPECIMEN EXAM TYPE QUESTIONS AND SOLUTIONS 107 (i) S → 2 → 6 → 8 → 10 → T is the shortest path and is equal to 15. (ii) S → 4 → 6 → 7 → 10 → T is a path that minimizes the longest link; which is 5. Had we made any other choices that satisfied the optimality criteria then a different path may have been obtained but the value 5 would have been the same. 10. Let each stage represent a year in the three year period. Let xi be the age of the machine at the start of the ith stage (ie the ith year) The only decision is to Keep or Replace, except at the end when a trade in value is considered. Let fi (xi ) be the net return, including the final trade in value, from state xi to the final trade in. The following network represents this problem. [35, R] 1 µ [27, R] R µ K j R [35, R] 3 R - 1 [19,T] z * 1 Á K R 2 R R R 3 [22, R] 2 R K s 4 [25, R] stage 1 year 1 State Variables. x 1 Age of machine at start of stage i. [14,T] K - 5 K [15, R] stage 2 year 2 x2 ~ - T 3 [11,T] stage 3 year 3 x3 trade in x4 Figure E.18: The decisions are Replace, Keep. The states are shown inside the nodes; Optimal path shown in bold. The optimization functional is given by: ½ fi (xi ) = Max fi+1 (1) + r(0) − c(0) + s(xi ) − 25 Replace fi+1 (xi + 1) + r( xi ) − c(xi ) Keep ¾ i = 1 . . . 3, f4 (x4 ) = s(x4 ) Initially label the nodes x4 as [s(x4 ),T] Stage 3 f3 (1) = Max{19+15−1+19−25 = 27, Replace; 14+14−1.2 = 26.8, Keep} label = [27,R] f3 (2) = Max{19+15−1+14−25 = 22, Replace; 11+12−1.4 = 21.6, Keep} label = [22,R] f3 (5) = {19 + 15 − 1 + 7 − 25 = 15} label = [15,R] APPENDIX E. SPECIMEN EXAM TYPE QUESTIONS AND SOLUTIONS 108 Stage 2 f2 (1) = Max{27+15−1+19−25 = 35, Replace; 22+14−1.2 = 34.8, Keep} label = [35,R] f2 (4) = Max{27+15−1+9−25 = 25, Replace; 15+5−2.1 = 17.9, Keep} label = [25,R] Max{35+15−1+11−25 = 35, Replace; 25+9−1.7 = 32.3, Keep} label = [35,R] Stage 1 f1 (3) = Thus the best strategy is to replace the machine every year, this give a net return over the three year period, including the final trade in , of £35,000. 11. Define the stage to be the process of allocating the amount of type i cargo to the ship. Let the state variable xi be the number of tonnes available just before allocating type i cargo. The decision variable, di is the number of units allocated consistent with the optimization criteria. The functional fi (xi ) is the largest overall possible return from stages i to completion, for input xi at stage i. The network in Fig. E.19 represents the allocation of the loads bearing in mind the weight of each type of load and the overall maximum load that can be carried. [90,0] [90,6] 0 1 6 6 [30,0] 6 1 z 2 2 - 3 0 - 3 3 µ 0 [90,6] 6 1 2 [45,3] ~ 0 0 [45,0] 0 R j 0 3 [0,0] - 0 [0,0] [0,0] stage 1 stage 2 stage 3 load type 1 load type 2 load type 3 State Variables. x1 Available space at start of stage i. x2 x3 x4 Figure E.19: The decisions di are shown on each arc of the network. Label the final node [0,0] and then label backwards with [fi (xi ), xi+1 ] i = 3 . . . 1. At stage 3: At this stage there is only one possible label for each x3 x3 = 6 : load with 6 units of type 3 to give return 90 label = [90,0] x3 = 2 : load with 2 units of type 3 to give return 30 label = [30,0] x3 = 3 : load with 3 units of type 3 to give return 45 label = [45,0] APPENDIX E. SPECIMEN EXAM TYPE QUESTIONS AND SOLUTIONS x3 = 0 : load with 0 units of type 3 to give zero return 109 label = [0,0] At stage 2: x2 = 6, f2 (6) = M ax{d2 = 0, 90 + 0 = 90 : d2 = 1, 30 + 50 = 80} = 90 x2 = 3, f2 (6) = M ax{d2 = 0, 45 + 0 = 90} = 45 label = [45,3] x2 = 0, f2 (6) = M ax{d2 = 0, 0 + 0 = 0} = 0 label = [0,0] label = [90,6] At stage 1: x1 = 6, f1 (6) = M ax{d1 = 0, 90 + 0 = 90 : d1 = 1, 45 + 30 = 75 : d1 = 2, 0 + 60 = 60} = 90 label = [90,6] Thus from the last label the max return is 90 and the loading should be, zero tonnes of type 2, zero tonnes of type 2 and 6 tonnes of type 3. The path in the network is indicated in bold. Finally, though not specifically asked for, the optimization functional fi is given by the recurrence relation: fi (xi ) = max {fi+1 (xi+1 ) + di × ri } i = 1 . . . 3 (xi ,xi+1 ) f4 (x4 ) = 0 12. In Fig. E.20 the feasible region is OAP B. The maximal value of z is at one of the vertices of this polygon. The coordinates of P are given by: 2x1 + x2 = 4, x1 + 2x2 = 4 ⇒ x1 = x2 = 4 3 and the coordinates of A and B are (0, 2) and (2, 0) respectively. By direct evaluation or by drawing a test line for the objective function with some value of z, shown as z = 3 in Fig. E.20, the maximum value of z is at P . Thus the maximum value of z = 3 × 34 + 2 × 34 = 20 3 and is 4 attained at x1 = x2 = 3 . • The second and third constraints are binding. (used to find P above) • If x1 and x2 are in the feasible region then x1 + x2 ≤ 3, thus for δ ≥ 0, x1 + x2 ≤ 3 + δ. Thus P is still the maximal point and hence ∆z = 0. The ratio ∆z δ = 0 is the dual or shadow price corresponding to constraint (i). This is always zero if the constraint is not binding. APPENDIX E. SPECIMEN EXAM TYPE QUESTIONS AND SOLUTIONS 110 x2 4 3 x1 + 2x2 = 4 A 2 .... P .... .... z = 3 = 3x1 + 2x2 ..... .... .... B .... .... ... 2 O 4 x1 3 2x1 + x2 = 4 x1 + x2 = 3 Figure E.20: P has coordinates ( 43 , 34 ). 13. From Fig. E.21(a) the maximum value of z is at P . The coordinates of P and corresponding value of z are given by: x1 + x2 = 3, 2x1 + x2 = 4 ⇒ x1 = 1, x2 = 2 ⇒ z=7 The dual problem is: Minimize z = 3y1 + 4y2 subject to y1 + 2y2 ≥ 3, y1 + y2 ≥ 2 Note: You must be able to obtain the dual problem from the primal From Fig. E.21(b) the minimum value of z is at P . The coordinates of P and corresponding value of z are given by: y1 + 2y2 = 3, y1 + y2 = 2 ⇒ y1 = 1, y2 = 1 The optimum value in the dual and primal problems are the same. ⇒ z=7 APPENDIX E. SPECIMEN EXAM TYPE QUESTIONS AND SOLUTIONS x2 (a) y2 (b) 4 .... .... .... .... .... .... 2 A .... .... .... .... .... .... .... 3 .... 2 .... .... .... .... P .... .... .... .... y1 .... .... .... 2 3 B .. z = 10 = 3y1 + 4y2 y1 + y2 = 2 A z = 4 = 3x1 + 2x2.... 3 ... P ... ... ... ... ... ... ... ... ... ... ... B ... 2 . O y1 + 2y2 = 3 x1 3 2x1 + x2 = 4 111 x1 + x2 = 3 Figure E.21: Feasible region shown hashed in each case. (a) P has coordinates ( 43 , 34 ). Dotted test objective line with z = 3 (b) P has coordinates (1, 1). Dotted test objective line with z = 10 14. With x1 equal to the number of lectures given for the Maths Dept and x2 the number for the x2 (a) x1 + 1.5x2 = 19 15 y1 + 1.5y2 = 7 A 12 23 5 A 4 32 P 19 B O y2 (b) 15 P x1 + x2 = 15 19 B x1 5 O y1 y1 + y2 = 5 Figure E.22: Feasible region shown hashed in each case. (a) P has coordinates ( 43 , 34 ). Dotted test objective line with z = 3 (b) P has coordinates (1, 1). Dotted test objective line with z = 10 Act Sci Dept the primal problem is: Maximize z = 5x1 + 7x2 subject to x1 + x2 ≤ 15, x1 + 1.5x2 ≤ 19 x1 , x2 , ≥ 0 In Fig. E.22(a) the maximum value of z is at P (check by evaluating z at A, P and B or by drawing a test line). Thus the solution is: x1 + x2 = 15, x1 + 1.5x2 = 19 ⇒ x1 = 7, x2 = 8 ⇒ z = 5 × 7 + 7 × 8= 91 APPENDIX E. SPECIMEN EXAM TYPE QUESTIONS AND SOLUTIONS 112 Thus in any one week I should lecture 7hours for Maths and 8hours for Act Sci in order to give me a return of £91. The dual problem is given by; Minimize z = 15y1 + 19y2 such that y1 + y2 ≥ 5, y1 + 1.5y2 ≥ 7 y1 , y2 ≥ 0 In Fig. E.22(b) the minimum value of z is at P (check by evaluating z at A, P and B or by drawing a test line). Thus the solution is: y1 + y2 = 5, y1 + 1.5y2 = 7 ⇒ y1 = 1, y2 = 4 ⇒ z = 15 × 1 + 19 × 4= 91 Thus we see that the optimal values are the same for both the primal and dual problems. The interpretation of the dual is important. From the point of view of the employer they wish to cost out the lecturer’s job by paying so much an hour for an actual lecture (denote as y1 ) and so much for preparation (denote as y2 ), irrespective of in which department the work is undertaken. That is to say they wish to have a single policy for the whole institution. Since the lecturer has agreed to work in a given week a total of 15hrs actual lecture contact and 19hrs preparation the cost to the institution in a given week is z = 15y1 + 19y2 ; the new objective function for the dual problem, an amount the institution would like to minimize. In order to at least maintain the levels of payment to the lecturer the rates must be such that the payment for the work carried out in the Math Dept to deliver 1 lecture must be at least £5. Thus y1 + y2 ≥ 5. Similarly a single lecture in Act Sci department must generate at least £7, thus y1 + 1.5y2 ≥ 7. These are the two dual constraints. The solution is a little unrealistic in the sense that the rate for giving the lecture is only £1 /hr and for preparation it is £4/hr. µ ¶ −1 15. Set x1 = 0, this will yield a basic solution since the other two columns, namely and 1 µ ¶ 2 are independent. 1 Thus solve: µ ¶ µ ¶ µ ¶ −1 2 4 x2 +x3 = 1 1 1 Similarly x2 = 0 gives: µ ¶ µ ¶ µ ¶ 1 2 4 x1 +x3 = 2 1 1 and x3 = 0 gives: µ ¶ µ ¶ µ ¶ 1 −1 4 x1 +x2 = 2 1 1 ⇒ ⇒ ⇒ x3 = 5/3, x2 = −2/3, x1 = 0 not feasible since not all ≥ 0 x3 = 7/3, x1 = −2/3, x2 = 0 not feasible since not all ≥ 0 x2 = −7/3, x1 = 5/3, x3 = 0 not feasible since not all ≥ 0 APPENDIX E. SPECIMEN EXAM TYPE QUESTIONS AND SOLUTIONS 113 16. Introduce non-negative slack variables s1 and s2 to write the constraints in the form: x1 + x2 + x3 + s1 = 4 x1 − 2x2 + x3 + s2 = 3 x1 , x2 , x3 ≥ 0 The final tableau is given in Table 2. From the table the optimum solution is x1 = 3 23 , x2 = 13 , x3 = 0 and the maximum value of Basic Variables x1 2 x2 1 x3 1 s1 0 s2 0 d CB x2 1 0 1 0 1 3 − 31 1 3 x1 2 1 0 1 2 3 1 3 3 23 2 1 2 [ 53 ] [ 31 ] z= 0 0 −1 − 53 − 31 7 23 Table E.4: z = 7 23 . The dual variables are shown in Table 2 in the penultimate row of the table highlighted in square brackets. They are the entries corresponding to the slack, and if present artificial, variables; dual variables = 53 , 13 . Each of the coefficients in the objective function has a range of optimality, even if the variable is zero. Range of optimality for x1 is [1, ∞), for x2 it is [−4, 2] and for x3 it is (−∞, 2]. The feasible ranges for the righthand sides (b1 and b2 ) of the first two constraints are: ∆b1 ≥ −1 thus b1 ∈ [3, ∞) and − 11 ≤ ∆b2 ≤ 1 thus b2 ∈ [−8, 4] The dual problem is given by: Minimize z = 4y1 + 3y2 subject to y1 + y2 ≥ 2, y1 − 2y2 ≥ 1, y1 + y2 ≥ 1 y1 , y2 , ≥ 0 The solution to this is as above, that is to say y1 = 35 and y2 = 13 and the minimum value of z is 7 32 . In Fig. E.23 the optimal point can be shown to be at P by either calculating z at A and P and selecting the one that gives the smaller value of z or plot a test z line and see that as it moves parallel to itself it will first/last cut the feasible region at P. 17. Introducing non-negative, slack variable s1 , surplus variable s2 and artificial variable a1 the inequalities become: x1 + 2x2 − s1 + a1 = 6 (i) x1 + x2 + s2 = 4 (ii) APPENDIX E. SPECIMEN EXAM TYPE QUESTIONS AND SOLUTIONS 114 y2 ... ... ... ... ... ... . 2 .... y1 − 2y2 = 1 ... y1 + y2 = 1 ... ... ... ... 1 ... ... ... ... P ... ... ... A ... y1 ... ... 2 1 O y + y = 2 1 2 ... ... ... . z. = 6 = 4y1 + 3y2 Figure E.23: Feasible region shown hashed. Optimal point at P which has coordinates ( 53 , 31 ) giving z = 7 31 . Dotted test objective line shown with z = 6 I have reordered the equations so that the slack and artificial variables appear last and thus the body of the first Simplex tableau will be of the form (D I). The objective function is z = 2x1 + x2 + 0s1 + 0s2 − M a1 , the −M ensures that the artificial variable is forced to zero when maximizing. The optimal tableau is: Basic Variables x1 2 x2 1 s1 0 a1 −M s2 0 d CB x2 1 0 1 -1 1 −1 2 x1 2 1 0 1 −1 2 2 2 1 1 [−1] [3] z= 0 0 −1 −M + 1 −3 6 Table E.5: The optimal solution is that the minimum value of z is 6 with x1 = x2 = 2. The dual variables are given in the penultimate row in the columns corresponding to the artificial and slack variables, not to the surplus variable. Corresponding to equation (i) the dual variable is −1 and to equation (ii) it is +3. Range of optimality for the x1 coefficient is [0.5, ∞) and for x2 it is (−∞, 2]. The feasible range for the righthand side of (i) is [4, 8] and for (ii) it is [3, 6]. APPENDIX E. SPECIMEN EXAM TYPE QUESTIONS AND SOLUTIONS 115 18. The five inequalities and objective function, with the xi non-negative, are: 2x1 + x2 + x3 ≤ 35, 2x1 + 3x2 + x3 ≤ 60, 3x1 + x2 + 4x3 ≤ 40 x1 + x2 + x3 ≤ 30 3x1 + x2 ≤ 20 and z = 1250x1 + 1500x2 + 750x3 From the given data the optimum production is: Max z = £31, 429 attained by producing 0.714 tonnes of Milk Chocolate, 17.857 tonnes of Plain chocolate and 5 tonnes of Toffee. Shadow (dual) price is max for constraint (d) thus a small increase in this resource will yield the most profit. The maximum increase in this department consistent with this basic solution is 5units to 65. If xi = 0 in the optimal solution then the reduced cost corresponding to xi is the amount the coefficient of xi in the objective function needs to be changed so that there exists an optimal solution with xi 6= 0. In this problem all variables are non-zero thus no increase is needed, hence the reduced costs are all zero. The dual problem, with the yi non-negative, is to minimize: z = 35y1 + 40y2 + 30y3 + 60y4 + 20y5 subject to: 2y1 + 3y2 + y3 + 2y4 + 3y5 ≥ 1250, y1 + y2 + y3 + 3y4 + y5 ≥ 1500, y1 + 4y2 + y3 + y4 ≥ 750 The shadow variables (prices) are the solutions to the dual problem, thus: y1 = 0, y2 = 71.43, y3 = 0, y4 = 464.29, y5 = 35.71 The minimum value of z is of course the same as before, namely z = 31, 429 Appendix F Specimen Courseworks F.1 Coursework 1 - 2007 You should carefully define your variables and explain how you obtain relationships between them based on the information given. Although you will need to use Excel to carry out the linear programming I do not expect you to submit any of the work sheet, though you should submit a copy of any of the reports you use. 1. An investment advisor at Cash Services (CS) wants to develop a model that can be used to allocate investment funds among four alternatives: shares, bonds, mutual funds and cash. For the coming investment period, the company developed estimates of the annual rate of return and the associated risk for each alternative. Risk is measured using an index between 0 and 1, with higher risk values denoting more volatility and thus more uncertainty. Because cash is held in a money market fund, the annual return is lower, but it carries essentially no risk. The objective is to determine the portion of funds allocated to each investment alternative in order to maximize the total annual return for the portfolio subject to the risk level that the client is willing to tolerate. Investment Shares Bonds Mutual funds Cash Annual Rate of Return (%) 12 3 5 2 Risk 0.75 0.1 0.25 0.0 Table F.1: Annual returns and risk factor per investment Total risk is the sum of risk for all investment alternatives. For instance, if 40% of a client’s funds are invested in shares, 30% in bonds, 20% in mutual funds and 10% in cash, the total risk for the portfolio would be 0.40(0.75) + 0.30(0.1) + 0.20(0.25) + 0.1(0.0) = 0.38. The investment advisor will meet with each client to discuss the client’s investment objectives and to determine a maximum total risk value for the client. A maximum total risk value of less than 0.3 would be assigned to a moderate tolerance to risk; and a maximum total risk value greater than 0.5 to a more aggressive investor. 116 APPENDIX F. SPECIMEN COURSEWORKS 117 CS specifies additional guidelines that must be applied to all clients. Namely: • No more than 65% of the total investment may be in shares • The amount invested in mutual funds must be at least as much as invested in bonds. • The amount of cash must be at least 15%, but no more than 40% of the total investment funds. (a) Suppose the maximum risk value for a particular client is 0.3. What is the optimal allocation of investment funds among shares, bonds, mutual funds and cash? What is the annual rate of return and the total risk for the optimal portfolio? (b) Suppose the maximum risk value of a more conservative client is 0.15. What is the optimal allocation of investment funds for this client? What is the annual rate of return and the total risk for the optimal portfolio. (c) Another more aggressive client has a maximum risk value of 0.8. What is the optimal allocation of investment funds for this client? What is the annual rate of return and the total risk for the optimal portfolio. (d) Refer to the solution for the more aggressive client in part (c). Would this client be interested in having the investment advisor increase the maximum percentage allowed in shares or decrease the requirement that the amount of cash must be at least 15% of the funds invested? 2. Soft Things is a company making objects out of polystyrene. Next weeks schedule calls for the production of 80,000 small sandwich containers, 80,000 large sandwich containers and 65,000 meal containers. With the exception of the meal container, all these products can be processed on any one of three machines available. However the amount of waste produced varies from item to item and machine to machine. The amounts of waste are given in the following table; measured in milligrams per item. Machine Type M1 M2 M3 Small Sandwich 20 24 32 Large Sandwich 15 28 35 Meal − 18 36 Table F.2: The amount of waste per item measured in milligrams The time for each type of machine to produce each item also varies with machine and item; the following table gives the number of items produced on each machine per minute: The availability of each machine in the following week is 35 hours for machine M1, 35 hours for machine M2 and 40 hours for machine M3. (a) Costs reprocessing the waste have risen, thus Soft Things would like to minimize the total amount of waste produce. Formulate the linear programming model to determine the best production schedule. APPENDIX F. SPECIMEN COURSEWORKS Machine Type M1 M2 M3 118 Small Sandwich 30 45 60 Large Sandwich 25 40 52 Meal − 30 44 Table F.3: Production rates measured in items per minute (b) Solve the linear programming problem formulated in part (a). How much waste is produced? Which machines, if any, have idle production capacity? If you could increase the available time of production of any machine which would it be? F.2 Coursework 1 - 2007 Solution 1. Define the decision variables to be the proportions of each product in the portfolio as: x1 proportion of shares: ⇒ x1 ≤ 0.65 (F.1) x2 proportion of bonds; x3 proportion of mutual funds: ⇒ x3 ≥ x2 ⇒ x2 − x3 ≤ 0 (F.2) x4 proportion of cash: ⇒ 0.15 ≤ x4 ≤ 0.4 0.15 ≤ x4 (F.3) x4 ≤ 0.4 (F.4) The total risk constraint is given by: 0.75x1 + 0.1x2 + 0.25x3 ≤ 0.3 (F.5) and the fact that the variables are proportion and thus must sum to one: x1 + x2 + x3 + x3 = 1 (F.6) The objective function, which is the return on the investment is given by; z = 0.12x1 + 0.03x2 + 0.05x3 + 0.02x4 [7 marks ] (a) Running Solver for the above problem to maximize z gives, with rounding: Allocation of Funds: Shares 34% Bonds 13% Mutual 13% Cash 40% Return: 5.9% and Total risk: 0.3 [3marks ] APPENDIX F. SPECIMEN COURSEWORKS 119 (b) Changing the risk constraint in Eq(F.5) from 0.3 to 0.15 gives: Allocation of Funds: Shares 8% Bonds 26% Mutual 26% Cash 40% Return: 3.8% and Total risk: 0.15 [3 marks ] (c) Again changing the Risk in Eq(F.5), now from 0.3 to 0.8 gives: Allocation of Funds: Shares 65% Bonds 0% Mutual 20% Cash 15% Return: 9.1% and Total risk: 0.5375 [3 marks ] (d) For the data in (c) Fig. F.1 shows the spreadsheet and the Sensitivity and Answer Report from Excel. With reference to the constraints section note that the shadow price for constraint (1), which corresponds to shares, is 0.07 and the shadow price for constraint (3), corresponding to the lower limit on cash, is -0.03. Thus an increase in the level of allowed shares purchased gives an increase of 0.07 in the return. In terms of the units an increase of 0.1 in the allowed proportion of shares is an increase of 10% points which corresponds to an increase in the return of 0.7% points. Since the amount of cash is decreased then an increase of 0.03 is reflected in the return. Again in the units of the question if the lower limit is reduced by 0.1, that is to say 10% points, then the return is increased by 0.3% points. Thus the client may well be more interested in increasing the maximum percentage of shares in the portfolio rather than decreasing the lower restriction on the amount of cash. [5 marks ] [4 marks ] [Total 25 marks ] APPENDIX F. SPECIMEN COURSEWORKS Objective function z=cTx Constraints of the form Ax<=>b Objective Function row i 1 2 3 4 5 6 Value of (Ax)i Shares 0.65 Bonds/MF -0.2 Cash 0.15 Cash 0.15 Risk 0.5375 Prop=1 1 120 z 0.091 c1 0.12 c2 0.03 c3 0.05 c4 0.02 c5 c6 Variables x1 0.65 x2 0 x3 0.2 x4 0.15 x5 x6 a1 a2 columns of A a3 a4 a5 a6 0.65 1 0 0 0 0 0 1 -1 0 0.15 0 0 0 1 0.4 0 0 0 1 0.8 0.75 0.1 0.25 0 bi 1 1 1 1 1 Adjustable Cells x1 x2 x3 x4 Final Reduced Objective Allowable Allowable Value Cost Coefficient Increase Decrease 0.65 0 0.12 1E+30 0.07 0 -0.02 0.03 0.02 1E+30 0.2 0 0.05 0.07 0.02 0.15 0 0.02 0.03 1E+30 Name Shares Bonds/MF Cash Cash Risk Prop=1 Final Shadow Constraint Allowable Allowable Value Price R.H. Side Increase Decrease 0.65 0.07 0.65 0.2 0.65 -0.2 0 0 1E+30 0.2 0.15 -0.03 0.15 0.2 0.15 0.15 0 0.4 1E+30 0.25 0.5375 0 0.8 1E+30 0.2625 1 0.05 1 1.05 0.2 Cell $D$9 $E$9 $F$9 $G$9 Name Constraints Cell $B$14 $B$16 $B$18 $B$20 $B$22 $B$24 Figure F.1: Output form Solver for Question 1 with Risk set equal to 0.8 2. This problem needs a variable for the production of each type of box on each machine. In total this is eight variables, since the large meal box can not be produced on machine M1. The machines are already labelled 1 to 3, thus labelling the boxes, 1 - small, 2 - large and 3 meal, introduce the variables xi,j for the number of type i boxes produced on machine j. That is to say the labelling is xbox,machine . The requirement that 80,000 small boxes, 80,000 large boxes and 65,000 meal boxes are to be produce gives the following equations: x1,1 + x1,2 + x1,3 = 80000 (F.7) x2,1 + x2,2 + x2,3 = 80000 (F.8) x3,2 + x3,3 = 65000 (F.9) (F.10) APPENDIX F. SPECIMEN COURSEWORKS 121 From the time limitations of 2100 mins on machine 1, 2100 mins on machine 2 and 2400 mins on machine 3 and using the production data gives: x1,1 x2,1 + 30 25 ≤ 2100 (F.11) x1,2 x2,2 x3,2 + + 45 40 30 ≤ 2100 (F.12) x1,3 x2,3 x3,3 + + 60 52 44 ≤ 2400 (F.13) Using the waste details gives the objective function z, which is to be minimized, is given as: z = 20x1,1 + 24x1,2 + 32x1,3 +15x2,1 + 28x2,2 + 35x2,3 (F.14) +18x3,2 + 36x3,3 [7 marks ] Fig. F.2 shows the spreadsheet and the reports. The results are: 80,000 small boxes on machine 3 52,500 large boxes on machine 1, and 27,500 large boxes on machine 3 63,000 meal boxes on machine 2 and 2000 meal boxes on machine 3. The total waste is 5,516,000mg ≈ 5.5kg [6 marks ] From the output the constraints on Machine 3 is not binding. [1 mark ] Looking at the shadow prices for M1 and M2, if the available time on M2 is increased by 1 the amount of waste is decreased by 540, which is more than the 500 for a similar increase in the available time on M1. Hence make more time available on M2. [3 marks ] APPENDIX F. SPECIMEN COURSEWORKS constraints Availability Use X11 122 X12 M1 M2 M3 Demand 1 Demand 1 Demand 3 2100 2100 2400 80000 80000 65000 2100 2100 1907.634033 80000 80000 65000 x11 0.000 x12 0.000 x13 80000.000 c1 20 c2 24 Name x11 x12 x13 x21 x22 x23 x32 x33 Final Value 0.000 0.000 80000.000 52500.000 0 27500 63000 2000.000005 Reduced Cost 4.667 4.000 0.000 0.000 6.5 0 0 0 Obj Coft 20 24 32 15 28 35 18 36 Final Value 2100 2100 1907.634033 80000 80000 65000 Shadow Price -500 -540 0 32 35 36 R.H. S 2100 2100 2400 80000 80000 65000 z 5516000 Cell $A$12 $B$12 $C$12 $D$12 $E$12 $F$12 $G$12 $H$12 Cell $C$3 $C$4 $C$5 $C$6 $C$7 $C$8 Cell $A$16 Cell $A$12 $B$12 $C$12 $D$12 $E$12 $F$12 $G$12 $H$12 Cell $C$3 $C$4 $C$5 $C$6 $C$7 $C$8 Name M1 Use M2 Use M3 Use Demand 1 Demand 1 Demand 3 Name z Name x11 x12 x13 x21 x22 x23 x32 x33 Name M1 Use M2 Use M3 Use Demand 1 Demand 1 Demand 3 Objective Function c3 c4 32 15 Orig Value 6862363.636 Orig Value 20136.364 4500.000 55363.636 0.000 80000 0 0 65000 Cell Value 2100 2100 1907.634033 80000 80000 65000 X13 0.0333333 0 0 0 0.0222222 0 0 0 0.0166667 1 1 1 0 0 0 0 0 0 Variables x21 x22 x23 52500.000 0 27500 c5 28 X21 X22 X23 X32 X33 0.04 0 0 0 1 0 0 0 0 0 0.03 0 0.03 0 0 0.02 0 0.02 0 0 0 0 1 1 0 0 0 0 1 1 x32 63000 x33 2000 c6 35 c8 18 c9 36 Max Max Increase Decrease 1E+30 4.666667 1E+30 4 4 1E+30 5.6 1E+30 1E+30 6.5 6.5 5.6 6 1E+30 1E+30 6 Max Increase 1100 66.666667 1E+30 29541.958 25603.03 21664.103 Max Decrease 1024.121 722.1368 492.366 80000 27500 2000 Fin Value 5516000 Fin Value 0.000 0.000 80000.000 52500.000 0 27500 63000 2000 Formula Status Slack $C$3<=$B$3 Binding 0 $C$4<=$B$4 Binding 0 $C$5<=$B$5Not Binding 492.36597 $C$6=$B$6 Not Binding 0 $C$7=$B$7 Not Binding 4.657E-06 $C$8=$B$8 Not Binding 0 Figure F.2: Output form Solver for Question 2 [3 marks ] [Total 20 marks ] APPENDIX F. SPECIMEN COURSEWORKS F.3 123 Coursework 2 - 2007 1. Obtain all feasible basic solutions for the equations −x1 + x2 + x3 + x4 = 1 x1 − x2 + x3 + x4 = 1 x1 + x2 − x3 + x4 = 1 The following two questions must be done using the Simplex Tableau method with the relevant tableaus at each stage being submitted. 2. Using the Simplex Method maximize z = 3x1 + x2 + 2x3 subject to x1 + x2 + 2x3 ≤ 4 (i) 2x1 + x2 − x3 ≤ 2 (ii) From your final tableau: (a) Find the dual prices of (i) and (ii) (b) Find the feasible range for the righthand sides of (i). (c) Find the optimal ranges for the coefficient of x1 in z. 3. Using the Simplex Method find the maximum value of z = x1 + 3x2 subject to x1 + x2 ≥ 3 (i) x1 + 2x2 ≤ 4 (ii) As in question 2 find the dual prices, feasible range for constraint (i) and range of optimality for the x1 objective function coefficient. F.4 Coursework 2 - 2007 Solution 1. To form a basic solution select in turn 3 independent columns and solve with the fourth variable equal to zero. In this example it is possible to do this in exactly 4 ways. The number of ways may be less than this if one selection of columns is not independent - this can happen, but not here. Select the first three columns and row reduce to make the first three columns become the identity. (If this had turned out not to be possible then the three columns would not have been independent and thus would not have yielded a basic solution. Remedy - try a different combination of three columns.) 1 0 0 1 1 −1 1 1 1 1 1 −1 1 1 1 → 0 1 0 1 1 ⇒ x4 = 0, and x1 = x2 = x3 = 1 1 1 −1 1 1 0 0 1 1 1 APPENDIX F. SPECIMEN COURSEWORKS Next select columns 2,3 to give: 1 −1 −1 124 and 4. Thus continue to row reduce to make col4 into the old column 1 0 0 1 1 1 0 0 0 0 1 0 0 ⇒ x1 = 0, and x2 = x3 = 0, x4 = 1 Next select columns 1,2 and 4. Continue to row reduce to make col1 into the old column 3 to give: 0 0 1 1 1 0 1 −1 0 0 ⇒ x3 = 0, and x1 = x2 = 0, x4 = 1 1 0 −1 0 0 Finally select columns 1,3 to give: 0 1 0 −1 1 −1 and 4. Continue to row reduce to make col 3 into the old column 2 0 1 1 1 0 0 0 0 0 ⇒ x2 = 0, and x1 = x3 = 0, x4 = 1 In each case the solution underlined is the variable that is set equal to zero, the non-basic variable. With regard to Linear Programming all solutions are feasible since greater or equal to zero, however with the exception of the first they are all degenerate since in each case at least one of the basic variables is zero. 2. Write as x1 + x2 + 2x3 + s1 = 4 2x1 + x2 − x3 + s2 = 2 with slack variables s1 , s2 ≥ 0. The objective function is now z = 3x1 + x2 + 2x3 + 0s1 + 0s2 To form the simplex tableau always order your variables with the slack and artificial variable last. This then gives the standard form (D I) in the body of the table. Since this is a maxi- Basic Var s1 s2 zj ∆z cj 0 0 x1 3 1 2 0 3 x2 1 1 1 0 1 x3 2 2 -1 0 2 s1 0 1 0 0 0 s2 0 0 1 0 0 d d a 4 2 z= 0 4 1 Table F.4: mization problem keep row reducing etc until the final row is non-positive. In the final row 3 is the largest value so bring in x1 into the basic set. Form the ratio of the d column with column 1 and place in the last column. Since 1 is the smallest non-negative value in the final column take s2 out of the basic set. APPENDIX F. SPECIMEN COURSEWORKS Basic Var s1 x1 125 x2 1 x3 2 s1 0 s2 0 d cj x1 3 d a 0 3 0 1 1 2 1 2 3 2 5 2 − 12 1 0 − 21 3 1 6 5 − 32 7 2 0 0 − 23 zj ∆z 3 0 − 12 1 2 3 2 −2 z= 3 Table F.5: Basic Var x3 x1 x2 1 x3 2 s1 0 s2 0 d cj x1 3 2 3 0 1 1 5 3 5 11 5 − 65 1 0 2 5 1 5 7 5 − 51 6 5 8 5 zj ∆z 3 0 2 0 2 5 4 5 − 75 d a z= 7 15 − 54 Table F.6: Since the final row in Table F.6 is all non-positive the optimum is reached. At the optimum: x1 = 85 , x2 = 0, x3 = 65 Maximum value of objective function z = 7 15 Dual prices 57 for the first constraint and 54 for the second. For a change of δ in the righthand side of (i) the feasible range is obtained by solving: µ 6 ¶ µ 2 ¶ 5 5 +δ ≥ ⇒ δ ≥ −3 8 1 5 5 Thus the feasible range for the rhs of (i) is [1, ∞). To find the range of optimality of the cj coefficient in the objective function replace in turn in the optimal table their numerical values with α. Recalculate the final table with α and find the range of values of α that ensure the final row remains non-positive. For the x1 coefficient the final row becomes: ∆z 0 − 3α 5 + 3 5 0 − α5 − 4 5 − 2α 5 + 2 5 12 5 + 8α 5 Thus to remain optimal entries ≤ 0 thus: 1 ≤ α, −4 ≤ α, α≥1 ⇒ 1≤α 3. Since the constraints are not all ’less than’ it is necessary to introduce surplus variables as well as slack variables into the problem. This enables the constraints to be written as equations. APPENDIX F. SPECIMEN COURSEWORKS 126 Additionally since we are to solve using the Simplex method, which starts at the origin, it will be necessary to introduce an artificial variable a1 to help provide an initial feasible solution. The final solution should not contain the artificial variable (ie it should be zero), in order to force this variable to zero an extra term is introduced into the objective function. Since this is a maximization problem we introduce −M a1 into z, where M is arbitrarily large and positive. Thus the problem becomes: x1 + 2x2 + s2 = 4, x1 + x2 − s1 + a1 = 3, z = x1 + 3x2 − M a1 Where s2 , s1 , a1 are all ≥ 0. Note s2 is the slack variable, s1 the surplus variable and a1 the artificial variable. When forming the tableau order the variables so that the slack and artificial variables are last, this gives a standard display of the form (D I). As M is large and positive, 3 + M is the maxix2 3 s1 0 s2 0 a1 −M d cj x1 1 d a 0 −M 1 1 2 1 0 −1 1 0 0 1 4 3 2 3 −M 1+M −M 3+M M −M 0 0 −M 0 z= −3M Basic Var s2 a1 zj ∆z Table F.7: mum value in the final row, thus bring x2 into the basic set. Form the ratio of the d with the x2 column and select the smallest non-negative value to take out of the basic set.(these value are in the final column) In this case s2 . Since M is positive and large, − 21 + M is the largest positive Basic Var x2 a1 zj ∆z x2 3 s1 0 s2 0 a1 −M d cj x1 1 d a 3 −M 1 2 1 2 1 0 0 −1 1 2 0 1 2 1 4 2 −M 2 − 12 + M 2 3 0 M −M −M 0 z= 6−M 3 2 − 12 3 M 2 + 2 − 32 − M 2 Table F.8: value in the final row, thus bring x1 into the basic set. APPENDIX F. SPECIMEN COURSEWORKS 127 In Table F.9 the final row is ≤ 0 thus the problem is optimal: Basic Var x2 x1 zj ∆z x2 3 s1 0 s2 0 a1 −M d cj x1 1 3 1 0 1 1 0 1 −2 1 −1 −1 2 1 2 1 0 3 0 1 −1 2 −2 −1 −M + 1 z= 5 d a Table F.9: Optimal solution; x1 = 2, x2 = 1, z = 5. Dual prices are 2 and −1 for (ii) and (i) respectively. The calculation of the feasible ranges of the rhs of the first constraint equation and the range of optimality for the x1 coefficient in the objective function are calculated as before. Remember M can be as large as you like so doesn’t restrict any of the inequalities. Range for the rhs of (i) is [2, 4] Range of optimality for the x1 coefficient is (−∞, 23 ]. F.5 Coursework 1 - 2008 You should carefully define your variables and explain how you obtain relationships between them based on the information given. I have extended the worksheet on my web site so that question 1 can be entered without any major changes to the sheet. I do not expect you to submit any of the work sheet, though you may, as you see fit, wish to submit a copy of any of the reports you used Use the current worksheet on my website to solve the linear programming problems 1. City University has just closed its early retirement scheme and at the close of the voluntary sign up period many of the employees had elected for early retirement. Members have signed up for immediate retirement or at some time in the near future. The following table gives the amount of cash that is required at the start of each year to meet the retirement packages. year required funds 1 500 2 200 3 250 4 220 5 200 6 180 7 200 8 250 Table F.10: The amounts, in thousands of pound, required at start of each year The finance officer has to decide how much to set aside to meet the 8 financial obligations as they become due. The full amount required is to be invested at the start of the process in three types APPENDIX F. SPECIMEN COURSEWORKS 128 of government bonds or placed in a cash account earning 4% per annum. (note that this means the first payment of £500k has to be made before any bonds or deposit are made.) In subsequent years the amount of cash on deposit may be changed but only by using the income from the initial investments, not by injecting more cash; similarly no more bonds can be purchased. The available bonds are: Bond 1 2 3 Price £ 115 100 135 Annual Rate % 8.5 5.5 11.5 Years to Maturity 5 6 7 Table F.11: Present purchase price of three types of bond with par value of £100 and variable maturity dates. The interest is paid at the end of each year at the given rate applied to the par value. The government bonds have a par value of £100 which means that on maturity they pay out £100. The rates are based on the par values and are paid at the end of each year. Using the following set of variables formulate the linear programming problem to minimise the amount of funds that the finance officer needs to initially invest in bonds and cash deposit. T the total amount in thousands of pounds to be initially invested. b1 , b2 and b3 the number of bonds of each type to be purchased. si i = 1 . . . 8 the amount held as cash deposit at the start of each year. Note: s1 is the amount placed on deposit at the start of the first year. s2 will be the total amount on deposit at the start of the second year, money having been added or subtracted from the deposit account after paying out the retirees. etc etc. s8 represents any money left over at the end of the process. • Run solver and obtain Sensitivity and Answer reports. • From your output determine the amount of bonds of each type that should be purchase and the initial level of cash deposit. (it will be necessary to round up the bond variables since it is not possible to purchase part of a bond. However this will not involve lots of extra cash as the bonds are only £100 at par. Thus although this may not be the optimal solution is will not be far off.) • Determine the amount T to be initially invested using the rounded values of bi . • Use the dual (shadow) value to determine the increase in T that would have to be made if the amount due at the start of year 8 was in fact £300k • What is the present day value of £1 of pension paid out at the start of year 5 using this investment scheme. • Write down the ranges of optimality for the prices of the three types of bond. 2. An investment advisor at Cash Services (CS) wants to develop a model that can be used to allocate investment funds among four alternatives: shares, bonds, mutual funds and cash. For the coming investment period, the company developed estimates of the annual rate of return and the associated risk for each alternative. Risk is measured using an index between 0 and APPENDIX F. SPECIMEN COURSEWORKS 129 1, with higher risk values denoting more volatility and thus more uncertainty. Because cash is held in a money market fund, the annual return is lower, but it carries essentially no risk. The objective is to determine the portion of funds allocated to each investment alternative in order to maximize the total annual return for the portfolio subject to the risk level that the client is willing to tolerate. Investment Shares Bonds Mutual funds Cash Annual Rate of Return (%) 7 5 4 3 Risk 0.8 0.2 0.3 0.0 Table F.12: Annual returns and risk factor per investment Total risk is the sum of risk for all investment alternatives. For instance, if 40% of a client’s funds are invested in shares, 30% in bonds, 20% in mutual funds and 10% in cash, the total risk for the portfolio would be 0.40(0.8) + 0.30(0.2) + 0.20(0.3) + 0.1(0.0) = 0.44. The investment advisor will meet with each client to discuss the client’s investment objectives and to determine a maximum total risk value for the client. A maximum total risk value of less than 0.3 would be assigned to a moderate tolerance to risk; and a maximum total risk value greater than 0.5 to a more aggressive investor. CS specifies additional guidelines that must be applied to all clients. Namely: • No more than 60% of the total investment may be in shares • The amount invested in mutual funds must be at least as much as invested in bonds. • The amount of cash must be at least 15%, but no more than 30% of the total investment funds. (a) Suppose the maximum risk value for a particular client is 0.4. What is the optimal allocation of investment funds among shares, bonds, mutual funds and cash? What is the annual rate of return and the total risk for the optimal portfolio? (b) Suppose the maximum risk value of a more conservative client is 0.18. What is the optimal allocation of investment funds for this client? What is the annual rate of return and the total risk for the optimal portfolio. (c) Another more aggressive client has a maximum risk value of 0.7. What is the optimal allocation of investment funds for this client? What is the annual rate of return and the total risk for the optimal portfolio. (d) Refer to the solution for the more aggressive client in part (c). By looking at the dual values would this client be interested in having the investment advisor increase the maximum percentage allowed in shares or decrease the requirement that the amount of cash must be at least 15% of the funds invested? APPENDIX F. SPECIMEN COURSEWORKS F.6 130 Coursework 1 - 2008 Solutions 1. The linear programming problem is: Minimize T given by: T = 0.115b1 + 0.100b2 + 0.135b3 + 500 + s1 [2 marks] The funds available to pay out the retirees at the start of all but the first year are generated from the cash investment plus the return on the bonds, any surplus being put back into the cash investment. Thus: 200 = 250 = 220 = 200 = 180 = 200 = 250 = 0.0085b1 0.0085b1 0.0085b1 0.0085b1 0.1085b1 + + + + + 0.0055b2 0.0055b2 0.0055b2 0.0055b2 0.0055b2 0.1055b2 + + + + + + 0.0115b3 0.0115b3 0.0115b3 0.0115b3 0.0115b3 0.0115b3 0.1115b3 + + + + + + + 1.04s1 − s2 1.04s2 − s3 1.04s3 − s4 1.04s4 − s5 1.04s5 − s6 1.04s6 − s7 1.04s7 − s8 Note that after 5 years, at the start of year 6 when the finance officer has to find 180 the bonds of type 1 mature, hence the 0.1085b1 term; after that date they obviously give no more income.Similary the other two bonds mature over the next two years. [4 marks ] Target Cell (Min) Cell Name $C$5 Function z Final Value 1743.802639 Adjustable Cells Cell $D$9 $E$9 $F$9 $G$9 $H$9 $I$9 $J$9 $K$9 $L$9 $M$9 $N$9 Name b1 b2 b3 S1 S2 S3 S4 S5 S6 S7 S8 Final Value 1337.63 1651.33 2242.15 622.15 493.27 309.24 147.85 0.00 0.00 0.00 0.00 Reduced Cost 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.05 0.03 0.01 0.68 Objective Coefficient 0.115 0.1 0.135 1 0 0 0 0 0 0 0 Allowable Increase 0.0050332 0.00290226 0.00092113 0.27781572 0.36339059 0.53467197 1.04877964 1E+30 1E+30 1E+30 1E+30 Allowable Decrease 0.002944538 0.000818616 0.076078214 0.041931736 0.043264889 0.044744369 0.046394321 0.048244502 0.028610001 0.008591699 0.682315823 Name Yr 2 Yr 3 Yr 4 Yr 5 Yr 6 Yr 7 Yr 8 Final Value 200 250 220 200 180 200 250 Shadow Price 0.961538 0.924556 0.888996 0.854804 0.775538 0.718200 0.682316 Constraint Allowable Allowable R.H. Side Increase Decrease 200 1E+30 647.0376489 250 1E+30 513.005558 220 1E+30 321.6121835 200 1E+30 153.7630739 180 1962.74041 145.1329352 200 2783.91358 174.2152466 250 1484.55217 250 Constraints Cell $B$14 $B$16 $B$18 $B$20 $B$22 $B$24 $B$26 Table F.13: [3 marks ] APPENDIX F. SPECIMEN COURSEWORKS 131 Table F.13 shows the sensitivity and relevant part of the answer reports. From the table we deduce: • The finance officer should purchase 1338 bonds of type 1, 1652 bonds of type 2 and 2243 bonds of type 3, these being the final values of b1 , b2 and b3 . The initial cash invested is the value of S1 and is £622,150. [2 marks ] • Using the rounded bi values above the value of T is given by £1,744,025 [2 marks ] • Since the shadow (dual) price of S8 is 0.682316 to increase the payment at the start of the last year by £50,000 the value of T must be increased by 50000 × 0.682316 = £34, 115.80. [2 marks ] • The present day value of $1 at the start of year 5 is the dual value for that equation which is 0.854804. Thus an initial investment of 85p would raise and extra pound at the start of year 5. Thus we can think of the 85p as being the present day value of the £1 at year 5. [2 marks ] • From the allowable increase and decrease of the objective coefficients for the prices of the bonds we have that the optimal ranges for the prices of the bonds are given by (working with the data and then converting to £): – For b1 optimal range = [0.115 − 0.00294, 0.115 + 0.00503] ∼ [£112.06, £120.03] – For b2 optimal range = [0.1 − 0.00082, 0.1 + 0.00290] ∼ [£99.18, £102.90] – For b3 optimal range = [0.135 − 0.076078, 0.135 + 0.00092] ∼ [£58.92, £135.92] [3 marks ] 2. Let Xs be the proportion of shares purchased, Xm the proportion of mutual funds, Xb the proportions of bonds and Xc the proportion of cash. This immediately gives the constraint that: Xs + Xb + Xm + Xc = 1 The risk, which we will vary, will always be less than or equal to some value r, say. Thus: Risk = 0.8Xs + 0.2Xb + 0.3Xm ≤ r [3 marks ] The constraints imposed by the firm are: Xs ≤ 0.6 Xb − Xm ≤ 0 Xc ≤ 0.3 Xc ≥ 0.15 The return on the investment, which is the objective function, is given by: Return = z = 0.07Xs + 0.05Xb + 0.04Xm + 0.03Xc [5 marks ] With reference to the embolded items in Table F.14(a)(b) and TableF.15(c)(d): APPENDIX F. SPECIMEN COURSEWORKS 132 (a) From Table F.14(a) where the risk ≤ 0.4: z = 0.0513 thus the return is 5.13% and the final values of the four variables give that the portfolio should contain 34% shares, 25.5% bonds, 25.5% mutual funds and 15% cash. The client is exposed to the maximum risk of 0.4. [3 marks ] (b) From Table F.14(b) where the risk ≤ 0.18: z = 0.0408 thus the return is 4.08% and the portfolio should contain no shares, 36% bonds, 36% mutual funds and 28% cash. The client is exposed to the maximum risk of 0.18. [3 marks ] (c) From Table F.15(c) where the risk ≤ 0.7: z = 0.05775 thus the return is 5.78% and the portfolio should contain 60% shares, 12.5% bonds, 12.5% mutual funds and 15% cash. The client is exposed to a risk of 0.5425. [3 marks ] (d) The dual value for the limit on shares is 0.025 Thus dual variable for the lower bound for the cash limit is −0.015. The minus sign is because an increase in the lower limit will tend to drive the return down. Thus decreasing the lower limit will drive the return up. As 0.025 > 0.015 it is more advantageous to increase the limit on the number of shares rather than decrease the lower cash limit. [3 marks ] APPENDIX F. SPECIMEN COURSEWORKS 133 (a) Cell $C$5 Name riginal Valu Final Value Function z 0.19 0.051273 Cell $D$9 $E$9 $F$9 $G$9 Name Xs Xb Xm Xc Cell $B$14 $B$16 $B$18 $B$20 $B$22 $B$24 Name Risk Shares Mut/Bnd Cash> Cash< Sum=1 riginal Valu Final Value 1.00 0.341 1.00 0.255 1.00 0.255 1.00 0.150 Cell Value 0.4 0.340909 0 0.15 0.15 1 Formula Status Slack $B$14<=$CBinding 0 $B$16<=$CNot Binding 0.259091 $B$18<=$CBinding 0 $B$20>=$CBinding 0 $B$22<=$CNot Binding 0.15 0 $B$24=$C$Binding (b) Cell $C$5 Name riginal Valu Final Value Function z 0.051273 0.0408 Cell $D$9 $E$9 $F$9 $G$9 Name Xs Xb Xm Xc Cell $B$14 $B$16 $B$18 $B$20 $B$22 $B$24 Name Risk Shares Mut/Bnd Cash> Cash< Sum=1 riginal Valu Final Value 0.34 0.000 0.25 0.360 0.25 0.360 0.15 0.280 Cell Value 0.18 0 0 0.28 0.28 1 Formula Status $B$14<=$CBinding $B$16<=$CNot Binding $B$18<=$CBinding $B$20>=$CNot Binding $B$22<=$CNot Binding $B$24=$C$Not Binding Slack 0 0.6 0 0.13 0.02 0 Table F.14: F.7 Coursework 2 - 2008 Attempt at LEAST ONE Question I will mark all that you submit and credit you with your best mark. If you choose to only submit one of the questions I do urge you to try the other question. Solutions to this and the first coursework will become available on my website. 1. (a) Obtain all the basic solutions for the equations: −x1 + x2 + x3 + x4 = 1 x1 − x2 + x3 + 2x4 = 1 x1 + x2 − x3 + x4 = 2 Hence if additionally x ≥ 0 say which of the basic solutions are feasible. (b) This questions must be done using the Simplex Tableau method with the relevant tableaus at each stage being submitted. Using the Simplex Method maximize z = 3x1 + x2 + 2x3 subject to APPENDIX F. SPECIMEN COURSEWORKS 134 (c) Cell $C$5 Name riginal ValuFinal Value Function z 0.05775 0.05775 Cell $D$9 $E$9 $F$9 $G$9 Name Xs Xb Xm Xc riginal ValuFinal Value 0.60 0.600 0.12 0.125 0.12 0.125 0.15 0.150 Cell $B$14 $B$16 $B$18 $B$20 $B$22 $B$24 Name Risk Shares Mut/Bnd Cash> Cash< Sum=1 Cell Value 0.5425 0.6 0 0.15 0.15 1 Name Risk Shares Mut/Bnd Cash> Cash< Sum=1 Final Value 0.5425 0.6 0 0.15 0.15 1 Formula Status $B$14<=$CNot Binding $B$16<=$CBinding $B$18<=$CBinding $B$20>=$CBinding $B$22<=$CNot Binding $B$24=$C$Not Binding Slack 0.1575 0 0 0 0.15 0 (d) Cell $B$14 $B$16 $B$18 $B$20 $B$22 $B$24 Shadow Constraint Allowable Allowable Price R.H. Side Increase Decrease 0 0.7 1E+30 0.1575 0.025 0.6 0.25 0.6 0.005 0 0.25 0.25 -0.015 0.15 0.15 0.15 0 0.3 1E+30 0.15 0.045 1 0.63 0.25 Table F.15: x1 + x2 + x3 ≤ 3 (i) 2x1 + x2 + x3 ≤ 5 (ii) From your final tableau: i. Find the dual prices of (i) and (ii) ii. Find the feasible range for the righthand sides of (i). iii. Find the optimal ranges for the coefficient of x1 in z. 2. (a) City University wishes to develop a strategy for replacing its computers in one of its computing labs over a six year period. The cost of replacing the computers in a lab is given in Table F.16. The University’s policy is that it will run a computer for at least two years but for not more than 5. Assuming that the lab is renewed in 2008 you are asked, using the following method, to find the minimum replacement cost and associated strategy such that at the end of the six year period the lab is again renewed (ie at the start of 2014). To solve this problem: • Represent the data and all possible replacement strategies by a network, stating clearly the meaning a node and an edge. • Your network should be such that the solution to your problem is found by identifying a shortest route through the network. Use Dijkstra’s method to identify the shortest route. APPENDIX F. SPECIMEN COURSEWORKS lab replaced at start of 2008 2010 2011 2012 135 Replacement cost (£) for given years of use 2 3 4 5 20,000 22,000 23,000 25,000 21,000 23,000 24,250 − 22,000 23,250 − − 23,500 − − − Table F.16: The figures show the cost of replacing a lab after a given number of year of use as a function of the year of its purchase. (b) In order to distribute its services a cable company wishes to link up eight towns. The cost of links between the towns is given in Table F.17. Not all towns can be linked directly to each other owing to various physical obstructions, hence the table contains blank entries. Also the table is symmetric, indicating that the cost of linking two towns does not depend on the direction in which the cabling is carried out. Cables carry two-way traffic and only one cable is necessary to form a direct link between two towns. Draw a network representing the towns and costs and hence using Kruskal’s algorithm construct a minimal spanning tree for the network. Write down the minimum cost of linking the towns and draw the minimal configuration. Towns 1 2 3 4 5 6 7 8 1 3 2 1 2 3 1 4 3 2 2 3 4 1 1 2 2 3 3 2 5 6 7 8 4 3 2 3 1 1 3 2 5 5 2 2 Table F.17: Towns are labeled 1 - 8. The cost of possible links is shown in £10,000 (c) Given a Euclidean space E, define what is meant by: • L is a line segment of E • C is a convex subset set of E. • Show that the set of all elements x ∈ E such that for a matrix A and vector b, Ax ≤ b, is a convex subset of E. F.8 Coursework 2 - 2008 Solutions 1. (a) You need to row reduce to produce the three standard basis vectors in three of the columns to start this problem of, and give the first basic solution. I decided to use the first three APPENDIX F. SPECIMEN COURSEWORKS columns for my first basic solution. −1 1 1 1 −1 1 1 1 −1 −1 1 0 −1/2 0 0 1 3/2 0 1 0 1 136 That is to say x4 1 1 −1 2 1 0 → 1 2 0 0 −1 1 0 → 3/2 0 is set equal to zero. 1 1 1 1 0 2 3 2 → 2 0 2 3 0 0 −3/2 −3/2 0 1 3/2 1 1 0 1 3/2 Note that I have created the second standard basis vector in column 3 rather than column 2. This was because of the zero in row2-col2. I’ve also not bothered to multiply row 1 by minus 1 since the solution is still immediate. Thus with x4 = 0 the first basic solution is: x1 = 3/2, x2 = 3/2, x3 = 1 and the non-basic variable x4 = 0 feasible Now that we have the standard basis columns in the matrix its a simple matter of row reduction to move them about. −1 3/2 0 0 3/4 Take x2 out of the basic set and bring x4 in → 0 −3/2 1 0 −5/4 0 1 0 1 3/2 Thus with x2 = 0 the basic solution is: x1 = −3/4, x3 = −5/4, x4 = 3/2 and the non-basic variable x2 = 0 not feasible. −1 0 1 0 −1/2 1 0 −5/4 Take x3 out of the basic set and bring x2 in → 0 −3/2 0 0 2/3 1 2/3 Thus with x3 = 0 the basic solution is: x1 = 1/2, x2 = 5/6, x4 = 2/3 and the non-basic variable x3 = 0 feasible. −1 0 1 0 −1/2 Take x1 out of the basic set and bring x3 in → 1 −3/2 0 0 −3/4 2/3 0 0 1 1 Thus with x1 = 0 the basic solution is: x2 = 1/2, x3 = −1/2, x4 = 1 and the non-basic variable x1 = 0 not feasible. Note that I haven’t bothered to multiply row 2 by −2/3 to create a 1 in column 2, and hence create a standard basis element as a column...not really necessary for this problem but in the next problem where we are using the Simplex method it is important to reduce completely to get the standard basis elements in the columns (b) Introducing the slack variables s1 and s2 the constraints become: x1 + x2 + x3 + s1 = 3 2x1 + x2 + x3 + s2 = 5 and the objective function, which is to be maximized, is: z = 3x1 + x2 + 2x3 + 0s1 + 0s2 Thus the first simplex tableau is: APPENDIX F. SPECIMEN COURSEWORKS Basic Var s1 s2 zj ∆z cj 0 0 x1 3 1 2 0 [3] x2 1 1 1 0 1 137 x3 2 1 1 0 2 s1 0 1 0 0 0 s2 0 0 1 0 0 d d a ratio 3 5 z= 0 3 [5/2] Table F.18: Bring in x1 , since 3 is the largest positive number on the last row. Take out s2 since 5/2 is the smallest non-negative number in the ratio column. Since we are bringing in x1 and taking out s2 row µ reduce ¶ to make the first column of the 0 coefficient matrix inside the double lining equal to . 1 Basic Var s1 x1 zj ∆z cj 0 3 x1 3 0 1 3 0 x2 1 1/2 1/2 3/2 −1/2 x3 2 1/2 1/2 3/2 [1/2] s1 0 1 0 0 0 s2 0 −1/2 1/2 3/2 −3/2 d d a ratio 1/2 5/2 z= 15/2 [1] 5 Table F.19: Bring in x3 , since 1/2 is the largest positive number on the last row. Take out s1 since 1 is the smallest non-negative number in the ratio column. Since we are bringing in x3 and taking out s1 row reduce µ ¶ to make the third column of the 1 coefficient matrix inside the double lining equal to . 0 Basic Var x3 x1 zj ∆z cj 2 3 x1 3 0 1 3 0 x2 1 1 0 2 −1 x3 2 1 0 2 0 s1 0 2 −1 (1) −1 s2 0 −1 1 (1) −1 d d a ratio 1 2 z= 8 Table F.20: Bring in x3 , since 1/2 is the largest positive number on the last row. Take out s1 since 1 is the smallest non-negative number in the ratio column. Since the final row consists of zeros and negative numbers and this is a maximization problem the tableau is optimal. The optimal solution is x1 = 2, x2 = 0 and x3 = 1 with a maximum z equal to 8. i. The dual variables are in the penultimate row in the columns corresponding to the slack variables and if present the artificial variables. Thus in this problem the dual variable are both equal to 1. APPENDIX F. SPECIMEN COURSEWORKS 138 ii. The feasible range of the righthand side of the first constraint is given by solving: µ ¶ µ ¶µ ¶ 1 2 −1 δ + ≥ 0 ⇒ −1/2 ≤ δ ≤ 2 2 −1 1 0 Thus since the original righthand side of the first constraint is 3 the feasible range for this value is [5/2, 5]. iii. To find the optimal range for the coefficient of x1 in the objective function we use the optimal tableau this coefficient replaced with α. Basic Var x3 x1 zj ∆z cj 2 α x1 α 0 1 α 0 x2 1 1 0 2 −1 x3 2 1 0 2 0 s1 0 2 −1 4−α α−4 s2 0 −1 1 −2 + α 2−α d d a ratio 1 2 z= 2 + 2α Table F.21: For the table to remain optimal the final row must remain zero or negative, thus; α−4≤0 ⇒ α≤4 2−α≤0 ⇒ 2≤α ⇒ 2≤α≤4 Thus the optimal range for the x1 coefficient in the objective function is 2 ≤ α ≤ 4. 2. (a) Construct a network as follows. Each vertex(node) contains the year of purchase of a new car. Each edge contains the cost of replacing a car determined by the vertices at its ends. This network is shown in Figure F.3 and as can be seen the vertex (13) is redundant since it is not possible to move to the final vertex (14) due to the lab having to be kept for at least two years. However I have left this in my diagram, you may have been smart and eliminated it right from the start. Dijkstra’s Method The method labels the nodes [distance back to (08),previous node] and underlines a label once it becomes permanent. (i) Label (08) with [0,8] (ii) Add temporary labels to all nodes directly connected to (08). ie Add the labels: [20,8], [22,8], [25,8] and [23,8] (iii) Make the smallest temporary label, [20,8] at node(10), permanent and denote as [20,8]. (iv) Add temporary labels to all vertices directly connected to node(10) that either have no label or have a temporary label with distance back to (08) greater than the associated edge value + distance on node(10.) There is only one such node, and that is node(14). Label node(14) as [44.25,10]. (v) Make the smallest temporary label, [22,8] at node(11), permanent and denote as [22,8]. (vi) Add temporary label as before to all nodes directly linked to node(11). There are none to add, since the temporary labels on nodes(13) and (14) have a shorter distance back to node(08) than via node(11). APPENDIX F. SPECIMEN COURSEWORKS 139 (vii) Make the smallest temporary label, [23,8] at node(12), permanent. (viii) Add temporary labels as before to all nodes directly linked to node(12). There are none to add. (ix) Make the smallest temporary label, [25,8] at node(13), permanent. (x) No nodes connected directly to node(13) (xi) Make the smallest temporary node, [44.25,10] at node(14) permanent. Since we now have a permanent label on the node to which we wish to find the shortest route, the process stops. In this example it would have stopped anyway since there were no temporary labels, or nodes without labels, to which to apply the updating process. [20,8] 10 µ 24,250 23,000 21,000 20,000 R : 13 25,000 [44.25,10] j 6 22,000 08 [25,8] 22,000 [0,8] z 23,250 : * 14 11 [22,8] 23,000 s? 23,500 12 [23,8] Figure F.3: Each vertex is named with the year of purchase of a new car. The edges are labelled with the cost of replacement. The labels on each vertex are from Dijkstra and indicate the distance back to vertex 08 measured in thousands followed by the name of the previous node. The optimal solution is to replace after 2 year and then 4 years at a cost of £44,250. APPENDIX F. SPECIMEN COURSEWORKS 140 (b) Figure F.4 represents the layout with the vertices being numbered 1..8, corresponding to the eight towns, and the edges labelled with the costs of the potential cable links in tens of thousands of pounds. Applying Kruscal’s algorithm, adding first the links of length 1 and 3 2 1 4 2 4 2 1 1 2 5 2 1 3 3 8 3 6 3 5 2 7 Figure F.4: then length 2, all nodes are then linked. See F.5 (b) (a) 3 1 1 5 4 2 2 1 1 1 1 2 4 2 5 1 1 6 2 6 8 2 7 Figure F.5: (a) Edges of length 1 are added to the network. (b) Edges of length 2 are added. The final configuration is given in Figure F.5(b) and the total cost is £11,000. (c) • A line segment from x1 ∈ E to x2 ∈ E is given by: {x ∈ E : x = λx1 + (1 − λ)x2 0 ≤ λ ≤ 1} • C ⊆ E is convex if for any two points in C the line segment between the two points is entirely contained in C. • Define C = {x ∈ E : Ax ≤ b}. APPENDIX F. SPECIMEN COURSEWORKS 141 Let x1 and x2 be any two points in C. That is to say Ax1 ≤ b and Ax2 ≤ b Construct the line segment between the two points and show that all points on it are in C. x = λx2 + (1 − λ)x1 ⇒ Ax + λAx2 + (1 − λ)Ax1 ≤ λb + (1 − λ)b = b Thus all points x on the line satisfy Ax ≤ b and are therefore in C. C is therefore convex.