5 network flow problems
play

5. Network flow problems Example: Sailco Minimum-cost flow problems - PowerPoint PPT Presentation

CS/ECE/ISyE 524 Introduction to Optimization Spring 201718 5. Network flow problems Example: Sailco Minimum-cost flow problems Transportation problems Shortest/longest path problems Max-flow problems Integer solutions


  1. CS/ECE/ISyE 524 Introduction to Optimization Spring 2017–18 5. Network flow problems ❼ Example: Sailco ❼ Minimum-cost flow problems ❼ Transportation problems ❼ Shortest/longest path problems ❼ Max-flow problems ❼ Integer solutions Laurent Lessard (www.laurentlessard.com)

  2. Example: Sailco Sailco manufactures sailboats. During the next 4 months the company must meet the following demands for their sailboats: Month 1 2 3 4 Number of boats 40 60 70 25 At the beginning of Month 1, Sailco has 10 boats in inventory. Each month it must determine how many boats to produce. During any month, Sailco can produce up to 40 boats with regular labor and an unlimited number of boats with overtime labor. Boats produced with regular labor cost ✩ 400 each to produce, while boats produced with overtime labor cost ✩ 450 each. It costs ✩ 20 to hold a boat in inventory from one month to the next. Find the production and inventory schedule that minimizes the cost of meeting the next 4 months’ demands. 5-2

  3. Example: Sailco Summary of problem data: ❼ Regular labor: ✩ 400/boat (at most 40 boats/month). ❼ Overtime labor: ✩ 450/boat (no monthly limit). ❼ Holding a boat in inventory costs ✩ 20/month. ❼ Inventory initially has 10 boats. ❼ Demand for next 4 months is: Month 1 2 3 4 Number of boats 40 60 70 25 What are the decision variables? 5-3

  4. Example: Sailco Remember: Decision variables aren’t always things that you decide directly! For this problem, the decision variables are: ❼ x 1 , x 2 , x 3 , x 4 : boats produced each month with regular labor. ❼ y 1 , y 2 , y 3 , y 4 : boats produced each month with overtime. ❼ h 1 , h 2 , h 3 , h 4 , h 5 : boats in inventory at start of each month. Parameters: ❼ d 1 , d 2 , d 3 , d 4 : demand at each month 5-4

  5. Example: Sailco The constraints are: ❼ 0 ≤ x i ≤ 40 (monthly limit of regular production) ❼ y i ≥ 0 (unlimited overtime production) ❼ Conservation of boats: ◮ h i + x i + y i = d i + h i +1 (for i = 1 , 2 , 3 , 4) ◮ h 1 = 10 (initial inventory) Solution: Sailco.ipynb 5-5

  6. Example: Sailco R OT R OT R OT R OT x 1 x 2 x 3 x 4 y 1 y 2 y 3 y 4 h 1 h 2 h 3 h 4 h 5 1 2 3 4 d 1 d 2 d 3 d 4 customers customers customers customers : regular labor : month i : overtime R OT i 5-6

  7. Example: Sailco R OT R OT R OT R OT x 1 x 2 x 3 x 4 y 1 y 2 y 3 y 4 h 1 h 2 h 3 h 4 h 5 1 2 3 4 d 1 d 2 d 3 d 4 customers customers customers customers ❼ Arrows indicate flow of boats ❼ conservation at nodes: h 1 + x 1 + y 1 = d 1 + h 2 , etc. 5-7

  8. Minimum-cost flow problems ❼ Many optimization problems can be interpreted as network flow problems on a directed graph. ❼ Decision variables: flow on each edge . ❼ Edges have flow costs and capacity constraints ❼ Each node can either: ◮ produce/supply flow (source) ◮ consume/demand flow (sink) ◮ conserve flow (relay) What is the minimum-cost feasible flow? 5-8

  9. Minimum-cost flow problems 1 6 3 5 8 2 4 7 ❼ The set of nodes: N = { 1 , . . . , 8 } . ❼ The set of directed edges: E = { (1 , 3) , (2 , 3) , (2 , 4) , . . . } . ❼ Each node i ∈ N supplies a flow b i . Node i is called a source if b i > 0, a relay if b i = 0, and a sink if b i < 0. ❼ Decision variables : x ij is the flow on edge ( i , j ) ∈ E . ❼ Flow cost : c ij is cost per unit of flow on edge ( i , j ) ∈ E . 5-9

  10. Minimum-cost flow problems 1 6 3 5 8 2 4 7 ❼ Decision variables : x ij is the flow on edge ( i , j ) ∈ E . ❼ Capacity constraints : p ij ≤ x ij ≤ q ij ∀ ( i , j ) ∈ E . ❼ Conservation : � j ∈N x kj − � i ∈N x ik = b k ∀ k ∈ N . ❼ Total cost : � ( i , j ) ∈E c ij x ij . Note: b k , c ij , p ij , q ij are parameters . 5-10

  11. Minimum-cost flow problems 1 6 3 5 8 2 4 7 The entire model: minimize � ( i , j ) ∈E c ij x ij x ij ∈ R � j ∈N x kj − � subject to: i ∈N x ik = b k ∀ k ∈ N p ij ≤ x ij ≤ q ij 5-11

  12. Minimum-cost flow problems 1 6 3 5 8 2 4 7 Expanded conservation constraint: x 13   x 23 1 0 0 0 0 0 0 0 0 0 0 b 1     x 24   0 1 1 0 0 0 0 0 0 0 0 b 2 x 35   − 1 − 1 0 1 1 0 0 0 0 0 0 b 3       x 36 0 0 − 1 0 0 1 0 0 0 0 0      b 4  = x 45  0 − 1 0 − 1      0 0 1 1 0 0 0 b 5 x 56       0 0 0 0 − 1 0 − 1 0 1 1 0 b 6       x 57 0 − 1 − 1 0 0 0 0 0 0 0 1 b 7   x 67 0 0 0 0 0 0 0 0 0 − 1 − 1   b 8 x 68 A = incidence matrix x 78 5-12

  13. Minimum-cost flow problems 1 6 3 5 8 2 4 7 The entire model (compact form): c T x minimize x ∈ R |E| subject to: Ax = b p ≤ x ≤ q Note : The incidence matrix A is a property of the graph. It does not depend on which nodes are sources/sinks/relays. 5-13

  14. Balanced problems The incidence matrix has the property that all columns sum to zero. In other words: 1 T A = 0. Since Ax = b is a constraint, we must therefore have: 1 T Ax = 1 T b = 0. Therefore: � i ∈N b i = 0 (total supply = total demand) ❼ If � i ∈N b i = 0, the model is called balanced . ❼ Unbalanced models are always infeasible. ❼ Note: balanced models may still be infeasible. Unbalanced models still make sense in practice, e.g. we may have excess supply or allow excess demand. These cases can be handled by making small modifications to the problem, such as changing “=“ to “ ≤ ”. 5-14

  15. Minimum-cost flow problems Many problem types are actually min-cost flow models: ❼ transportation problems ❼ assignment problems ❼ transshipment problems ❼ shortest path problems ❼ max-flow problems Let’s look at these in more detail... Legend: : source : relay : sink 5-15

  16. Transportation problems The objective is to transport a particular commodity from several possible sources to several possible destinations while minimizing the total cost. ❼ Sources have known supply limits ❼ Destinations each have demands ❼ Edges may have capacity limits ❼ Each link has an associated cost 5-16

  17. Transportation example Millco has three wood mills and is planning three new logging sites. Each mill has a maximum capacity and each logging site can harvest a certain number of truckloads of lumber per day. The cost of a haul is ✩ 2/mile of distance. If distances from logging sites to mills are given below, how should the hauls be routed to minimize hauling costs while meeting all demands? Note : problem is balanced! Source: J. Reeb and S. Leavengood, 2002 5-17

  18. Transportation example ❼ Arrange nodes as: � � 1 2 3 A B C (sources, sinks). ❼ Graph is fully connected. Incidence matrix:  1 1 1 0 0 0 0 0 0  0 0 0 1 1 1 0 0 0   0 0 0 0 0 0 1 1 1   A =   − 1 0 0 − 1 0 0 − 1 0 0     0 − 1 0 − 1 0 − 1 0 0 0   0 0 − 1 0 0 − 1 0 0 − 1 Julia code: Millco.ipynb 5-18

  19. Transportation example A B C A Solution is: 1 20 0 0 20 2 10 20 0 30 45 3 0 15 30 3 30 35 30 30 Similar to “magic squares” but without cell constraints 5-19

  20. Assignment problems We have n people and n tasks. The goal is to assign each person to a task. Each person has different preferences (costs) associated with performing each of the tasks. The goal is to find an assignment that minimizes the total cost. ❼ It’s just a transportation problem! ❼ Each source has supply = 1 ❼ Each sink has demand = 1 ❼ Edges are unconstrained What about the integer constraint? More about this later... 5-20

  21. Assignment example The coach of a swim team needs to assign swimmers to a 200-yard medley relay team to compete in a tournament. The problem is that his best swimmers are good in more than one stroke, so it’s not clear which swimmer to assign to which stroke. Here are the best times for each swimmer: Stroke Carl Chris David Tony Ken Backstroke 37.7 32.9 33.8 37.0 35.4 Breaststroke 43.4 33.1 42.2 34.7 41.8 Butterfly 33.3 28.5 38.9 30.4 33.6 Freestyle 29.2 26.4 29.6 28.5 31.1 Julia code: Swim Relay.ipynb Source: B. Van Roy and K. Mason 5-21

  22. Transshipment problems The same as a transportation problem, but in addition to sources and destinations, we also have warehouses that can store goods. The warehouses are relay nodes . ❼ Sources have known supply limits ❼ Destinations each have demands ❼ Links may have capacity limits ❼ Each link has an associated cost ❼ For warehouses, inflow = outflow. Sailco problem is a transshipment problem! 5-22

  23. Transshipment example: Sailco R OT R OT R OT R OT x 1 x 2 x 3 x 4 y 1 y 2 y 3 y 4 h 1 h 2 h 3 h 4 h 5 1 2 3 4 d 1 d 2 d 3 d 4 customers customers customers customers R : sources : relays customers : sinks i OT ❼ The “warehouses” are the different months. ❼ Storing in inventory = shipping to the future. 5-23

  24. Shortest/longest path problems We have a directed graph and edge lengths. The goal is to find the shortest or longest path between two given nodes. ❼ Again, a transportation problem! 3 2 ❼ Edge cost = length of path. 4 3 2 ❼ The source has supply = 1 2 1 ❼ The sink has demand = 1 5 3 4 2 ❼ To find longest path, just change 3 the min to a max! Again we need integer constraints on the edges... 5-24

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend