network models optimisation methods. 2 basic definitions a graph or network is defined by two sets...

82
Network Models Optimisation Methods

Post on 20-Dec-2015

217 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

Network Models

Optimisation Methods

Page 2: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

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.

Page 3: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

3

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

Basic Definitions

Page 4: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

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.

Page 5: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

5

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.

Minimum Spanning Tree Problems

Page 6: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

6

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.

Minimum Spanning Tree Algorithm

Page 7: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

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

45

1

3

2

2

24

Page 8: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

8

Example 1: Solution

We want to find the minimum spanning tree. 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

4

5

1

3

2

2

2

4

Page 9: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

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

4

5

1

3

2

2

2

4

Page 10: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

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

4

5

1

3

2

2

2

4

Page 11: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

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 1+2+2+4=9 blocks.

4

2

5

3

1

6

4

5

1

3

2

2

2

4

Page 12: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

12

Example 2

Page 13: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

13

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).

Example 2: Solution

Page 14: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

14

Ex. 2 – Solution continued

Page 15: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

15

Ex. 2 – Solution continued

Page 16: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

16

Ex. 2 – Solution continued

Page 17: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

17

Ex. 2 – Solution continued

Page 18: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

18

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:

2 + 2 + 3 + 3 + 3 + 1 + 2 = 16 (or 1,600 feet).

Ex. 2 – Solution continued

Page 19: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

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.

Page 20: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

20

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.

Dijkstra's Shortest Path Algorithm

Page 21: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

21

1. Find the nearest node to the origin (plant). Put the distance in a box by the node.

2. 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.

3. 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.

The last distance at the ending node will be the distance of the shortest route.

Dijkstra's Shortest Path Algorithm

Page 22: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

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

Age of Car (Years)

Trade-in Price

0 $2,000 1 $7,000

1 $4,000 2 $6,000

2 $5,000 3 $2,000

3 $9,000 4 $1,000

4 $12,000 5 $0

Page 23: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

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.

Page 24: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

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-

1 + cost of purchasing a car at the beginning of year i - trade-in value received at the beginning of year j

Page 25: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

25

Ex. 3 – Solution continued

Applying this formula to the information the problem yields

c12=2+12-7=7c13=2+4+12-6=12c14=2+4+5+12-2=21c15=2+4+5+9+12-1=31

c16=2+4+5+9+12+12-0=44c23=2+12-7=7c24=2+4+12-6=12c25=2+4+5+12-2=21

c26=2+4+5+9+12-1=31c34=2+12-7=7c35=2+4+12-6=12c36=2+4+5+12-2=21

c45=2+12-7=7c46=2+4+12-6=12c56=2+12-7=7

Page 26: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

26

Ex. 3 – Solution continued

From the figure below we can see that both path 1-3-5-6 and 1-2-4-6 will give us the shortest path with a value of 31.

1 654327 7 7 7 7

21

12

12

21

31

12

21

31

44

12

Page 27: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

27

Example: From Ray’s Plant to Warehouse

For example,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.

Page 28: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

28

Roads from Ray’s Plant to Warehouse:Roads from Ray’s Plant to Warehouse:

1

2

3

4

5

6100

100

100

100

150

200

50

40

200

Warehouse

Plant

Dijkstra's Shortest Path Algorithm

Page 29: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

29Ray Design: 1Ray Design: 1stst Iteration Iteration

The nearest node to the plant is node 2, with a distance of 100 miles.

Thus, connect these two nodes.

1

2

3

4

5

6100

100

100

100

150

200

50

40

200

Warehouse

Plant100

Dijkstra's Shortest Path Algorithm

Page 30: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

30Ray Design: 2nd IterationRay Design: 2nd Iteration

The nearest node to the plant is node 3, with a distance of 50 miles.

Thus, connect these two nodes.

1

2

3

4

5

6100

100

100

100

150

200

50

40

200100

150

Dijkstra's Shortest Path Algorithm

Page 31: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

31Ray Design: 3rd IterationRay Design: 3rd Iteration

The nearest node to the plant is node 5, with a distance of 40 miles.

Thus, connect these two nodes.

1

2

3

4

5

6100

100

100

100

150

200

50

40

200100

150 190

Dijkstra's Shortest Path Algorithm

Page 32: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

3244thth and Final Iteration and Final Iteration

1

2

3

4

5

6

100

100

100

100

150

200

50

40

200100

150 190

290

Total Shortest Route =100 + 50 + 40 + 100 = 290 miles.

Dijkstra's Shortest Path Algorithm

Page 33: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

33

Dijkstra's Shortest Path Algorithm

Find shortest path from s to t.

s

3

t

2

6

7

4

5

24

18

2

9

14

15 5

30

20

44

16

11

6

19

6

Page 34: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

34

s

3

t

2

6

7

4

5

24

18

2

9

14

15 5

30

20

44

16

11

6

19

6

0

distance label

S = { }PQ = { s, 2, 3, 4, 5, 6, 7, t }

Dijkstra's Shortest Path Algorithm

Page 35: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

35

s

3

t

2

6

7

4

5

24

18

2

9

14

15 5

30

20

44

16

11

6

19

6

0

distance label

S = { }PQ = { s, 2, 3, 4, 5, 6, 7, t }delmin

Dijkstra's Shortest Path Algorithm

Page 36: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

36

s

3

t

2

6

7

4

5

24

18

2

9

14

15 5

30

20

44

16

11

6

19

6

15

9

14

0

distance label

S = { s }PQ = { 2, 3, 4, 5, 6, 7, t }decrease key

X

X

X

Dijkstra's Shortest Path Algorithm

Page 37: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

37

s

3

t

2

6

7

4

5

24

18

2

9

14

15 5

30

20

44

16

11

6

19

6

15

9

14

0

distance label

S = { s }PQ = { 2, 3, 4, 5, 6, 7, t }

X

X

X

delmin

Dijkstra's Shortest Path Algorithm

Page 38: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

38

s

3

t

2

6

7

4

5

24

18

2

9

14

15 5

30

20

44

16

11

6

19

6

15

9

14

0

S = { s, 2 }PQ = { 3, 4, 5, 6, 7, t }

X

X

X

Dijkstra's Shortest Path Algorithm

Page 39: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

39

s

3

t

2

6

7

4

5

24

18

2

9

14

15 5

30

20

44

16

11

6

19

6

15

9

14

0

S = { s, 2 }PQ = { 3, 4, 5, 6, 7, t }

X

X

X

decrease key

X 33

Dijkstra's Shortest Path Algorithm

Page 40: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

40

s

3

t

2

6

7

4

5

24

18

2

9

14

15 5

30

20

44

16

11

6

19

6

15

9

14

0

S = { s, 2 }PQ = { 3, 4, 5, 6, 7, t }

X

X

X

X 33

delmin

Dijkstra's Shortest Path Algorithm

Page 41: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

41

s

3

t

2

6

7

4

5

24

18

2

9

14

15 5

30

20

44

16

11

6

19

6

15

9

14

0

S = { s, 2, 6 }PQ = { 3, 4, 5, 7, t }

X

X

X

X 33

44X

X

32

Dijkstra's Shortest Path Algorithm

Page 42: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

42

s

3

t

2

6

7

4

5

24

18

2

9

14

15 5

30

20

44

16

11

6

19

6

15

9

14

0

S = { s, 2, 6 }PQ = { 3, 4, 5, 7, t }

X

X

X

44X

delmin

X 33X

32

Dijkstra's Shortest Path Algorithm

Page 43: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

43

s

3

t

2

6

7

4

5

18

2

9

14

15 5

30

20

44

16

11

6

19

6

15

9

14

0

S = { s, 2, 6, 7 }PQ = { 3, 4, 5, t }

X

X

X

44X

35X

59 X

24

X 33X

32

Dijkstra's Shortest Path Algorithm

Page 44: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

44

s

3

t

2

6

7

4

5

24

18

2

9

14

15 5

30

20

44

16

11

6

19

6

15

9

14

0

S = { s, 2, 6, 7 }PQ = { 3, 4, 5, t }

X

X

X

44X

35X

59 X

delmin

X 33X

32

Dijkstra's Shortest Path Algorithm

Page 45: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

45

s

3

t

2

6

7

4

5

24

18

2

9

14

15 5

30

20

44

16

11

6

19

6

15

9

14

0

S = { s, 2, 3, 6, 7 }PQ = { 4, 5, t }

X

X

X

44X

35X

59 XX 51

X 34

X 33X

32

Dijkstra's Shortest Path Algorithm

Page 46: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

46

s

3

t

2

6

7

4

5

18

2

9

14

15 5

30

20

44

16

11

6

19

6

15

9

14

0

S = { s, 2, 3, 6, 7 }PQ = { 4, 5, t }

X

X

X

44X

35X

59 XX 51

X 34

delmin

X 33X

32

24

Dijkstra's Shortest Path Algorithm

Page 47: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

47

s

3

t

2

6

7

4

5

18

2

9

14

15 5

30

20

44

16

11

6

19

6

15

9

14

0

S = { s, 2, 3, 5, 6, 7 }PQ = { 4, t }

X

X

X

44X

35X

59 XX 51

X 34

24

X 50

X 45

X 33X

32

Dijkstra's Shortest Path Algorithm

Page 48: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

48

s

3

t

2

6

7

4

5

18

2

9

14

15 5

30

20

44

16

11

6

19

6

15

9

14

0

S = { s, 2, 3, 5, 6, 7 }PQ = { 4, t }

X

X

X

44X

35X

59 XX 51

X 34

24

X 50

X 45

delmin

X 33X

32

Dijkstra's Shortest Path Algorithm

Page 49: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

49

s

3

t

2

6

7

4

5

18

2

9

14

15 5

30

20

44

16

11

6

19

6

15

9

14

0

S = { s, 2, 3, 4, 5, 6, 7 }PQ = { t }

X

X

X

44X

35X

59 XX 51

X 34

24

X 50

X 45

X 33X

32

Dijkstra's Shortest Path Algorithm

Page 50: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

50

s

3

t

2

6

7

4

5

18

2

9

14

15 5

30

20

44

16

11

6

19

6

15

9

14

0

S = { s, 2, 3, 4, 5, 6, 7 }PQ = { t }

X

X

X

44X

35X

59 XX 51

X 34

X 50

X 45

delmin

X 33X

32

24

Dijkstra's Shortest Path Algorithm

Page 51: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

51

s

3

t

2

6

7

4

5

24

18

2

9

14

15 5

30

20

44

16

11

6

19

6

15

9

14

0

S = { s, 2, 3, 4, 5, 6, 7, t }PQ = { }

X

X

X

44X

35X

59 XX 51

X 34

X 50

X 45

X 33X

32

Dijkstra's Shortest Path Algorithm

Page 52: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

52

s

3

t

2

6

7

4

5

24

18

2

9

14

15 5

30

20

44

16

11

6

19

6

15

9

14

0

S = { s, 2, 3, 4, 5, 6, 7, t }PQ = { }

X

X

X

44X

35X

59 XX 51

X 34

X 50

X 45

X 33X

32

Dijkstra's Shortest Path Algorithm

Page 53: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

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.

Page 54: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

54•material coursing through a system from a source to a sink

Page 55: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

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

413

14

Page 56: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

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

vine voute

efef.. ..

)()(

Page 57: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

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.

Vv

vsff ),(

Page 58: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

58

s t

11/16

12/12

15/20

10 1/4 4/9 7/7

4/48/13

11/14

A flow f in G with value . 19f

Example Flow

Page 59: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

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.

so si21(2)2 (2)3 (2)2

(0)3

a0(2)

3(0)4 (0)1

Arc Capacity

(so,1) 2

(so,2) 3

(1,2) 3

(1,3) 4

(3,si) 1

(2,si) 2

Page 60: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

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.

Page 61: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

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

Page 62: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

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= X0S.t. Xso,1<=2 (Arc Capacity constraints)

Xso,2<=3X12<=3X2,si<=2X13<=4X3,si<=1X0=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

Page 63: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

63

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.

Some Basic Definitions

Page 64: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

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.

Page 65: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

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

Page 66: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

66

Initialise all flows to zero (a feasible solution) and identify an augmenting path. Take 1-3-6 which has a min arc capacity of 2. This produces the flow diagram on the right.

Ford-Fulkerson Example 1

Page 67: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

67

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.

Ford-Fulkerson Example 1

Page 68: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

68

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.

Ford-Fulkerson Example 1

Page 69: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

69

Take 1–2-4-5-6 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.

Ford-Fulkerson Example 1

Page 70: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

70

A cut in a network is a set of arcs which, if they are removed, there is no path from source to sink.

Ford-Fulkerson Termination

Page 71: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

71

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.

Ford-Fulkerson Termination

Page 72: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

72

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.

Ford-Fulkerson Termination

Page 73: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

73

Other cuts

Ford-Fulkerson Termination

Page 74: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

74

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

1. One of (ai,ai+1) or (ai+1,ai) is a directed edge in the network

2. If (ai,ai+1) is an element of E then f(ai,ai+1) < C(ai,ai+1)

3. If (ai+1,ai) is an element of E then f (ai+1,ai) >0

Augmenting Paths

s,d,b,a,t is an augmenting path

Page 75: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

75

Augmenting Paths

Page 76: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

76

Augmenting Paths

Page 77: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

77

Ford-Fulkerson Example 2

Page 78: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

78

Ford-Fulkerson Example 2

Page 79: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

79

Ford-Fulkerson Example 2

Page 80: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

80

Ford-Fulkerson Example 2

Page 81: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

81

Ford-Fulkerson Example 2

Page 82: Network Models Optimisation Methods. 2 Basic Definitions A graph or network is defined by two sets of symbols: nodes and arcs. A set (call it V) of points,

82

Ford-Fulkerson Example 2