1 / 28

Computational Methods for Management and Economics Carla Gomes

Computational Methods for Management and Economics Carla Gomes. Module 9c Network Models Special cases of the Minimum Cost Flow Problem – shortest path problem (Slides adapted from J.Orlin’s and Hillier’s). Special Cases of the Minimum Cost Flow Model.

metea
Download Presentation

Computational Methods for Management and Economics Carla Gomes

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computational Methods forManagement and EconomicsCarla Gomes Module 9c Network Models Special cases of the Minimum Cost Flow Problem – shortest path problem (Slides adapted from J.Orlin’s and Hillier’s)

  2. Special Cases of the Minimum Cost Flow Model • Transportation and assignment problem (module 8) • Shortest path problem

  3. Shortest Path Problem

  4. 4 2 4 2 2 2 1 3 1 6 4 2 3 3 5 The Shortest Path Problem • What is the shortest path from a source node (often denoted as s) to a sink node, (often denoted as t)? • What is the shortest path from node 1 to node 6? • Assumptions for this lecture: • 1. There is a path from the source to all other nodes.2. All arc lengths are non-negative

  5. Shortest Path Problem • Where does it arise in practice? • Common applications • shortest paths in a vehicle • shortest paths in internet routing • Less obvious: close connection to dynamic programming • How will we solve the shortest path problem? • Dijkstra’s algorithm

  6. 4 2 4 2 2 2 1 3 1 6 4 2 3 3 5 Shortest Path Problem Find the shortest paths by inspection.

  7. 0 0 4 2 4 2 2 -1 1 2 1 3 1 6 4 2 3 3 5 0 0 Shortest Path Problem Shortest Path Problem Special case of Min. Cost Flow Problem. Why? All arcs have capacity 1

  8. Representation as an integer program • An integer program is a linear program in which some or all of the variables are required to be integer • We will formulate the shortest path problem as an integer program. • Find the shortest path from node 1 to node 6 • Decision variables: • xij = 1 if arc (i,j) is in the path. • xij = 0 if arc (i,j) is not in the path

  9. Constraint matrix of Shortest Path Problem 2 4 1 6 3 5 x12 x13 x23 x24 x25 x35 x46 x54 x56 1 1 0 0 0 0 0 0 0 = 1 -1 0 1 1 1 0 0 0 0 = 0 0 -1 -1 0 0 1 0 0 0 = 0 0 0 0 -1 0 0 1 -1 0 = 0 0 0 0 0 -1 -1 0 1 1 = 0 0 0 0 0 0 0 -1 0 -1 = -1 The constraint matrix is the node arc incidence matrix

  10. On Incidence Matrices • If the constraint matrix for a linear program is a node-arc incidence matrix (at most one 1 and at most one –1 per column), then the linear program solves in integer optima. • Thus, we can solve the shortest path problem as an LP, and get the optimum path.

  11. On Incidence Matrices • If the constraint matrix for a linear program is a node-arc incidence matrix (at most one 1 and at most one –1 per column), then the linear program solves in integer optima. • Thus, we can solve the shortest path problem as an LP, and get the optimum path. Shortest Path Pivoting

  12. Littletown Fire Department • Littletown is a small town in a rural area. • Its fire department serves a relatively large geographical area that includes many farming communities. • Since there are numerous roads throughout the area, many possible routes may be available for traveling to any given farming community. Question: Which route from the fire station to a certain farming community minimizes the total number of miles?

  13. The Littletown Road System

  14. The Network Representation

  15. Spreadsheet Model Note: in order to use the LP model we have to consider direct arcs  Replace undirected arcs with two arcs – in particular the cases in which it makes sense to travel in both directions.

  16. Assumptions of a Shortest Path Problem • You need to choose a path through the network that starts at a certain node, called the origin, and ends at another certain node, called the destination. • The lines connecting certain pairs of nodes commonly are links (which allow travel in either direction), although arcs (which only permit travel in one direction) also are allowed. • Associated with each link (or arc) is a nonnegative number called its length. (Be aware that the drawing of each link in the network typically makes no effort to show its true length other than giving the correct number next to the link.) • The objective is to find the shortest path (the path with the minimum total length) from the origin to the destination.

  17. Applications of Shortest Path Problems • Minimize the total distance traveled. • Minimize the total cost of a sequence of activities. • Minimize the total time of a sequence of activities.

  18. Minimizing Total Cost: Sarah’s Car Fund • Sarah has just graduated from high school. • As a graduation present, her parents have given her a car fund of $21,000 to help purchase and maintain a three-year-old used car for college. • Since operating and maintenance costs go up rapidly as the car ages, Sarah may trade in her car on another three-year-old car one or more times during the next three summers if it will minimize her total net cost. (At the end of the four years of college, her parents will trade in the current used car on a new car for Sarah.) Question: When should Sarah trade in her car (if at all) during the next three summers?

  19. Sarah’s Cost Data

  20. Shortest path x y Buying at moment x Trading in at moment Y Shortest Path Formulation 12 + 2 +3 - 6.5 Arc length = purchase price + operating and maintenance cost- trade-in value

  21. Spreadsheet Model

  22. Planning Vehicle Replacement at Phillips Petroleum • Phillips Petroleum had a fleet of 1,500 cars and 3,800 trucks. • Modeled replacement strategy as shortest path model (20-year time horizon)—solved model once for each class of vehicle. • Could keep, purchase (replace), or lease, at 3-month intervals. • Costs considered included: • Maintenance and operating costs (fuel, oil, repair), • Leasing cost for leased vehicles, • Purchasing cost for purchased vehicles, • State license fees and road taxes, • Tax effects (investment tax credits, depreciation) • First used to make lease-or-buy decision, then vehicle-replacement strategy, and more recently for other equipment (non-vehicle). For more details, see Waddell (1983) Jul-Aug Interfacesarticle, “A Model for Equipment Replacement Decisions and Policies”.

  23. 4 2 4 2 2 2 1 3 1 6 4 2 3 3 5 Exercise: find the shortest path from node 1 to all other nodes. Keep track of distances using labels, d(i) and each node’s immediate predecessor, pred(i). d(1)= 0, pred(1)=0; d(2) = 2, pred(2)=1 Find the other distances, in order of increasing distance from node 1. Dijkstra’s Algorithm for the Shortest Path Problem

  24. Path P 62 10 1 i j • Let d( ) denote a vector of temporary distance labels. • d(j) is the length of some path from the origin node 1 to node j. A Key Step in Shortest Path Algorithms Procedure Update(i) • for each (i,j) Î A(i) do • if d(j) > d(i) + cij then d(j) : = d(i) + cij and pred(j) : = i; 78 72 Up to this point, the best path from 1 to j has length 78 But P, (i,j) is a path from 1 to j of length 72.

  25. Dijkstra’s Algorithm Initialize distances. LIST = set of temporary nodes begin d(s) : = 0 and pred(s) : = 0; d(j) : = for each j  N - {s}; LIST : = {s}; while LIST f do begin let d(i) : = min {d(j) : j  LIST}; remove node i from LIST; update(i) if d(j) decreases, place j in LIST end end Select the node i on LIST with minimum distance label, and then update(i)

  26. 4 2 4 2 2 2 1 3 1 6 4 2 3 3 5 Scan the arcs out of i, and update d( ), pred( ), and LIST Scan the arcs out of i, and update d( ), pred( ), and LIST Scan the arcs out of i, and update d( ), pred( ), and LIST Scan the arcs out of i, and update d( ), pred( ), and LIST Scan the arcs out of i, and update d( ), pred( ), and LIST An Example d(4) =  pred(4) = \6 2 d(2) =  pred(2) = \2 1 2 4 d(6) =  pred(6) = \6 5 d(1) = 0 1 6 pred(1) = 0 3 5 d(3) =  pred(3) = d(5) =  pred(5) = \4 2 \4 1 \ 3 \2 The End Find the node i on LIST with minimum distance. Find the node i on LIST with minimum distance. Find the node i on LIST with minimum distance. Find the node i on LIST with minimum distance. Find the node i on LIST with minimum distance. Find the node i on LIST with minimum distance. Initialize the distances and LIST. \ 2, 3, \ 4, 5, \ 6} \ \ \ LIST = {1,

  27. The Output from Dijkstra’s Algorithm Each node has one incoming arc (except for the source) To find the shortest path from node j, trace back from the node to the source. 2 6 4 2 4 2 2 0 3 1 2 6 1 6 2 4 3 3 5 4 3 Dijkstra provides a shortest path from node 1 to all other nodes. It provides a shortest path tree. Note that this tree is an out-tree.

  28. Comments on Dijkstra’s Algorithm • Dijkstra’s algorithm makes nodes permanent in increasing order of distance from the origin node. • Dijkstra’s algorithm is efficient in its current form. The running time grows as n2, where n is the number of nodes • It can be made much more efficient • In practice it runs in time linear in the number of arcs (or almost so).

More Related