17
Routing Path Optimization in Autonomous Systems James Silva Maxwell Crawford Bradley Kozelek Abstract: Three pathing algorithms are utilized and tested to optimize the path taken from a starting node to an end node in a directed acyclic graph with weights on each edge. Two of these algorithms, Dijkstra and Bellman-Ford, use a relaxation method to iterate through each path. Edmonds-Karp, a breadth- first search focused variation of Ford-Fulkerson, uses the max flow problem as a model for analyzing the minimum cut of a graph. Each of these algorithms have their merits, although the dated Dijkstra’s algorithm is found to be the least efficient, in terms of time. Keywords: Network, routing, pathing, shortest, optimization, latency Introduction: The goal of our project is to highlight a key problem faced by network administrators and routing hardware to this day, which is how to reduce net latency. Net latency is the total amount of time (measured in milliseconds) it takes for a packet to travel from source to destination. Data is carried in packets, which must “hop” through many intermediate nodes first before it can truly reach its destination. In our project, we will test the efficacy of Dijkstra’s, Bellman-Ford’s, and Edmond-Karp’s algorithm in regards to reducing latency, then we will attempt to improve upon the algorithm that fares the best. In order for a user get the data they're requesting from a server, their router needs to establish a connection from their computer to the server that the data they want is stored on. During the connection process the source router jumps from node to node within a vast network of routers that are each passed information about the end destination until it finally reaches the server that the user wishes to connect to. There are a few algorithms that achieve Last Updated: 11-29-2016 12:54pm

people.uncw.edupeople.uncw.edu/tagliarinig/Courses/380/F2016 papers and... · Web viewDist(c,n)) ∀(e) ∈ E, where q c < q p Constraints: Graph is connected from source to sink

  • Upload
    vukien

  • View
    214

  • Download
    2

Embed Size (px)

Citation preview

Page 1: people.uncw.edupeople.uncw.edu/tagliarinig/Courses/380/F2016 papers and... · Web viewDist(c,n)) ∀(e) ∈ E, where q c < q p Constraints: Graph is connected from source to sink

Routing Path Optimization in Autonomous Systems

James Silva

Maxwell Crawford

Bradley Kozelek

Abstract:

Three pathing algorithms are utilized and tested to optimize the path taken from a starting node to an end node in a directed acyclic graph with weights on each edge. Two of these algorithms, Dijkstra and Bellman-Ford, use a relaxation method to iterate through each path. Edmonds-Karp, a breadth-first search focused variation of Ford-Fulkerson, uses the max flow problem as a model for analyzing the minimum cut of a graph. Each of these algorithms have their merits, although the dated Dijkstra’s algorithm is found to be the least efficient, in terms of time.

Keywords:

Network, routing, pathing, shortest, optimization, latency

Introduction:

The goal of our project is to highlight a key problem faced by network administrators and routing hardware to this day, which is how to reduce net latency. Net latency is the total amount of time (measured in milliseconds) it takes for a packet to travel from source to destination. Data is carried in packets, which must “hop” through many intermediate nodes first before it can truly reach its destination. In our project, we will test the efficacy of Dijkstra’s, Bellman-Ford’s, and Edmond-Karp’s algorithm in regards to reducing latency, then we will attempt to improve upon the algorithm that fares the best.

In order for a user get the data they're requesting from a server, their router needs to establish a connection from their computer to the server that the data they want is stored on. During the connection process the source router jumps from node to node within a vast network of routers that are each passed information about the end destination until it finally reaches the server that the user wishes to connect to. There are a few algorithms that achieve this traversal within a network that will be addressed within this analysis; those algorithms being Dijkstra's algorithm, the Bellman-Ford algorithm and lastly the Edmonds-Karp Algorithm.

In the infancy of the internet age an algorithm such as Dijkstra's would suffice when attempting data transfers due to the low number of nodes within the network. As the internet grows with our growing cyber community so does the demand on routing paths and since there is an increasing demand on networks, route path optimization has become the primary concern.

Applying the Bellman Ford algorithm to traversing nodes within a network was an answer to this concern. When applied, the Bellman Ford algorithm makes the traversal of the network faster than Dijkstra's algorithm due to directed edges between each node but has a pitfall in that it doesn't account for the flow of traffic on a given edge caused by other users. By optimizing the routing paths, it means that there is a focus on minimizing the variables that

Last Updated: 11-29-2016 12:54pm

Page 2: people.uncw.edupeople.uncw.edu/tagliarinig/Courses/380/F2016 papers and... · Web viewDist(c,n)) ∀(e) ∈ E, where q c < q p Constraints: Graph is connected from source to sink

account for latency, otherwise the delay time from input to output.

This is why the Edmonds-Karp algorithm has become so vital to network infrastructure due to the algorithm allowing for a parameter that accounts for the network flow between each node within a network and the usage of directed edges. The implementation of each previously stated algorithm is worth analyzing to see how well each respective one can handle the loss of data, loss of nodes within a network and lastly the increase of traffic on a specific network while still maintaining an optimal net latency.

Informal Problem Statement:

Optimize the route taken by data packets in a network flow (a directed acyclic graph of nodes with connecting edges) by testing each of our three shortest path type algorithms. The potential path options will be given weights (in terms of time in milliseconds), and the path that adds up to the lowest amount of net distance (latency) will be chosen as the optimal path.

Formal Problem Statement:

Minimize the net distance (measured in latency in milliseconds) taken from the source client to the end client at the end of the path.

Given a Directed Acyclic Graph G(V,E) such that:

E = set of edges, e = edge weight(u,v)V = set of Vertices (nodes)

Dist(c,n) = distance from c to n, stored as latency in milliseconds

q = Net distance for shortest path found, qc

= current (stored) path, qp = potential pathc = current node, n = next node

s=source (start) node, t=sink (end) nodeu-v = path/edge

Minimize q (net distance for optimal path) for the equation :

• q = min(∑ Dist(c,n)) ∀(e) ∈ E, where qc < qp

Constraints:

Graph is connected from source to sink node

Data flow from source to end is completed (no data loss or interruption during iteration)

The time it took for each path will be measured in milliseconds, and each algorithm will be represented and compared, in terms of complexity, by Big O notation. The best, worst, and average results will be shown for each algorithm.

Context - Other Works:

In 1984, Michael L. Fredman and Robert Endre Tarjan introduced Fibonacci heap structures, which allow faster running times in many network optimization scenarios [1]. The worst case bound for the single-source shortest path problem, with non-negative edges, is O(n*log(n)+m), where n is number of vertices and m is number of edges. This heap, a set of items with attached keys, has insert, find, delete, and meld functions, where a key may be

Page 3: people.uncw.edupeople.uncw.edu/tagliarinig/Courses/380/F2016 papers and... · Web viewDist(c,n)) ∀(e) ∈ E, where q c < q p Constraints: Graph is connected from source to sink

used to produce an item within a certain heap. The melding function can take the conjunction of two disjoint heaps, form a new heap, and eliminate the original two heaps. Fibonacci heaps can use delete and delete min, where delete min removes an item of minimum key from a heap, in only O(log n) time. Originally they wanted to use Fibonacci heaps to enhance Dijkstra’s algorithm with regards to the single-source shortest path problem.

In 1997, Vincent D. Park and M. Scott Corson proposed a new distributed routing protocol for mobile wireless networks [2]. It was a “link reversal” type algorithm called the Temporally-Ordered Routing Algorithm. Their approach was to obtain adaptability, efficiency and scalability in dense mobile networks. The T.O.R. algorithm is meant to handle link failures by using a localized single pass and a dependence upon clock timing in order to restructure the topology. Park and Corson take into account the fact that mobile networks are often quicker to change their topology, and are more “prone to congestion” [2]. Most algorithms assume relatively static networks, with links that do not physically alter their locations. Also, many pathing algorithms return only one optimal route at a route, which could exacerbate congestion issues if that returned path is used many times over. The T.O.R. aims to “minimize reaction to topological changes” [2] and return several possible paths, without suffering from information overhead.

Steven H. Low and David E. Lapsley worked on optimization of flow control in 1999 where they worked to maximize the source utility over the transmission rates [3]. They use the gradient projection algorithm to select transmission rates and allow links to adjust their “bandwidth prices” [3] for proper coordination. The focus is “reactive flow control, where sources adjust their transmission rates in response to changes in network

conditions” [3]. Low and Lapsley show a convergence of synchronous and asynchronous flow algorithms in static networks, and how a unified algorithm emerges in a “time-varying environment” [3].

Srinivasan Keshav investigates three different protocols for flow control and tests the difference in speed, which is affected by whether the state of the network is properly monitored [4]. When delays are involved, protocols that fail to check network state, or need multiple trips to acquire optimal transmission rate, will take a hit in performance. Keshav claims the packet-pair protocol handles these issues. A fundamental issue in large, global scale networks is that that the data that the flow algorithm receives is likely to be outdated and possibly incomplete, due to newer connections being made during the delay period. Keshav evaluates generic flow control with Tahoe TCP flow control and packet-pair flow control, in conjunction with First Come First Served and Fair Queueing packet scheduling techniques.

Jennifer Rexford, during the mid 2000’s, discussed the issue of optimizing the routing policies that interact and control flow from one network to another [5]. Typically, routing protocols focus on topology and configurations, rather than traffic load on network links. Algorithms based on local search tend to be helpful in tuning routing protocols to be more efficient. Rexford confirms that routers use control messages, in a distributed fashion, to give integer link weights to protocols, which in turn provide shortest path routing. Rexford notes that the distributed approach allows adaptability to changing topologies, but does not “incorporate information about network load and performance into the selection of the paths.” [5]

Page 4: people.uncw.edupeople.uncw.edu/tagliarinig/Courses/380/F2016 papers and... · Web viewDist(c,n)) ∀(e) ∈ E, where q c < q p Constraints: Graph is connected from source to sink

Our Experiment:

a) Dijkstra’s Algorithm (Link-state)

Gets the shortest distance between a starting node and any other node in the graph G. Excludes longer distances found with each update, leaving shorter and shorter paths in the list.

Running Time: O(|E|*log(|V|))

Where: V = number of Vertices/Nodes, and E = total number of edges

Diagram Explanation:

Step 1: Assign C(A)=0 and C(x)=infinity for all other x. C(A) is cost of A, C(x) is cost of getting to node x

Step 2: Node with smallest temp value is node A (C(A)=0). Run algorithm until no temp nodes are left, or c(x) is infinity.

Step 3: Calculate to cost to get to any node connected to currently selected node. Cost is current node value + edge cost.

Step 4: Iterate by returning to Step 2; find next node x with smallest temp value of C(x). Choose that node and calculate new costs.

Continue until all nodes have been selected.

Page 5: people.uncw.edupeople.uncw.edu/tagliarinig/Courses/380/F2016 papers and... · Web viewDist(c,n)) ∀(e) ∈ E, where q c < q p Constraints: Graph is connected from source to sink

Pseudocode:Function Dijkstra(Graph, source):

Create vertex set, QFor each vertex v in Graph:

dist[v] = max_number;prev[v] = null;add v to Q

dist[source] = 0;while (Q != empty):

u = node in Q with smallest dist

remove u from Q;for each neighbor v

of u: Alt = dist[u] +

length(u,v); if (alt <

dist[v]): dist[v] = alt; prev[v] = u;

Return dist[], prev[];

Python code:

from pythonds.graphs import PriorityQueue, Graph, Vertexdef dijkstra(aGraph,start): pq = PriorityQueue()start.setDistance(0) pq.buildHeap([(v.getDistance(),v) for v in aGraph]) while not pq.isEmpty():currentVert = pq.delMin() for nextVert in currentVert.getConnections():newDist = currentVert.getDistance() \+ currentVert.getWeight(nextVert) if newDist < nextVert.getDistance():nextVert.setDistance( newDist )nextVert.setPred(currentVert) pq.decreaseKey(nextVert,newDist)

Pros:

Greedy approach might mean finding a shortest path fairly quickly, but is inconsistent

Can’t handle negative edge weights

Cons:

Greedy approach to edge relaxation means it either finds great solution right away, or much later; may not always find best solution

b) Bellman-Ford Equation (Distance vector)

Continually checks if the distance from the source to the first node plus edge length is less than the distance to the second node. If the first distance is less, than the first node is selected as the predecessor of the second node and distance to the second node is computed again. After running this loop, the shortest path is returned as a list (or tree).

Running Time: O(|V|*|E|)

Where: V = number of Vertices/Nodes, and E = total number of edges

Note that outer loop is run |V|-1 times.

Diagram Explanation:

Step 1: Node n1 sends distance vector to neighbors (n2, n3)

Page 6: people.uncw.edupeople.uncw.edu/tagliarinig/Courses/380/F2016 papers and... · Web viewDist(c,n)) ∀(e) ∈ E, where q c < q p Constraints: Graph is connected from source to sink

Step 2: Node n2 sends distance vector to its neighbors (n1, n3, n5)

Step 3: Node n4 sends distance vector to its neighbors (n1, n5)

Step 4: Node n3 sends distance vector to its neighbors (n2, n5)

Page 7: people.uncw.edupeople.uncw.edu/tagliarinig/Courses/380/F2016 papers and... · Web viewDist(c,n)) ∀(e) ∈ E, where q c < q p Constraints: Graph is connected from source to sink

Step 5: Node n5 sends distance vector to its neighbors (n2, n3, n4)

Step 6: Update all tables of distance information (graph is now “stable”)

Pseudocode:function BellmanFord(Graph G, Vertex source) for i in 1 to number of vertices do distance[i] = max_value predecessors[i] = null distance[source] = 0

for i in 1 to (number of vertices-1) do for each Edge e in Edges(G) do if distance[e.prev] + length(e) < distance[e.next] do

distance[e.next] = distance[e.prev] + length(e)

predecessors[e.prev] =e.next for each Edge e in Edges(G) do if distance[e.prev] + length(e) < distance[e.next] do error("Graph contains cycles of negative length") return predecessors //list, or tree, of shortest path

Pros:

Page 8: people.uncw.edupeople.uncw.edu/tagliarinig/Courses/380/F2016 papers and... · Web viewDist(c,n)) ∀(e) ∈ E, where q c < q p Constraints: Graph is connected from source to sink

Can handle negative edge weights Since it relaxes all edges, always finds

best path or solution

Cons:

Must update an internal table of neighbors; some overhead

Runs ‘relaxation’ on ALL possible edges; |V|-1 iterations needed

c) Edmonds-Karp Algorithm

Uses a flow network, which is a directed graph G=(V,E) such that each edge has a non-negative capacity c(u,v)≥0. In the graph G, the Source (s) vertex has in-degree of 0, and the Sink (t) vertex has out-degree of 0. The flow value |f| = Σ f(s,v) = Σ f(v,t), where the summations are of vertices in the total set of vertices in graph G, s=source node, v=current vertex, t=sink node, and f=current flow.

For each edge (u,v) in E, the flow f(u,v) is a function that is satisfies 3 conditions:

1) Capacity Constraint : u,v V, f(u,v) c(u,v)

2) Skew Symmetry : u,v V, f(u,v)= -f(v,u)

3) Flow Conservation: u V – {s,t} f(s,v)=0 vV

Running Time: O(|V|*|E|2) – worst case

Where: V = number of Vertices/Nodes, and E = total number of edges

Note that Breadth-First Search can take O(|E|) time in a graph where vertices have at least one edge.

Diagram Explanation:

Step 1: Pick an s->t path on a residual network (Gf) of flow network G

Step 2: On Gf, update s->b->c->t path, then pick new (s->t) path: s->a->t

Step 3: On Gf, update s->a->t path, then pick s->d->t path

Step 4: On Gf, update s->d->t path, then choose last path: s->a->c->b->d->t

Page 9: people.uncw.edupeople.uncw.edu/tagliarinig/Courses/380/F2016 papers and... · Web viewDist(c,n)) ∀(e) ∈ E, where q c < q p Constraints: Graph is connected from source to sink

Step 5: On Gf, update last path. No more (s->t) paths available! Calculate flow pushed: 8+5+5+3=21, which is the max flow in G.

Pseudocode:

Function minCut(Graph G, node s, node t):f=0, Gf = G; //initialize flow and flow graph

while Gf has u-v path P do: Run BFS on Gf to visit each u-v path Let P be a u-v path in Gf with the min. number of edges Augment f using P Update Gfend whilereturn f

[6]Where: G=graph, Gf=flow/residual graph, f=current flow, s=source node, t=sink node, E(G)=edges in the graph, u,v=current nodes, P=path

Pros:

Uses BFS and minimum-cuts to reduce the number of iterations needed to evaluate all paths

Does not need to keep or update a table of neighbors; has minimal overhead

Cons:

BFS can sometimes, although rarely, but less effective than DFS, depending on length and branching factor of a path

Results and Conclusions:

We tested our three main algorithms across two cases for our results. The first “base case” was a simple traceroute example with 20 nodes, varying latencies, and no branching factor. The second “Breadth-3” case had a maximum branching factor of 3, and had relatively close values for latency.

For each case, a NODE is a server hop, with out-degree “weights”, which are the distance measured (equivalent to latency in ms)

1) “Base Case” Graph

NODE 1 = SOURCE, NODE 20 = SINK/END

Page 10: people.uncw.edupeople.uncw.edu/tagliarinig/Courses/380/F2016 papers and... · Web viewDist(c,n)) ∀(e) ∈ E, where q c < q p Constraints: Graph is connected from source to sink

Trial #

Dijkstra Bellman-Ford

Edmonds-Karp

1 52.001 40.001 242 54.006 40 183 52.001 42.001 244 49.995 39.996 185 52 44.001 186 54.006 42.001 187 54.001 39.994 188 48.001 41.996 189 52.001 47.996 1610 52.007 48 18

AVG 52.0019 42.5986 19

NOTE: LOWER IS BETTER

Results:

Dijkstra is 3rd place, Bellman-Ford is 2nd place, Edmonds-Karp is 1st place

Bellman-Ford is, on average, 9.4033 ms faster than Dijkstra

Edmonds-Karp is, on average, 23.5986 ms faster than Bellman-Ford

2) Breadth-3 Graph

NODE 1 = SOURCE, NODE 14 = SINK/END

Trial #

Dijkstra Bellman-Ford

Edmonds-Karp

1 52.001 15.995 202 50.006 16 163 48.001 15.995 164 48.001 14 145 50.001 15.995 146 50.001 16 167 48.006 16 168 45.996 15.994 169 47.995 18 1610 47.996 15.995 14

AVG 48.8004 15.9974 15.8

NOTE: LOWER IS BETTER

Results:

Dijkstra is 3rd place, Bellman-Ford is 2nd place, Edmonds-Karp is 1st place

Page 11: people.uncw.edupeople.uncw.edu/tagliarinig/Courses/380/F2016 papers and... · Web viewDist(c,n)) ∀(e) ∈ E, where q c < q p Constraints: Graph is connected from source to sink

Bellman-Ford is, on average, 32.803 ms faster than Dijkstra

Edmonds-Karp is, on average, 0.1974 ms faster than Bellman-Ford

NOTE: Bellman-Ford was extremely close to Edmonds-Karp’s score in this case!

Overall Comparison

Base Case

Dijkstra Bellman-Ford

Edmonds-Karp

Best 48.001 39.994 16Worst 54.006 48 24Average 52.0019 42.5986 19

Breadth Graph

Dijkstra Bellman-Ford

Edmonds-Karp

Best 45.996 14 14Worst 52.001 18 20Average 48.8004 15.9974 15.8

Overall, Edmonds-Karp was consistently faster than the other two, with Bellman-Ford coming close in the Breadth-3 case. Dijkstra’s greedy iteration fell short compared to Bellman-Ford’s linear relaxation on all edges. Dijkstra’s greed may have caused the algorithm to check some edges more than once, as each node had its neighbors and branching neighbors checked.

As for Edmonds-Karp, breaking up the graph into residual graph “cuts” may have itself worthy in increasing the efficiency, especially in linear cases. However, since Bellman-Ford and Edmonds-Karp ran in such similar times, it may be worth further experimentation and tweaking in order to further improve these algorithms.

Future Work:

Rather than use Edmonds-Karp as a basis for max flow, it may be beneficial to use Dinic’s Algorithm instead for O(V2E) base running time instead. Comparing the net latency of Dinic's Algorithm to the net latency of Edmonds-Karp Algorithm may produce some very contrasting results depending on the network layout. Dinic's Algorithm doubles the number of vertices during its implementation which could prove to having a faster run time than Edmonds-Karp algorithm because Edmonds-Karp doubles the number of edges in it's implementation. In a network layout where all the vertices have a significantly larger amount of edges than vertices, the run time of Dinic's Algorithm could potentially prove that it can handle the max flow problem much better than Edmonds-Karp Algorithm could.

Other possible future applications of this research could include applying these algorithms to other real world problems such as finding the quickest or least congested route while navigating via GPS on a driverless vehicle depending on the user's constraints. Applying a max flow algorithm such as Edmonds-Karp to smart car technology has potential to lower net travel time as well alleviate traffic jams. After seeing the analysis of Bellman-Ford and Edmonds-Karp efficiency showing that there is a very close relationship in terms of net latency between the two algorithms it would important to see if that same close relationship would exist in the net travel time of an automated vehicle.

Page 12: people.uncw.edupeople.uncw.edu/tagliarinig/Courses/380/F2016 papers and... · Web viewDist(c,n)) ∀(e) ∈ E, where q c < q p Constraints: Graph is connected from source to sink

Questions:

1. What is a routing protocol?

A: A routing protocol establishes a 'grammar' in which nodes that exist in a network must adhere to in order to provide information needed for varying routing algorithms.

2. Is Dijkstra a Link-State or Distance-Vector Routing Protocol? What's the difference between Link-State and Distance-Vector Routing Protocols?

A: Dijkstra is a Link-State Routing Protocol. Nodes in Link-State broadcast to all other nodes in network. Nodes in Distance-Vector broadcast only to their respective neighbors.

3. What can the Bellman-Ford algorithm handle that Dijkstra cannot?

A: Negative edge weights

4. Is Edmonds-Karp a Distance-Vector Routing Algorithm or a Link-State Routing Algorithm?

A: Distance-Vector.

5. What distinguishes Ford-Fulkerson from Edmonds-Karp?

A: The difference between the Ford-Fulkerson and Edmonds-Karp algorithms is the utilization of a breadth first search in order to decrease the time complexity.

Sources:

[1] http://www.cs.princeton.edu/courses/archive/fall03/cs528/handouts/fibonacci%20heaps.pdf

[2] https://www.cs.cornell.edu/people/egs/615/park97highly.pdf

[3] http://netlab.caltech.edu/publications/ofc1_ToNREM1999.pdf

[4] http://blizzard.cs.uwaterloo.ca/keshav/home/Papers/data/92/pp_inet.pdf

[5] https://www.cs.princeton.edu/~jrex/papers/opthand04.pdf

[6] http://www.cs.cornell.edu/courses/cs4820/2011sp/handouts/edmondskarp.pdf

Page 13: people.uncw.edupeople.uncw.edu/tagliarinig/Courses/380/F2016 papers and... · Web viewDist(c,n)) ∀(e) ∈ E, where q c < q p Constraints: Graph is connected from source to sink

Group Member Assignments

Name ResponsibilitiesMaxwell Crawford Implementation/testing of the Ford-Fulkerson (Edmonds-Karp) algorithm,

organization of the paper and shared online resources for the projectJames Silva Implementation/testing of the Bellman-Ford algorithm, collection and

organization of data sets for our experimentationBradley Kozelek Implementation/testing of Dijkstra’s algorithm, organization and

implementation of presentations and its material