AGEC 352: March 9, 2011 Lab Handout 5: Transportation Problems The purpose of this handout is to introduce a new type of problem and its implementation in MS Excel and Solver. Part I takes you step by step through the setup, solution, and interpretation of a basic transportation problem. Part II asks you to use what you have learned in solving the model to answer questions about the model. Part I: Basics The basic transportation problem is one of the most common applications of linear programming in industrial use. We often think of economic goods passing through a system in which relatively raw goods are passed through a value chain to generate items for final consumption. As part of that process new inputs are added at each step which causes the price of the final consumption good to be very different from that of the original basic or raw goods. We briefly described this process in lecture looking at the example of steak and how much of the value of this final consumption good can be traced back to original farm level inputs of labor, land, and capital. An often overlooked set of inputs in the value chain are the service inputs of transportation. These are the inputs that make no change to the good itself other than to relocate it within the value chain. In economics we describe transportation and other inputs like it as margin goods. This means that for example that a stereo at the company warehouse is identical in quality and use to the same stereo in a retail store, the only difference being that the retail store stereo has been moved to where end users make purchases. This relocation comes at a cost and will be reflected in the final price. The importance of efficient and economical transportation then becomes clear when we begin to think about companies that want to be price competitive at retail outlets. For purposes of this class the aspect that is most interesting is that the simple linear models we have been using are just smaller versions of the exact same methods that large conglomerates use to manage and plan the transportation component of their businesses. The Autopower Case Our case for this week is that of a European car manufacturer that receives identical car motors produced in factories overseas into three different ports. The ports are Amsterdam, Antwerp, and Le Havre. These motors are received and stored in warehouses owned by Autopower in the three cities, however the company does not have any assembly plants in these locations to make use of the motors. Autopower has four assembly plants located in Leipzig, Nancy, Liege, and Tillburg. Our task is to build a model that identifies the cheapest way to move all of the motors received at Autopower’s warehouses to the factories where they can be installed in cars that the company is manufacturing. Table 1 gives the estimated costs of shipping a single motor from a given port city warehouse to a city where Autopower operates an assembly plant. These per motor costs may be based on a variety of information including the distance between locations, quality of the thoroughfare, volume of traffic, and mode of transport used. Feel free to look up the distances between the cities on Google maps or from some other source and try and find out how closely related distances are to the cost between locations. Table 1. Per motor cost of shipments (in dollars) for Autopower1 Destinations Sources Leipzig Nancy Liege Amsterdam Antwerp Le Havre 120.0 61.0 102.5 130.0 40.0 90.0 41.0 100.0 122.0 Tillburg 59.5 110.0 42.0 Using just the cost information we could begin to do some analysis of the problem that might be beneficial. First, note that the cost rates range from $40.00 to $130.00 indicating a large range of potential costs across the various routes available to the company. If we pick any individual source location such as Amsterdam, we see that there are two very high cost destinations and two relatively low cost destinations. If our problem were just dealing with shipments from Amsterdam we would strongly favor shipment to Liege and Tillburg as opposed to the other two cities. However, we cannot consider the shipping choices in isolation. At least some motors will likely have to be shipped along undesirable routes. This is because we have a limited number of motors at each source and a required number of motors for each assembly plant (destination). Table 2 below gives the supply (sources) and demand (destination) numbers that will determine the constraints of our problem. Table 2. Motor availability and requirements at each location for Autopower Location Port Cities Quantity of Motors to Ship (<=) Amsterdam Antwerp Le Havre 500 700 800 Factory Cities Quantity of Motors to Receive (>=) Leipzig Nancy Liege Tilburg 400 900 200 500 Note the inequalities given in the table. The problem for Autopower company is setup so that each port city has a maximum amount of motors that can be shipped (upper limit) and each factory site has a minimum amount of motors that must be received (lower limit). This information is all we need to solve this problem. Due to the nature of the transportation problem we do not have technical coefficients (e.g. hours of labor required to produce a table), a motor at the port city is assumed to be identical to a motor at a factory city with the only difference being its location. 1 This is in France but I grew up in the town of Nancy, KY. Remember this fact for a bonus point on the next quiz. The decision variables in this problem are routes, with the optimization problem’s solution identifying the quantity of motors shipped along each route that will result in the lowest total cost to Autopower. Since each port can ship to any destination city and all shipments are one way (source to destination) we can find the total number of decision variables for this problem by multiplying sources by destinations or in this case 3 x 4 = 12. Similarly, since each source or destination will be generating a constraint in the problem (lower or upper limit on motors) we will have 3 + 4 = 7 constraints (not considering the 12 non-negativity constraints associated with routes). With 12 variables and 7 constraints the problem is easily the biggest we have seen in class this year. To help keep track of everything in the model, we typically use some shorthand when writing the problem algebraically. For example, it is common to use a two numeral subscript on each decision variable and coefficient to indicate the source and destination. For example, if X is used for decision variables in the model then X32 would indicate the variable for shipments of motors from source 3 (Le Havre) to destination 2 (Nancy). Similarly if C is used for the unit cost parameter then C21 would represent the cost of shipping one motor from Antwerp to Leipzig. This leads to an algebraic form of the problem that looks like the following: min TC C sd X sd s d X 1d 500 2d 700 3d 800 s.t. Amst : d X Antw : d X LeHa : d Leip : X 400 s1 s X Nanc : s2 900 s Lieg : X s3 200 s Till : X s4 500 s Non neg : X sd 0 The variable TC is total cost and is the objective and the two summation signs on the RHS just indicate that we need to sum over all the costs of shipments at each source and destination. The constraints are a little trickier but if we look at the Amsterdam source constraint the variable X1d just means a shipment from the first source to a generic destination d. Underneath the summation sign we have a d which indicates we add up shipments from Amsterdam across all destinations. The RHS of the constraint is 500 which is the limit on motor supply at Amsterdam. The constraints on destinations are similar in that they are now summations over the different locations that supply motors to the factories. With a basic idea of how the model looks algebraically and what we are trying to accomplish in a transportation model we are now ready to open the spreadsheet that accompanies this handout and learn how to build the model in a spreadsheet. You’ll first notice that the model is not setup like the LP spreadsheets that we have done to date. All of the data and formulas are setup in a set of linked matrixes rather than being input in a manner to resemble equations. The first matrix has the given unit cost information and is labeled Objective Coefficients. This matrix is identical to Table 1 of this handout where we read the intersection of a row and column to find the cost of shipping from a source to a destination. The second matrix in the Excel worksheet gives the decision variables. These are all initially set to zero just as in our previous models since these are the cells of the spreadsheet that we will allow Solver to adjust to find the lowest cost route. Finally, we have the matrix labeled Elements of Total Cost Equation at the bottom of the spreadsheet. These cells are blank for the moment. Steps in completing the spreadsheet for solving: 1) We can use the decision variables matrix to input our constraints. You will notice that after each row and column in this matrix we have a blank item called LHS, a weak inequality sign, and a numerical value labeled the RHS. Just as with our previous models we will use this format to introduce equations. The only difference is that now rather than using the sumproduct formula we will only need to use the sum formula. For example in the first column the constraint RHS is 400 and indicates that that number is the minimum amount of motors that must be shipped to Leipzig. To calculate the LHS of this constraint we need only to add up all of the motors going to Leipzig which we could do by putting =sum(B10:B12) into the LHS cell in B13. A sum formula needs to be entered for the other 3 destinations as well as the three sources in the model. The source LHS values are found by summing up the elements of a column. 2) Step 1 takes care of the constraints, all that we need to complete the model is the objective equation. We will use the third matrix in the worksheet to build this calculation. Each of the cells here represent a contribution to total costs for a given route. For example, if we ship ten units from Amsterdam to Leipzig @$120 per, we expect a value of $1200 to show up in cell B19. This means that the formula in B19 should be =B4*B10, i.e. the unit cost (matrix 1) multiplied by the number of units we choose to ship (matrix 2). The same type of formula needs to be added to all of the cells in this last matrix so that all possible contributions to total cost are accounted for. 3) Now that we have formulas for all of the contributions to total costs, we need only to add these contributions up to get the objective variable. Cell F22 is designated as the objective variable cell and should have the formula =sum(B19:E21) typed in it to correctly evaluate the total costs. 4) Once you have all of the formulas from the first three steps introduced you can check your work by inputting some values into the Decision variables matrix and making sure the reported total cost makes sense. E.g. I placed a value of 10 in the Amsterdam to Nancy cell (C10) and a value of 10 in the Antwerp to Liege (D11) and found the total cost to be 2300. 5) If you have all of the formulas correct above you are ready to solve. Figure 1. Solver setup for transportation problem. If you are using Excel 2010 the solver page should look like the figure above. If you are using the 2007 version it will look different but the entries should be the same. Some items of note: 1) We will want to look at the sensitivity report so it is a good idea to save your spreadsheet and then uninstall and reinstall solver at this point if you had to do that for assignment 4. See the last page of handout 4 for the Excel Solver bug workaround. 2) In Excel 2007 you will need to click options to get the ‘assume linear model’ and ‘assume non-negativity’ choices that appear on the main page of 2010’s solver. 3) Instead of putting each constraint in individually, you can input all of the <= constraints together by highlighting the LHS range for the left side cell reference box of the solver constraint item and doing likewise with the RHS. See below: Once the model is input into solver click on Solve and when it completes highlight Sensitivity in the reports window (by left clicking) and then hit OK. You should have a sheet in your workbook that looks like this: Variable Cells Cell $B$10 $C$10 $D$10 $E$10 $B$11 $C$11 $D$11 $E$11 $B$12 $C$12 $D$12 $E$12 Name Amsterdam Leipzig Amsterdam Nancy Amsterdam Liege Amsterdam Tillburg Antwerp Leipzig Antwerp Nancy Antwerp Liege Antwerp Tillburg Le Havre Leipzig Le Havre Nancy Le Havre Liege Le Havre Tillburg Final Value 0 0 200 300 0 700 0 0 400 200 0 200 Reduced Cost 0 22.5 0 0 8.5 0 126.5 118 0 0 98.5 0 Objective Coefficient 120 130 41 59.5 61 40 100 110 102.5 90 122 42 Allowable Increase 1E+30 1E+30 98.5 0 1E+30 8.5 1E+30 1E+30 0 22.5 1E+30 17.5 Allowable Decrease 0 22.5 41 17.5 8.5 1E+30 126.5 118 120 8.5 98.5 0 Name LHS Leipzig LHS Nancy LHS Liege LHS Tillburg Amsterdam LHS Antwerp LHS Le Havre LHS Final Value 400 900 200 500 500 700 800 Shadow Price 120 107.5 41 59.5 0 -67.5 -17.5 Constraint R.H. Side 400 900 200 500 500 700 800 Allowable Increase 0 0 0 0 1E+30 200 300 Allowable Decrease 300 200 200 300 0 0 0 Constraints Cell $B$13 $C$13 $D$13 $E$13 $F$10 $F$11 $F$12 There are a number of things that we want to look at in this sensitivity report. First we will address the shadow prices and then we will introduce the column in the top half of the report that is labeled ‘Reduced Cost.” There are several things to make note of in the constraints section of the sensitivity report: 1) All of the constraints bind (LHS or Final Value = RHS). 2) Shadow prices for sources are negative. 3) The shadow price for one source is zero but the constraint is binding. 4) Shadow prices for destinations are positive. 5) The allowable increase is zero for destinations. 6) The allowable decrease is zero for sources. The reason for many of the items above is due to a single property of this problem—the fact that it is in supply and demand balance. In other words, if you add up the maximum number of motors that can be shipped across sources (=2000) it is exactly equal to the minimum number of motors that must be received across destinations (=2000). We will refer to this fact as we look at explanations below for the six facts listed above. 1) all of the constraints are forced to bind because of the balanced nature of the problem. The only way to get enough motors to the destinations is to ship every available motor at the sources. 2) shadow prices are negative for destinations because the shadow price is defined as the change in the objective (total costs) when we have the RHS + 1. An additional unit at one of the sources is an additional motor available to ship. For example, if we had another motor available at Le Havre (801 total) we could reduce total costs by $17.50. 3) the shadow price on Amsterdam is zero meaning that if we had an additional motor available there (501 total) we would not reduce costs by shipping it. This zero shadow price essentially points to Amsterdam as the most expensive source and indicates that we only ship units from there because of the balanced nature of the problem. 4) shadow prices are positive for destinations because the shadow price is defined as the change in the objective when we have the RHS + 1. An additional unit required at any destination will increase the total cost in the problem with the shadow price telling us how much that change in cost would be. 5) allowable increases tell us how many unit increases we could make to the RHS before the shadow price changes. Note that these are zero for the RHS of destinations because if we add 1 to any RHS of a destination we have a problem where 2000 units are available to ship but 2001 units are required at destinations. This makes the entire problem infeasible such that we cannot interpret the shadow price in any manner other than a reduction in requirements at a given destination. 6) allowable decreases tell us how many unit decreases we could make to the RHS before the shadow price changes. Note that the these are zero for the RHS of sources because if we take a unit from any source we have a problem with 1999 units available to ship but 2000 units required to be received at the destinations. This makes the problem infeasible such that we cannot interpret the shadow price for source in any manner other than an increase in available motors at a given source. In the top section of the sensitivity report labeled Variable Cells we find the solution value for each route in the first column (labeled Final value) and then a second column that is labeled ‘Reduced Cost.’ It is not clear to me why Excel’s Solver chooses this label and we will call it an ‘objective penalty’ in this course. The reason we want to rename this value is due to the definition of the values in this second column. The ‘objective penalty’ (Excel’s reduced cost column) is the change that would occur in the objective penalty if an activity that is optimally set to a value of zero where changed to a value of one. In other words if it is optimal to set a variable to zero and for some reason we force that value to be one this is the penalty we face relative to the optimal value of the objective variable. For example, the objective penalty for the Amsterdam to Nancy route is $22.50 which indicates that if for some reason we ship a motor along that route our cost will go up by $22.50 as a result of that deviation from the optimal transport plan. Note that the objective penalty is only defined for decision variables that are optimally set to zero. Also note that these penalties are essentially the shadow prices on non-negativity constraints of the problem. Part II. Working with the Transport Model Homework Questions 1) Using the shadow price information from the solution, provide a recommendation to Autopower for capacity expansion at their port warehouses (i.e. compare the sources and decide which one would be best to expand the RHS). 2) Using the shadow prices information from the solution, provide a recommendation to Autopower for capacity expansion at their assembly plants (i.e. compare the destinations and decide which one would be best to expand the RHS). 3) Why might your recommendations in the previous two questions not be adopted? (Hint: think of the entire value chain and what part of the problem you are actually modeling). 4) The objective penalty (reduced cost) on the Amsterdam to Leipzig route is 0 while the solution value is also zero. What can we deduce from this based on the definition of the objective penalty? 5) A colleague claims that Amsterdam to Nancy is the worst route available to the company. Provide a counter to his/her argument using the objective penalty information for all routes. 6) Pick one route in the model and increase its objective coefficient (unit cost of transport) by a value larger than the allowable increase. Report the model and sensitivity results. 7) Assume the change you made in question 6 is part of a new tax proposal on shipping routes. Use your new model results compared to the original results to explain the impact of the proposed tax on Autopower Co.