Network Design and Optimization course Lecture 2 Alberto Ceselli - - PowerPoint PPT Presentation

network design and optimization course
SMART_READER_LITE
LIVE PREVIEW

Network Design and Optimization course Lecture 2 Alberto Ceselli - - PowerPoint PPT Presentation

Routing (not so) basics Modeling All pairs shortest paths in practice Network Design and Optimization course Lecture 2 Alberto Ceselli alberto.ceselli@unimi.it Dipartimento di Tecnologie dellInformazione Universit` a degli Studi di


slide-1
SLIDE 1

university-logo Routing (not so) basics Modeling All pairs shortest paths in practice

Network Design and Optimization course

Lecture 2 Alberto Ceselli alberto.ceselli@unimi.it

Dipartimento di Tecnologie dell’Informazione Universit` a degli Studi di Milano

October 4th, 2011

  • A. Ceselli, DTI – Univ. of Milan

Network Design and Optimization course

slide-2
SLIDE 2

university-logo Routing (not so) basics Modeling All pairs shortest paths in practice Building a routing table

The problem

Given an existing network I want to build a routing table, that is decide which links to use (route) for connecting each pair of nodes maximizing the overall quality of service (e.g. minimizing delay or power loss)

  • A. Ceselli, DTI – Univ. of Milan

Network Design and Optimization course

slide-3
SLIDE 3

university-logo Routing (not so) basics Modeling All pairs shortest paths in practice Building a routing table

Assumptions

Some assumptions:

1 all packets must be routed on the same links, 2 the capacity of each link is enough for any connection request, 3 connections using the same links at the same time do not

interfere. N.B. imposing (1), or assuming that link usage cost does not depend on the amount of traffic routed is the same; conditions (2) and (3) are linked when using packet routing.

  • A. Ceselli, DTI – Univ. of Milan

Network Design and Optimization course

slide-4
SLIDE 4

university-logo Routing (not so) basics Modeling All pairs shortest paths in practice Building a routing table

Recognizing a known problem ...

We are facing an All Pairs Shortest path problem!

  • A. Ceselli, DTI – Univ. of Milan

Network Design and Optimization course

slide-5
SLIDE 5

university-logo Routing (not so) basics Modeling All pairs shortest paths in practice Modeling costs A graph-based model A simple all pairs shortest path algorithm More efficient all pair shortest path computations

Modeling the costs

Step 1: estimating link usage costs. How? Know your network; make suitable assumptions and simplifications! (see examples from previous slides).

  • A. Ceselli, DTI – Univ. of Milan

Network Design and Optimization course

slide-6
SLIDE 6

university-logo Routing (not so) basics Modeling All pairs shortest paths in practice Modeling costs A graph-based model A simple all pairs shortest path algorithm More efficient all pair shortest path computations

Network model

Given a network, build a graph G = (V , E) having

  • ne vertex i ∈ V for each node of the network
  • ne edge e ∈ E for each link of the network

costs ce on each arc e ∈ E prizes gv on each node v ∈ V a special vertex s ∈ V representing the origin of packets a special vertex t ∈ V representing the destination of packets Question for you: how to find shortest paths between all pairs of vertices in a graph?

  • A. Ceselli, DTI – Univ. of Milan

Network Design and Optimization course

slide-7
SLIDE 7

university-logo Routing (not so) basics Modeling All pairs shortest paths in practice Modeling costs A graph-based model A simple all pairs shortest path algorithm More efficient all pair shortest path computations

Floyd Warshall algorithm

1 int cost[][]; 2 3 // initialize cost[i][j] to c(i,j) 4 5 procedure FloydWarshall () 6 for k := 1 to |V| 7 for i := 1 to |V| 8 for j := 1 to |V| 9 cost[i][j] = 10 min(cost[i][j],cost[i][k]+cost[k][j]);

  • A. Ceselli, DTI – Univ. of Milan

Network Design and Optimization course

slide-8
SLIDE 8

university-logo Routing (not so) basics Modeling All pairs shortest paths in practice Modeling costs A graph-based model A simple all pairs shortest path algorithm More efficient all pair shortest path computations

Floyd Warshall correctness proof

Theorem: FW returns the shortest path matrix Proof: By invariants .

  • A. Ceselli, DTI – Univ. of Milan

Network Design and Optimization course

slide-9
SLIDE 9

university-logo Routing (not so) basics Modeling All pairs shortest paths in practice Modeling costs A graph-based model A simple all pairs shortest path algorithm More efficient all pair shortest path computations

Floyd Warshall correctness proof

Theorem: FW returns the shortest path matrix Proof: By invariants Before iteration k, cost[i][j] is the cost of the shortest path connecting i and j, and using only vertices in 1 . . . k (besides i and j themselves).

  • A. Ceselli, DTI – Univ. of Milan

Network Design and Optimization course

slide-10
SLIDE 10

university-logo Routing (not so) basics Modeling All pairs shortest paths in practice Modeling costs A graph-based model A simple all pairs shortest path algorithm More efficient all pair shortest path computations

Floyd Warshall correctness proof

By induction base: at step 1 cost[i][j] = c(i,j) step:

  • A. Ceselli, DTI – Univ. of Milan

Network Design and Optimization course

slide-11
SLIDE 11

university-logo Routing (not so) basics Modeling All pairs shortest paths in practice Modeling costs A graph-based model A simple all pairs shortest path algorithm More efficient all pair shortest path computations

Floyd Warshall correctness proof

By induction base: at step 1 cost[i][j] = c(i,j) → OK! step:

  • A. Ceselli, DTI – Univ. of Milan

Network Design and Optimization course

slide-12
SLIDE 12

university-logo Routing (not so) basics Modeling All pairs shortest paths in practice Modeling costs A graph-based model A simple all pairs shortest path algorithm More efficient all pair shortest path computations

Floyd Warshall correctness proof

By induction base: at step 1 cost[i][j] = c(i,j) → OK! step:

at step k, cost[i][j] is the SP among i and j using vertices 1 . . . k

  • A. Ceselli, DTI – Univ. of Milan

Network Design and Optimization course

slide-13
SLIDE 13

university-logo Routing (not so) basics Modeling All pairs shortest paths in practice Modeling costs A graph-based model A simple all pairs shortest path algorithm More efficient all pair shortest path computations

Floyd Warshall correctness proof

By induction base: at step 1 cost[i][j] = c(i,j) → OK! step:

at step k, cost[i][j] is the SP among i and j using vertices 1 . . . k case (1): at step k + 1, cost[i][j] is also the SP using vertices 1 . . . k + 1 (no update)

  • A. Ceselli, DTI – Univ. of Milan

Network Design and Optimization course

slide-14
SLIDE 14

university-logo Routing (not so) basics Modeling All pairs shortest paths in practice Modeling costs A graph-based model A simple all pairs shortest path algorithm More efficient all pair shortest path computations

Floyd Warshall correctness proof

By induction base: at step 1 cost[i][j] = c(i,j) → OK! step:

at step k, cost[i][j] is the SP among i and j using vertices 1 . . . k case (1): at step k + 1, cost[i][j] is also the SP using vertices 1 . . . k + 1 (no update) case (2): at step k + 1, cost[i][j] is obtained going from i to k + 1 (using only vertices 1..k) and from k + 1 to j (same thing)

  • A. Ceselli, DTI – Univ. of Milan

Network Design and Optimization course

slide-15
SLIDE 15

university-logo Routing (not so) basics Modeling All pairs shortest paths in practice Modeling costs A graph-based model A simple all pairs shortest path algorithm More efficient all pair shortest path computations

Floyd Warshall correctness proof

By induction base: at step 1 cost[i][j] = c(i,j) → OK! step:

at step k, cost[i][j] is the SP among i and j using vertices 1 . . . k case (1): at step k + 1, cost[i][j] is also the SP using vertices 1 . . . k + 1 (no update) case (2): at step k + 1, cost[i][j] is obtained going from i to k + 1 (using only vertices 1..k) and from k + 1 to j (same thing) → only vertices 1 . . . k + 1 are involved.

  • A. Ceselli, DTI – Univ. of Milan

Network Design and Optimization course

slide-16
SLIDE 16

university-logo Routing (not so) basics Modeling All pairs shortest paths in practice Modeling costs A graph-based model A simple all pairs shortest path algorithm More efficient all pair shortest path computations

Floyd Warshall rebuild path

0 // init cost[i][j] to c(i,j) and next[i][j] to ’null’ 1 procedure FloydWarshallWithPathReconstruction () 2 for k := 1 to |V| 3 for i := 1 to |V| 4 for j := 1 to |V| 5 if cost[i][k] + cost[k][j] < cost[i][j] then 6 cost[i][j] := cost[i][k] + cost[k][j]; 7 next[i][j] := k; 8 9 procedure Path(i,j) 10 if cost[i][j] equals infinity then return "NoPath"; 11 if next[i][j] equals ’null’ then 12 return " "; /* no vertices between i and j */ 13 else 14 return 15 Path(i,next[i][j])+next[i][j]+Path(next[i][j],j);

  • A. Ceselli, DTI – Univ. of Milan

Network Design and Optimization course

slide-17
SLIDE 17

university-logo Routing (not so) basics Modeling All pairs shortest paths in practice Modeling costs A graph-based model A simple all pairs shortest path algorithm More efficient all pair shortest path computations

Floyd Warshall algorithm: complexity

1 int cost[][]; 2 3 // initialize cost[i][j] to c(i,j) 4 5 procedure FloydWarshall () 6 for k := 1 to |V| 7 for i := 1 to |V| 8 for j := 1 to |V| 9 cost[i][j] = 10 min(cost[i][j],cost[i][k]+cost[k][j]);

  • A. Ceselli, DTI – Univ. of Milan

Network Design and Optimization course

slide-18
SLIDE 18

university-logo Routing (not so) basics Modeling All pairs shortest paths in practice Modeling costs A graph-based model A simple all pairs shortest path algorithm More efficient all pair shortest path computations

Floyd Warshall algorithm: complexity

1 int cost[][]; 2 3 // initialize cost[i][j] to c(i,j) 4 5 procedure FloydWarshall () 6 for k := 1 to |V| 7 for i := 1 to |V| 8 for j := 1 to |V| 9 cost[i][j] = 10 min(cost[i][j],cost[i][k]+cost[k][j]); Complexity O(|V |3)

  • A. Ceselli, DTI – Univ. of Milan

Network Design and Optimization course

slide-19
SLIDE 19

university-logo Routing (not so) basics Modeling All pairs shortest paths in practice Modeling costs A graph-based model A simple all pairs shortest path algorithm More efficient all pair shortest path computations

Johnson’s Algorithm

See Orlin’s slides

  • A. Ceselli, DTI – Univ. of Milan

Network Design and Optimization course

slide-20
SLIDE 20

university-logo Routing (not so) basics Modeling All pairs shortest paths in practice

All pairs shortest paths algorithm implementation

Let’s compute all pair shortest paths algorithms in AMPL ...

  • A. Ceselli, DTI – Univ. of Milan

Network Design and Optimization course