assignment3_solution

Operations Research

Lecture 0:Assignment 3

Notes taken by Kaiquan Xu

Due Date:Dec 29th 2012

Exercise https://www.360docs.net/doc/262177003.html,e Ford-Fulkerson algorithm to ?nd the maximum ?ow from s to t in Figure(1)(50credits).

Figure 1:Ford-Fulkerson Example {values near edges are capacities(current ?ows)}

Solution

Using the labelling algorithm to ?nd the augmenting path:

1.I ={s }.Node s is scanned.Since f sv 1=u sv 1,v 1can not be labeled,but f sv 2

2.I ={v 2}.Node v 2is scanned.Only v 1is labelled,v 3,v 4can not be labeled,since f v 2v 3=0,f v 2v 4=u v 2v 4.

3.I ={v 1}.Node v 1is scanned.v 3is labelled,since f v 1v 3

4.I ={v 3}.Node v 3is scanned.v 4is labelled,since f v 4v 3>0,but t can not be labeled since of f v 3t =u v 3t .

5.I ={v 4}.Node v 4is scanned.t is labelled,since f v 4t

So we get the augmenting path:s →v 2→v 1→v 3→v 4→t

The amount to push is:

δ(P )=min {min (i,j )∈F (u ij ?f ij ),min (i,j )∈B

f ij }=1After updatin

g the ?ow wit

h adding 1unit on the augmenting path,the ?gure is as follows:

Figure 2:Ford-Fulkerson Example }

In fact,we can not ?nd any augmenting path again.So the maximum ?ow from s to t is 14.

1

Exercise https://www.360docs.net/doc/262177003.html,e Dijkstra algorithm to ?nd the shortest path from v 1to v 7in Figure(3)(50credits).

Figure 3:Dijkstra Example

1.Node v 5is connected with v 7and has shortest path.So we have l =v 5and p ?v 5=3.Then c v 2v 7=min {∞,7+3}=10,c v 4v 7=min {∞,6+3}=9,c v 6v 7=min {6,1+3}=4are modi?ed.

2.Now we eliminate Node 3,and get the following ?gure 4.

Figure 4:Dijkstra Example

3.Node v 6is connected with v 7and has shortest path.So we have l =v 6and p ?v 6=

4.Then c v 3v 7=min {∞,4+4}=8is modi?ed.

4.Now we eliminate Node 6,and get the following ?gure

5.

Figure 5:Dijkstra Example

5.Node v 3is connected with v 7and has shortest path.So we have l =v 3and p ?v 3=8.Then c v 1v 7=min {∞,2+8}=10is modi?ed.

4.Now we eliminate Node 3,and get the following ?gure 6.

Figure 6:Dijkstra Example

2

5.Node v4is connected with v7and has shortest path.So we have l=v4and p?v

=9.But no path length is updated.

4

4.Now we eliminate Node4,and get the following?gure7.

Figure7:Dijkstra Example

=10.But no path length is updated.

5.Node v2is connected with v7and has shortest path.So we have l=v2and p?v

2

4.Now we eliminate Node2,and get the following?gure8.

Figure8:Dijkstra Example

The shortest path from v1to v7is10.

3

相关主题