Download presentation

Presentation is loading. Please wait.

Published byLuciano Charter Modified over 2 years ago

1
IEOR 4004 Final Review part I. April 28, 2014

2
Mathematical programming Help decision-maker(s) make decisions (what and how much to produce, which path is fastest, how to allocate limited resources most efficiently) Problem description – decisions – goal (objective) – constraints Mathematical model – decision variables (and variable domains) – objective function – constraint equations

3
Mathematical programming Problem Model Problem simplification Model formulation Algorithm selection Numerical calculation Interpretation Sensitivity analysis

4
Model selection trade-off between and Simple Complex Model Predictive power (quality of prediction) High Low Easy to compute a solution (seconds) Hard (if not impossible) to compute a solution (lifetime of the universe) Solving Linear programming Network models Integer programming Dynamic programming accuracy (predictive power) model simplicity (being able to solve it)

5
Today’s agenda Transportation Problem Shortest path Spanning tree Maximum Flow (Ford Fulkerson) Minimum-cost Flow (Network Simplex)

6
Transportation problem Factories Customers Requirement for goods Production capacity... Minimum cost of transportation satisfying the demand of customers. aiai aiai bjbj bjbj i-th factory delivers to j-th customer at cost c ij a1a1 a2a2 anan bmbm b1b1 b2b2

7
Transportation tableau 7 x 11 3 x 12 4 x 13 u18u18 4 x 21 2 x 22 2 x 23 u26u26 2 x 31 1 x 32 5 x 33 u33u33 v14v14 v22v22 v33v33 cost c ij of delivering from ith factory to jth customer supply a i of ith factory demand b j of jth customer shadow customer’s “price” shadow factory “price” shadow prices are relative to some baseline amount transported

8
Transportation problem a1a1 b1b1 a2a2 b2b2 b3b3 a3a3 a4a4 b4b4 7 x 11 3 x 12 4 x 13 u18u18 4 x 21 2 x 22 2 x 23 u26u26 2 x 31 1 x 32 5 x 33 u33u33 v14v14 v22v22 v33v33 7 x 11 3 x 12 4 x 13 0 x 14 u18u18 4 x 21 2 x 22 2 x 23 0 x 24 u26u26 2 x 31 1 x 32 5 x 33 0 x 34 u33u33 v14v14 v22v22 v33v33 v48v48 7 x 11 3 x 12 4 x 13 0 x 14 u18u18 4 x 21 2 x 22 2 x 23 0 x 24 u26u26 2 x 31 1 x 32 5 x 33 0 x 34 u33u33 9 x 41 8 x x 43 0 x 44 u40u40 v14v14 v22v22 v33v33 v48v48

9
7 x 11 3 x 12 4 x 13 0 x 14 u18u18 4 x 21 2 x 22 2 x 23 0 x 24 u26u26 2 x 31 1 x 32 5 x 33 0 x 34 u33u33 v14v14 v22v22 v33v33 v48v48 Transportation Simplex Applying the Simplex method to the problem Basic solution – min-cost method Pivoting – shadow prices set u 1 = 0, then u i + v j =c ij – reduced cost pivot if u i + v j > c ij Finding a loop take the smaller of the two must mark exactly m + n – 1 = 6 cells cost = 3×7 + 3×4 + 2×0 + 1×2 + 2×1 + 6×0 = 37 z = 37

10
7 x 11 3 x 12 4 x 13 0 x 14 u18u18 4 x 21 2 x 22 2 x 23 0 x 24 u26u26 2 x 31 1 x 32 5 x 33 0 x 34 u33u33 v14v14 v22v22 v33v33 v48v48 Transportation Simplex Applying the Simplex method to the problem Basic solution – min-cost method Pivoting – shadow prices set u 1 = 0, then u i + v j =c ij – reduced cost pivot if u i + v j > c ij Finding a loop z = u i =0 and v j must sum up to c ij = 4v j =

11
7 x 11 3 x 12 4 x 13 0 x 14 u18u18 4 x 21 2 x 22 2 x 23 0 x 24 u26u26 2 x 31 1 x 32 5 x 33 0 x 34 u33u33 v14v14 v22v22 v33v33 v48v48 Transportation Simplex Applying the Simplex method to the problem Basic solution – min-cost method Pivoting – shadow prices set u 1 = 0, then u i + v j =c ij – reduced cost pivot if u i + v j > c ij Finding a loop z = calculate u i + v j > > > > ≤ ≤

12
7 x 11 3 x 12 4 x 13 0 x 14 u18u18 4 x 21 2 x 22 2 x 23 0 x 24 u26u26 2 x 31 1 x 32 5 x 33 0 x 34 u33u33 v14v14 v22v22 v33v33 v48v48 Transportation Simplex Applying the Simplex method to the problem Basic solution – min-cost method Pivoting – shadow prices set u 1 = 0, then u i + v j =c ij – reduced cost pivot if u i + v j > c ij Finding a loop New basis Δ2+Δ 11+Δ1+Δ 22-Δ2-Δ 33-Δ3-Δ 3 z = > > > > ≤ ≤ +Δ+Δ 6-Δ6-Δ Largest feasible Δ = z = 29

13
Shortest path Problem s s b b g g c c h h i i f f d d e e Network G = (V,E) where V is the set of nodes and E the set of edges each edge (i,j) can have cost/weight/length c ij path is a sequence of nodes connected by edges v 1,v 2,...,v t where (v i,v i+1 ) in E for i=1,2,...,t-1 length of a path is sum of lengths of its edges length of a shortest path from s to e? s, g, c, d, i, e is a path of length = 31

14
Shortest path Problem (Dijkstra) s s b b g g c c h h i i f f d d e e sbcdefghi 0*∞∞∞∞∞∞∞∞ 08∞∞∞∞6*∞∞ 08*14∞∞∞615∞ 0814*∞∞∞615∞ ∞∞615*∞ *∞∞ ∞ * * * We calculate distance from s to all vertices (not just e) keep distance estimate d(x) for each node x d(x) is an upper bound on the length of a shortest path from s to x start by setting d(s)=0 and d(x)=∞ for each x≠s; then iteratively pick smallest d(x) and for each (x,y) in E, update d(y)=min(d(y),d(x)+c xy )

15
Minimum spanning tree (Prim) Collection of edges touching all vertices but with no cycles Tree growing 1. start with s (or any other node) 2. attach a cheapest edge sticking out of the tree already built 3. repeat as long as possible s s b b g g c c h h i i f f d d e e

16
Minimum spanning tree (Kruskal) Order edges by cost 1.start with empty forest (no nodes, no edges) 2.add the cheapest edge that does not create a cycle 3.repeat as long as possible diefbg, cdgs, cf, chfhdf, hi, cg, bsfi, ei, bc, ghde, cs s s b b g g c c i i d d e e h h f f

17
Maximum flow s s b b g g c c h h i i f f d d t t capacity not cost! flow across an edge (i,j) = amount x ij of goods transported from i to j non-negative and at most the capacity u ij what flows into a node flows out (except for source s and sink t) (conservation of flow) How to find a maximum possible flow?Ford-Fulkerson

18
0/4 4 Maximum flow (Ford-Fulkerson) 0/4 0/1 0/3 0/4 0/2 0/3 0/2 s s b b g g c c h h i i f f d d t t 0/1 0/4 0/2 0/1 0/2 0/3 0/2 start with a zero flow s s b b g g c c h h i i f f d d t t residual network edges: if not saturated if positive flow (put reverse edge) represents remaining capacity can improve iff we find a path from s to t can increase up to Δ=2 units 2/4 2/3 2/4 2/2

19
0/4 1/4 Maximum flow (Ford-Fulkerson) 2/4 0/1 2/3 0/3 2/3 2/4 0/2 2/2 2/3 0/2 s s b b g g c c h h i i f f d d t t 0/1 0/4 0/2 0/1 0/2 0/3 0/2 start with a zero flow s s b b g g c c h h i i f f d d t t residual network edges: if not saturated if positive flow (put reverse edge) represents remaining capacity can improve iff we find a path from s to t can increase up to Δ=1 units 3/4 1/1 3/3 1/2

20
1/4 2/4 Maximum flow (Ford-Fulkerson) 3/4 0/1 2/3 0/3 3/3 2/4 1/2 2/2 2/3 0/2 s s b b g g c c h h i i f f d d t t 1/1 0/4 0/2 0/1 0/2 0/3 0/2 start with a zero flow s s b b g g c c h h i i f f d d t t residual network edges: if not saturated if positive flow (put reverse edge) represents remaining capacity can improve iff we find a path from s to t can increase up to Δ=1 units 4/4 1/3 1/2

21
Maximum flow (Ford-Fulkerson) 3/4 0/1 2/3 0/3 3/3 2/4 1/2 2/2 2/3 0/2 s s b b g g c c h h i i f f d d t t 1/1 0/4 0/2 0/1 0/2 0/3 0/2 start with a zero flow s s b b g g c c h h i i f f d d t t residual network edges: if not saturated if positive flow (put reverse edge) represents remaining capacity can improve iff we find a path from s to t 4/4 1/3 2/4 1/2 -Δ +Δ+Δ +Δ+Δ +Δ+Δ +Δ+Δ +Δ+Δ can increase up to Δ=1 units 1/1 3/3 0/1 2/3 2/2 3/4

22
Maximum flow (Ford-Fulkerson) 4/4 1/1 3/3 0/3 3/3 2/4 1/2 1/3 2/2 2/3 0/2 s s b b g g c c h h i i f f d d t t 0/1 0/4 0/2 0/1 0/2 0/3 0/2 start with a zero flow s s b b g g c c h h i i f f d d t t residual network edges: if not saturated if positive flow (put reverse edge) represents remaining capacity can improve iff we find a path from s to t 2/3 3/4 2/2 nodes reachable from s t cannot be reached from sminimum cut (of capacity 2+3=5)

23
Minimum-cost flow (Network Simplex) 3/4 1/1 3/3 1/3 3/3 2/4 1/2 2/3 2/2 2/3 1/2 s s b b g g c c h h i i f f d d t t total cost: 2×$6+2×$8+2×$9+1×$8+1×$9+3×$5+3×$8+1×$8+2×$9+1×$4+3×$9 = $159 $9 $3 $4 $10 $8 $6 $9 $7 $5 $9 $10 $8 $5 $6 $8 $9 $8 Start by constructing a basis: 1.Include all edges with nonzero flow but not saturated 2.add any additional edges until a spanning tree obtained (all nodes touching at least one edge, no cycles) Is this minimum possible cost (among all flows meeting the supplies/demands b i s)? net supply b s = +4 net supply b t = –4 Network Simplex algorithm what if you get a cycle in step 1.? 0/1 0/4 0/2 0/1 0/2 0/3 0/2

24
Minimum-cost flow (Network Simplex) 3/4 0/1 1/1 0/4 3/3 0/2 0/1 1/3 0/2 3/3 2/4 0/3 1/2 0/2 2/3 2/2 2/3 1/2 s s b b g g c c h h i i f f d d t t $9 $3 $4 $10 $8 $6 $9 $7 $5 $9 $10 $8 $5 $6 $8 $9 $8 Steps: 1.shadow prices: set y s = $0, then y u – y v = c uv for edge (u,v) 2.reduced costs y u – y v – c uv $0 -$6 -$14 -$5 -$15 -$23 -$14 -$6 -$32 Economic interpretation: (-y u ) is the price in node u the cost of transportation using green edges matches these prices; perhaps using an edge outside the green network we can do better reduced costs (e.g. take nodes d and i with prices $6 and $23; transporting along (d,i) costs only $3... it pays to buy at d (at $6), sell at i (at $23) and even pay the transportation ($3) 0 – $6 = -$6 $0 – (-$5) – $8= -$3 (-$5) (-$4) (-$24) (-$3) (-$13) (-$6) ($14) (-$36) ($14) 3.pivot on edge (u,v) if either no flow on edge (u,v) and positive reduced cost edge (u,v) saturated and negative reduced cost (e.g. $32 at t and $0 at s)

25
Minimum-cost flow (Network Simplex) 3/4 0/1 1/1 0/4 3/3 0/2 (3-Δ)/3 0/1 1/3 0/2 3/3 2/4 0/3 1/2 0/2 2/3 2/2 2/3 1/2 s s b b g g c c h h i i f f d d t t $9 $3 $4 $10 $8 $6 $9 $7 $5 $9 $10 $8 $5 $6 $8 $9 $8 Steps: 1.shadow prices: set y s = $0, then y u – y v = c uv for edge (u,v) 2.reduced costs y u – y v – c uv $0 -$6 -$14 -$5 -$15 -$23 -$14 -$6 -$32 (-$5) (-$4) (-$24) (-$3) (-$13) (-$6) ($14) (-$36) ($14) 3.pivot on edge (u,v) if either no flow on edge (u,v) and positive reduced cost edge (u,v) saturated and negative reduced cost choose this edge to enter (3-Δ)/3 (2-Δ)/3 (1+Δ)/2 (1+Δ)/3 (1-Δ)/2 largest feasible Δ=1 we choose this edge to leave

26
total cost: 2×$6+2×$8+2×$9+0×$8+2×$9+2×$5+2×$8+2×$8+1×$9+1×$4+3×$9 = $146 Minimum-cost flow (Network Simplex) 3/4 0/1 1/1 0/4 2/3 0/2 0/1 2/3 0/2 2/3 2/4 0/3 0/2 2/3 2/2 1/3 2/2 s s b b g g c c h h i i f f d d t t $9 $3 $4 $10 $8 $6 $9 $7 $5 $9 $10 $8 $5 $6 $8 $9 $8 Steps: 1.shadow prices: set y s = $0, then y u – y v = c uv for edge (u,v) 2.reduced costs y u – y v – c uv $0 -$6 -$14 -$5 -$15 -$23 -$14 -$6 -$32 (-$5) (-$4) (-$24) (-$3) (-$13) (-$6) ($14) (-$36) ($14) 3.pivot on edge (u,v) if either no flow on edge (u,v) and positive reduced cost edge (u,v) saturated and negative reduced cost choose this edge to enter largest feasible Δ=1 we choose this edge to leave (3-Δ)/3 (2-Δ)/3 (1+Δ)/3 (1-Δ)/2 (1+Δ)/2 (-$6) New basis What if Δ can be arbitrarily large? What does it mean for the network?

27
Network problems as Minimum-cost flow s s b b g g c c h h i i f f d d e e Shortest path $9 $3 $4 $10 $8 $6 $9 $7 $5 $9 $10 $8 $5 $6 $8$8 $9 $8 s s b b g g c c h h i i f f d d e e Minimum-cost flow net supply b s = 1 net demand b e = 1 all edges infinity capacity

28
Network problems as Minimum-cost flow s s b b g g c c h h i i f f d d t t s s b b g g c c h h i i f f d d t t Maximum flow Minimum-cost flow ∞ all edges cost $0 except (t,s) has cost -$1 and infinity capacity -$1

29
Network problems as Minimum-cost flow Transportation problem Minimum-cost flow all edges infinity capacity (edge costs remain the same) b1b1 b2b2 b3b3 b4b4 (a2)(a2) net supply (a 1 ) (a3)(a3) (a4)(a4) (-b 2 ) net supply (-b 1 ) (-b 3 ) (-b 4 ) a1a1 a2a2 a3a3 a4a4

30
Network problems as Minimum-cost flow Minimum-cost flow with one source and one sink nodes with positive net supply nodes with negative net supply net supply of s = the sum of the (positive) net supplies net supply of t = the sum of the (negative) net supplies new edges have $0 cost all nodes here now have zero net supply G (200) (500) (300) (100) (-400) (-200) (-300) s s t t (1100) (-1100)

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google