Download presentation
1
Optimisation Methods Network Models
2
Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points, or vertices. The vertices of a graph or network are also called nodes. An arc consists of an ordered pair of vertices and represents a possible direction of motion that may occur between vertices. A sequence of arcs such that every arc has exactly one vertex in common with the previous are is called a chain.
3
Basic Definitions A path is a chain in which the terminal node of each arc is identical to the initial node of next arc. For example in the figure below: (1,2)-(2,3)-(4,3) is a chain but not a path; (1,2)-(2,3)-(3,4) is a chain and a path, which represents a way to travel from node 1 to node 4. 2 3 1 4
4
Minimum Spanning Tree Problems
Suppose that each arc (i,j) in a network has a length associated with it and that arc (i,j) represents a way of connecting node i to node j. In many applications it must be determined that the set of arcs in a network that connects all nodes such that the sum of the length of the arcs is minimized. Clearly, such a group of arcs contain no loop. For a network with n nodes, a spanning tree is a group of n-1 arcs that connects all nodes of the network and contains no loops.
5
Minimum Spanning Tree Problems
A spanning tree of minimum length in a network is a minimum spanning tree (MST). The MST Algorithm may be used to find a minimum spanning tree. Begin at any node i, and join node i to the node in the network (call it node j) that is closest to node i. The two nodes i and j now form a connected set of nodes C={i,j}, and arc (i,j) will be in the minimum spanning tree. The remaining nodes in the network (call them Ć) are referred to as the unconnected set of nodes.
6
Minimum Spanning Tree Algorithm
Now choose a member of C’ (call it n) that is closest to some node in C. Let m represent the node in C that is closest to n. Then the arc(m,n) will be in the minimum spanning tree. Now update C and C’. Since n is now connected to {i,j}, C now equals {i,j,n} and we must eliminate node n from C’. Repeat this process until a minimum spanning tree is found. Ties for closest node and arc to be included in the minimum spanning tree may be broken arbitrarily.
7
Example 1: MST Algorithm
The State University campus has five computers. The distances between each pair of computers are given. What is the minimum length of cable required to interconnect the computers? Note that if two computers are not connected this is because of underground rock formations. 4 2 5 3 1 6
8
Example 1: Solution We want to find the minimum spanning tree. 1 2 6 5
Iteration 1: Following the MST algorithm discussed before, arbitrarily choose node 1 to begin. The closest node is node 2. Now C={1,2}, Ć={3,4,5}, and arc(1,2) will be in the minimum spanning tree. 4 2 5 3 1 6
9
Ex. 1 – Solution continued
Iteration 2: Node 5 is closest to C. Since node 5 is two blocks from node 1 and node 2, we may include either arc(2,5) or arc(1,5) in the minimum spanning tree. We arbitrarily choose to include arc(2,5). Then C={1,2,5} and Ć={3,4}. 4 2 5 3 1 6
10
Ex. 1 – Solution continued
Iteration 3: Since node 3 is two blocks from node 5, we may include arc(5,3) in the minimum spanning tree. Now C={1,2,5,3} and Ć={4}. 4 2 5 3 1 6
11
Ex. 1 – Solution continued
Iteration 4: Node 5 is the closest node to node 4. Thus, we add arc(5,4) to the minimum spanning tree. The minimum spanning tree consists of arcs(1,2), (2,5), (5,3), and (5,4). The length of the minimum spanning tree is =9 blocks. 4 2 5 3 1 6
12
Example 2
13
Example 2: Solution Start by arbitrarily selecting node 1.
Since the nearest node is the third node at a distance of 2 (200 feet), connect node 1 to node 3. Shown 2 slides hence. Considering nodes 1 and 3, look for the next-nearest node. This is node 4, which is the closest to node 3 with a distance of 2 (200 feet). Once again, connect these nodes (3 slides hence).
14
Ex. 2 – Solution continued
15
Ex. 2 – Solution continued
16
Ex. 2 – Solution continued
17
Ex. 2 – Solution continued
18
Ex. 2 – Solution continued
Nodes 1, 2, 4, and 6 are all connected to node 3. Node 2 is connected to node 5. Node 6 is connected to node 8, and node 8 is connected to node 7. All of the nodes are now connected. The total distance is found by adding the distances for the arcs used in the spanning tree. In this example, the distance is: = 16 (or 1,600 feet).
19
Shortest Path Problems
Assume that each arc in the network has a length associated with it. The problem of finding the shortest path from node 1 to any other node in the network is called a shortest path problem.
20
Dijkstra's Shortest Path Algorithm
Assuming that all arc lengths are non-negative, Dijkstra’s algorithm, can be used to find the shortest path from a node. Finding the shortest path between node i and node j in a network may be viewed as a trans-shipment problem. The trans-shipment problem can then easily be solved by using LINGO.
21
Dijkstra's Shortest Path Algorithm
Find the nearest node to the origin (plant). Put the distance in a box by the node. Find the next-nearest node to the origin (plant), and put the distance in a box by the node. In some cases, several paths will have to be checked to find the nearest node. Repeat this process until you have gone through the entire network. The last distance at the ending node will be the distance of the shortest route.
22
Example 3: Equipment Replacement
Assume that a new car (or machine) has been purchased for $12,000 at time 0. The cost of maintaining the car during a year depends on the age of the car at the beginning of the year, as given in the table below. Age of Car (Years) Annual Maintenance cost Trade-in Price $2,000 1 $7,000 $4,000 2 $6,000 $5,000 3 $9,000 4 $1,000 $12,000 5 $0
23
Ex. 3 - continued In order to avoid the high maintenance cost associated with an older car, we may trade in the car and purchase a new car. To simplify the computations we assume that at any time it costs $12,000 to purchase a new car. The goal is to minimize the net cost incurred during the next five years.
24
Example 3: Solution This problem should be formulated as a shortest path problem. The network will have six nodes. Node i is the beginning of year i and for i<j, an arc (i,j) corresponds to purchasing a new car at the beginning of year i and keeping it until the beginning of year j. The length of arc (i,j) (call it cij) is the total net cost incurred from year i to j. cij = maintenance cost incurred during years i,i+1,…,j cost of purchasing a car at the beginning of year i trade-in value received at the beginning of year j
25
Ex. 3 – Solution continued
Applying this formula to the information the problem yields c12=2+12-7=7 c13= =12 c14= =21 c15= =31 c16= =44 c23=2+12-7=7 c24= =12 c25= =21 c26= =31 c34=2+12-7=7 c35= =12 c36= =21 c45=2+12-7=7 c46= =12 c56=2+12-7=7
26
Ex. 3 – Solution continued
From the figure below we can see that both path and will give us the shortest path with a value of 31. 1 6 5 4 3 2 7 21 12 31 44
27
Example: From Ray’s Plant to Warehouse
For example, Every day, Ray Design, Inc., must transport beds, chairs, and other furniture items from the factory to the warehouse. This involves going through several cities. Ray would like to find the route with the shortest distance. The road network is shown on the next slide.
28
Dijkstra's Shortest Path Algorithm
Roads from Ray’s Plant to Warehouse: 1 2 3 4 5 6 100 150 200 50 40 Warehouse Plant
29
Dijkstra's Shortest Path Algorithm
100 1 2 3 4 5 6 100 150 200 50 40 Warehouse Plant The nearest node to the plant is node 2, with a distance of 100 miles. Thus, connect these two nodes. Ray Design: 1st Iteration
30
Dijkstra's Shortest Path Algorithm
1 2 3 4 5 6 100 150 200 50 40 The nearest node to the plant is node 3, with a distance of 50 miles. Thus, connect these two nodes. Ray Design: 2nd Iteration
31
Dijkstra's Shortest Path Algorithm
1 2 3 4 5 6 100 150 200 50 40 190 The nearest node to the plant is node 5, with a distance of 40 miles. Thus, connect these two nodes. Ray Design: 3rd Iteration
32
Dijkstra's Shortest Path Algorithm
1 2 3 4 5 6 100 150 200 50 40 190 290 Total Shortest Route = = 290 miles. 4th and Final Iteration
33
Dijkstra's Shortest Path Algorithm
Find shortest path from s to t. 2 24 3 9 s 18 14 2 6 6 4 30 19 11 15 5 5 6 20 16 t 7 44
34
Dijkstra's Shortest Path Algorithm
PQ = { s, 2, 3, 4, 5, 6, 7, t } 2 24 3 9 s 18 14 2 6 6 30 4 19 11 15 5 5 6 20 16 t 7 44 distance label
35
Dijkstra's Shortest Path Algorithm
PQ = { s, 2, 3, 4, 5, 6, 7, t } delmin 2 24 3 9 s 18 14 2 6 6 4 30 19 11 15 5 5 6 20 16 t 7 44 distance label
36
Dijkstra's Shortest Path Algorithm
PQ = { 2, 3, 4, 5, 6, 7, t } decrease key X 9 2 24 3 9 s 18 14 X 14 2 6 6 4 30 19 11 15 5 5 6 20 16 t 7 44 distance label 15 X
37
Dijkstra's Shortest Path Algorithm
PQ = { 2, 3, 4, 5, 6, 7, t } delmin X 9 2 24 3 9 s 18 14 X 14 2 6 6 4 30 19 11 15 5 5 6 20 16 t 7 44 distance label 15 X
38
Dijkstra's Shortest Path Algorithm
PQ = { 3, 4, 5, 6, 7, t } X 9 2 24 3 9 s 18 14 X 14 2 6 6 4 30 19 11 15 5 5 6 20 16 t 7 44 15 X
39
Dijkstra's Shortest Path Algorithm
PQ = { 3, 4, 5, 6, 7, t } decrease key X 33 X 9 2 24 3 9 s 18 14 X 14 2 6 6 30 4 19 11 15 5 5 6 20 16 t 7 44 15 X
40
Dijkstra's Shortest Path Algorithm
PQ = { 3, 4, 5, 6, 7, t } X 33 X 9 2 24 3 9 delmin s 18 14 X 14 2 6 6 30 4 19 11 15 5 5 6 20 16 t 7 44 15 X
41
Dijkstra's Shortest Path Algorithm
PQ = { 3, 4, 5, 7, t } 32 X 33 X X 9 2 24 3 9 s 18 14 X 14 2 6 6 44 30 X 4 19 11 15 5 5 6 20 16 t 7 44 15 X
42
Dijkstra's Shortest Path Algorithm
PQ = { 3, 4, 5, 7, t } 32 X 33 X X 9 2 24 3 9 s 18 14 X 14 2 6 6 44 X 4 30 19 11 15 5 5 6 20 16 t 7 44 15 delmin X
43
Dijkstra's Shortest Path Algorithm
PQ = { 3, 4, 5, t } 32 X 33 X X 9 2 24 3 9 s 18 14 X 14 2 6 6 44 X 35 30 X 4 19 11 15 5 5 6 20 16 t 7 44 59 15 X X
44
Dijkstra's Shortest Path Algorithm
delmin S = { s, 2, 6, 7 } PQ = { 3, 4, 5, t } 32 X 33 X X 9 2 24 3 9 s 18 14 X 14 2 6 6 44 X 35 4 30 X 19 11 15 5 5 6 20 16 t 7 44 59 15 X X
45
Dijkstra's Shortest Path Algorithm
PQ = { 4, 5, t } 32 X 33 X X 9 2 24 3 9 s 18 14 X 14 2 6 6 44 X 35 X 34 30 X 4 19 11 15 5 5 6 20 16 t 7 44 51 59 15 X X X
46
Dijkstra's Shortest Path Algorithm
PQ = { 4, 5, t } 32 X 33 X X 9 2 24 3 9 s 18 14 X 14 2 6 6 44 X 35 X 34 30 X 4 19 11 15 5 5 6 20 delmin 16 t 7 44 51 59 15 X X X
47
Dijkstra's Shortest Path Algorithm
PQ = { 4, t } 32 X 33 X X 9 2 24 3 9 s 18 14 X 14 2 6 6 45 44 X 35 X 34 X 30 X 4 19 11 15 5 5 6 20 16 t 7 44 50 51 15 X 59 X X X
48
Dijkstra's Shortest Path Algorithm
PQ = { 4, t } 32 X 33 X X 9 2 24 3 9 s 18 14 X 14 2 6 6 44 X 35 45 X 34 X 4 30 X 19 11 15 5 delmin 5 6 20 16 t 7 44 50 51 59 15 X X X X
49
Dijkstra's Shortest Path Algorithm
PQ = { t } 32 X 33 X X 9 2 24 3 9 s 18 14 X 14 2 6 6 45 44 X 35 X 34 X 30 X 4 19 11 15 5 5 6 20 16 t 7 44 50 51 15 X 59 X X X
50
Dijkstra's Shortest Path Algorithm
PQ = { t } 32 X 33 X X 9 2 24 3 9 s 18 14 X 14 2 6 6 45 44 X 35 X 34 X 4 30 X 19 11 15 5 5 6 20 16 t 7 44 delmin 50 51 59 15 X X X X
51
Dijkstra's Shortest Path Algorithm
S = { s, 2, 3, 4, 5, 6, 7, t } PQ = { } 32 X 33 X X 9 2 24 3 9 s 18 14 X 14 2 6 6 45 44 X 35 X 34 X 30 X 4 19 11 15 5 5 6 20 16 t 7 44 50 51 X 59 15 X X X
52
Dijkstra's Shortest Path Algorithm
S = { s, 2, 3, 4, 5, 6, 7, t } PQ = { } 32 X 33 X X 9 2 24 3 9 s 18 14 X 14 2 6 6 45 44 X 35 X 34 X 30 X 4 19 11 15 5 5 6 20 16 t 7 44 50 51 X 59 15 X X X
53
Maximum Flow Problems Many situations can be modeled by a network in which the arcs may be thought of as having a capacity that limits the quantity of a product that may be shipped through the arc. In these situations, it is often desired to transport the maximum amount of flow from a starting point (called the source) to a terminal point (called the sink). These types of problems are called maximum flow problems.
54
material coursing through a system from a source to a sink
55
Flow networks: A flow network G=(V,E): a directed graph, where each edge (u,v)E has a nonnegative capacity c(u,v)>=0. If (u,v)E, we assume that c(u,v)=0. two distinct vertices :a source s and a sink t. s t 16 12 20 10 4 9 7 13 14
56
Flow: G=(V,E): a flow network with capacity function c.
s-- the source and t-- the sink. A flow in G: a real-valued function f:V*V R satisfying the following two properties: Capacity constraint: For all u,v V, we require f(u,v) c( u,v). Flow conservation: For all u V-{s,t}, we require
57
Net flow and value of a flow f:
The quantity f (u,v) is called the net flow from vertex u to vertex v. The value of a flow is defined as The total flow from source to any other vertex. The same as the total flow from any vertex to the sink.
58
Example Flow 12/12 s t 15/20 11/16 10 1/4 4/9 7/7 8/13 4/4 11/14
A flow f in G with value
59
Example 4: Maximum Flow Sunco Oil wants to ship the maximum possible amount of oil (per hour) via pipeline from node so to node si. The various arcs represent pipelines of different diameters. The maximum number of barrels of oil that can be pumped through each arc the arc capacity. Arc Capacity (so,1) 2 (so,2) 3 (1,2) (1,3) 4 (3,si) 1 (2,si) so si 2 1 (2)2 (2)3 (0)3 a0(2) 3 (0)4 (0)1
60
Ex. 4 - Continued Formulate an LP that can be used to determine the maximum number of barrels of oil per hour that can be send from so to si.
61
Example 4: Solution An artificial arc called a0 is added from the sink to the source. First determine the decision variable xij = Millions of barrels of oil per hour that will pass through arc(i,j) of pipeline. For a flow to be feasible it must have two characteristics: 0 <= flow through each arc <= arc capacity Flow into node i = Flow out from node i
62
Ex. 4 – Solution continued
Let x0 be the flow through the artificial arc, the conservation of flow implies that x0 = total amount of oil entering the sink. Sunco’s goal is to maximize x0. One optimal solution to this LP is Z=3, xso,1=2, x13=1, x12=1, xso,2=1, x3,si=1, x2,si=2, xo=3. Max Z= X0 S.t. Xso,1<=2 (Arc Capacity constraints) Xso,2<=3 X12<=3 X2,si<=2 X13<=4 X3,si<=1 X0=Xso,1+Xso,2 (Node so flow constraints) Xso,1=X12+X13 (Node 1 flow constraints) Xso,2+X12=X2,si (Node 2 flow constraints) X13=X3,si (Node 3 flow constraints) X3,si+X2,si=X0 (Node si flow constraints) Xij>=0
63
Some Basic Definitions
Choose any set of nodes V’ that contains the sink but does not contain the source. Then the set of arcs (i,j) with i not in V’ and j a member of V’ is a cut for the network. The capacity of a cut is the sum of the capacities of the arcs in the cut. The flow from source to sink for any feasible flow is less than or equal to the capacity of any cut.
64
The Ford-Fulkerson method
A “method” rather than an “algorithm” because it encompasses several implementations with different running times.The Ford-Fulkerson method depends on three important ideas that transcend the method and are relevant to many flow algorithms and problems: residual networks, augmenting paths, and cuts. These ideas are essential to the important max-flow min-cut theorem,which characterizes the value of maximum flow in terms of cuts of the flow network.
65
Continue: FORD-FULKERSON-METHOD(G,s,t) initialize flow f to 0
while there exists an augmenting path p do augment flow f along p return f
66
Ford-Fulkerson Example 1
Initialise all flows to zero (a feasible solution) and identify an augmenting path. Take which has a min arc capacity of 2. This produces the flow diagram on the right.
67
Ford-Fulkerson Example 1
Take 1–3-5-6 as the next augmenting path which has a min excess capacity of 3. This gives the flow diagram on the right.
68
Ford-Fulkerson Example 1
Take 1–2-4-6 as the next augmenting path which has a min excess capacity of 3. This gives the flow diagram on the right.
69
Ford-Fulkerson Example 1
Take 1– as the next augmenting path which has a min excess capacity of 1. This gives the flow diagram on the right with a max-flow of 9.
70
Ford-Fulkerson Termination
A cut in a network is a set of arcs which, if they are removed, there is no path from source to sink.
71
Ford-Fulkerson Termination
The capacity of a cut is defined to be the sum of the capacities of every arc in the cut. The capacity of the following cut is 23.
72
Ford-Fulkerson Termination
Max-Flow Min-Cut Theorem: In every network, the maximum flow equals the minimum capacity cut. As the cut identified on the previous slide had a capacity of 23 and the max-flow identified on the previous slides was 9 this means that either this is not the max-flow or this is not the minimum capacity cut.
73
Ford-Fulkerson Termination
Other cuts
74
Augmenting Paths Let s=a1 and t=an. An undirected path of vertices a1a2…an, with no repetitions, from s to t, is called an augmenting path if One of (ai,ai+1) or (ai+1,ai) is a directed edge in the network If (ai,ai+1) is an element of E then f(ai,ai+1) < C(ai,ai+1) If (ai+1,ai) is an element of E then f (ai+1,ai) >0 s,d,b,a,t is an augmenting path
75
Augmenting Paths
76
Augmenting Paths
77
Ford-Fulkerson Example 2
78
Ford-Fulkerson Example 2
79
Ford-Fulkerson Example 2
80
Ford-Fulkerson Example 2
81
Ford-Fulkerson Example 2
82
Ford-Fulkerson Example 2
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.