Download presentation

Presentation is loading. Please wait.

Published byKyla Kidner Modified over 2 years ago

1
1 Outline Minimum Spanning Tree Maximal Flow Algorithm LP formulation

2
2 The Minimum Spanning Tree Problem

3
The Minimum Spanning Tree Problem application context nodes are cities arcs are potential highways to be built to connect the cities what is the cheapest way (i.e., shortest total distance) to have all cities connected?

4
The Minimum Spanning Tree Problem general concept tree: a connected network such that the n nodes of the network are connected by n-1 arcs which is a tree?

5
The Minimum Spanning Tree Problem think about this the cheapest way to connect all cities should be a tree called spanning tree, as it connects all cities the only question: how to find the cheapest spanning tree?

6
The Minimum Spanning Tree Problem question: would the cheapest arc always in the minimum spanning tree? must be an arc in the spanning tree an arc not in the spanning tree the cheapest arc, not in the spanning tree

7
The Minimum Spanning Tree Problem question: would we find the minimum spanning tree by always selecting the cheapest unselected arc? no, see, e.g., the cheapest three arcs

8
The Minimum Spanning Tree Problem Let us grow the minimum spanning tree step by step, i.e., add the arcs one by one. minimum spanning tree. As argued before, arc (1, 2) must be in the minimum spanning tree. Thus, we have a small tree T {1, 2}

9
The Minimum Spanning Tree Problem In the minimum spanning tree, which of the three arcs, (1, 3), (2, 3), and (2, 4), should be connected to the tree T {1, 2} grown so far? Arc (1, 3) of length 18 should be in the minimum spanning tree. Why? Considered a spanning tree without arc (1, 3). The cost of the spanning tree can be reduced by swapping an arc with higher cost with arc (1, 3). Thus, arc (1, 3) should be in the minimum spanning tree

10
The Minimum Spanning Tree Problem to find the minimum spanning tree: start with the arc of minimum cost to from a tree grow the tree by adding an arc connecting to it such that adding the arc maintains a tree tree, and among possible arcs to add, the added arc is of the lowest cost

11
The Minimum Spanning Tree Problem

12
The Minimum Spanning Tree Problem

13
The Minimum Spanning Tree Problem

14
The Minimum Spanning Tree Problem

15
The Minimum Spanning Tree Problem

16
The Minimum Spanning Tree Problem

17
The Minimum Spanning Tree Problem

18
18 The Maximal Flow Problem

19
19 Railway Map Each railway segment has a capacity (i.e., upper bound of tonnage (per day)). What is the maximal flow from, say, Paris to Moscow?

20
20 The Maximal Flow Problem The number beside an arc is the capacity of flow along the arc. The movement can be of either direction. What is the maximal flow from node 1 to node 4?

21
21 The Maximal Flow Problem At any moment, we need to keep track of the flow and the residual capacity (i.e., remaining capacity) of an arc number beside an arc: boxed = residual capacity, normal = current flow.

22
22 The Maximal Flow Problem The route allows a flow of 6 units.

23
23 The Maximal Flow Problem The route allows a flow of 2 units.

24
24 The Maximal Flow Problem The route allows a a flow of 3 units

25
25 The Maximal Flow Problem The maximal flow from node 1 to node 4 is 11 units. The flow pattern is shown below, with the residual capacities of arcs boxed

26
26 The Maximal Flow Problem The method seems all right: We first find a route of positive flow from the source to the sink. Find the residual capacities of arcs by subtracting added flows from their (residual) capacities. Keep on repeating the above two steps until no route with positive flow can be added. However, the method can run into trouble.

27
27 The Maximal Flow Problem

28
28 The Maximal Flow Problem The route allows a flow of 2 units.

29
29 The Maximal Flow Problem The route allows a flow of 4 units

30
30 The Maximal Flow Problem The route allows a flow of 1 unit

31
31 The Maximal Flow Problem There seems to be no more flow to node 4, because residual capacity of arc (1, 3) = 0, arc (2, 3) = 0, arc (2, 4) =

32
32 The Maximal Flow Problem However, this does not make sense, because the flow is found to be 11 units before. What is wrong?

33
33 The Maximal Flow Problem Compare the two flow patterns. Any observations? In the second case, the flow in the vertical arc is in the wrong direction

34
34 The Maximal Flow Problem In a large network, how can we be sure which direction to follow when we add flows one by one? There should be ways to revert the direction of a wrong flow

35
35 The Maximal Flow Problem Suppose that we send 2 units from node 1 to node 2 to take up the capacity of node 2 to node 4 of the red flow. The red flow is along arc (3, 2) is then re- directed to arc (3, 4)

36
36 The Maximal Flow Problem The result: Two more units of flow can be sent along the route

37
37 The Maximal Flow Problem There is a labeling algorithm basically keeping track of the flows, the residual capacities, and the re-direction of flows. The algorithm works for networks with capacity limits on bi-directional flows on arcs. It is possible to have different limits for the two directions of the same arc. i j j i capacity i j 35 the capacity of i j flowthe capacity of j i flow

38
38 The Maximal Flow Problem Find the maximal flow from node 1 to node 4 for the following network. The number beside an arc is the capacity limit of the arc. All arcs are bi-directional

39
39 The Maximal Flow Problem Since node 1 is the source, flow can only be possible from node 1 to node 2. Thus, arc (1, 2) is practically a directed arc. Similar, flow can only be possible from node 1 to node 3, node 2 to node 4, and node 3 to node 4. Thus, practically arcs (1, 3), (2, 4), and (3, 4) are directed arcs. The flow on (2, 3) can be on either direction

40
40 The Maximal Flow Problem The route allows a flow of 2 units. 2 the residual capacity of flowing from node 1 to node 3 the residual capacity of flowing from node 3 to node

41
41 The Maximal Flow Problem The route allows a flow of 4 units

42
42 The Maximal Flow Problem The route allows a flow of 1 unit

43
43 The Maximal Flow Problem The route allows a flow of 4 unit

44
44 The Maximal Flow Problem How to get the flows? Compare with the original. The differences in (residual) capacities give the actual flows : 8 units 1 3: 3 units 2 3: 2 units2 4: 6 units 3 4: 5 units maximal flow from node 1 to node 4 : 11 units

45
45 A Linear Program Formulation of the Maximal Flow Problem

46
46 LP Formulation of the Maximal Flow Problem Oil is pumped out at node 1, temporarily stored at nodes 2, 3, and 4, and eventually sent the refinery at node 5 through the pipe lines. In the following, arc represents a pipe line, with its capacity (i.e., barrels of oil per day) written beside it. Formulate a linear program to find the maximal amount of oil sent from node 1 to node 5. A maximal flow problem can be formulated as a linear program (and solved by an optimizer)

47
47 LP Formulation of the Maximal Flow Problem Let x ij be the number of barrels of oil pumped from node i to node j; x ij 0. Because node 1 is the source, x 21 = x 31 = 0. Similarly, x 52 = x 53 = x 54 = 0 because node 5 is the sink. Because we do not know the direction of flow in arc (2, 3), we are not sure which of x 23 and x 32 should be equal to zero. Similarly, we have no idea of fixing which of x 24 and x 42, and of x 34 and x 43, to zero

48
48 LP Formulation of the Maximal Flow Problem We further introduce a variable x 51. Effectively we act an artificial arc from node 5 to node x 51

49
49 LP Formulation of the Maximal Flow Problem Each LP constraint matches with a physical relationship of the problem. There are two types of constraints: conservation of flow: the amount of oil into a node must be the same as the amount out of the node. bounds on flow: 0 x ij capacity of i to j flow

50
50 LP Formulation of the Maximal Flow Problem objective function: max x 51, conservation of flow node 1:x 51 = x 12 + x 13, node 2:x 12 + x 32 + x 42 = x 23 + x 24 + x 25, node 3:x 13 + x 23 + x 43 = x 32 + x 34 + x 35, node 4:x 24 + x 34 = x 42 + x 43 + x 45, node 5:x 25 + x 35 + x 45 = x 51,

51
51 LP Formulation of the Maximal Flow Problem bounds: 0 x 12 45, 0 x 13 35, 0 x 23, x 32 40, 0 x 24, x 42 25, 0 x 25 50, 0 x 34, x 43 10, 0 x 35 15, 0 x

52
52 LP Formulation of the Maximal Flow Problem Read Example 8-6 for more example.

53
53 Assignment #3 Chapter 8 Problem 1 (a), (b), plus (c) Formulate this problem as a mathematical programming model. Problem 10 Problem 16 (a) Find the maximal flow of this network, and (b) Formulate the problem as a linear program.

Similar presentations

© 2016 SlidePlayer.com Inc.

All rights reserved.

Ads by Google