lecture 2. recapitulation algorithm complexity analysis point to point routing algorithms...

69
Lecture 2

Upload: loreen-simon

Post on 17-Dec-2015

225 views

Category:

Documents


1 download

TRANSCRIPT

Lecture 2

Recapitulation

• Algorithm complexity analysis

• Point to point routing algorithms– Dijkstra– Bellman-Ford

Questions?

Todays Class

• Flloyd Warshalls algorthm– Instance of dynamic programming

• Johnsons algorithm– Sparse graphs

• Throughput Optimum routing and scheduling– wireless

– Wireline

• Term project ideas

Next Class

• Quality of service routing

Dynamic Programming

• Break the main problem in sub-problems

• Express the optimum solution of the main problem in terms of those of the sub-problems

• Solve the sub-problems recursively

• Combine the solutions of the subproblems to solve the main problem

Principle of Optimality

• The global problem is solved optimally only if all sub-problems are solved optimally

• Holds for shortest path problem– Any segment of a shortest path is a shortest

path between the corresponding source and destination

• May not always hold

Counter-Example

• For a different criterion for ``shortest path’’, every segment of a shortest path may not be a shortest path

• Weight of a path is the maximum weight of a link in the path

SourceDestination

Path 1

Path 2

1 1.5

0.5 2.5

Weight of path 1 = 1.5

Weight of a path is the minimum bandwidth available in the path

– Select a path with maximum bandwidth

5

1 1

1 3u v w

p1

p2

Another counter example

• Optimize x1 + x2 + x3

Subject to:

x1 + x2 <= 1

x1 + x3 <= 1

Will not be able to solve by solving subproblems

Back to shortest paths

• Order the vertices as 1,…..,k

• is the shortest path weight between i and j under the condition that the intermediate vertices are 1,….,k

dk

ij

),min(111

ddddk

kj

k

ik

k

ij

k

ij

wd ijij0

is the shortest path weight between vertices i and jd

V

ij

||

Flloyd-Warshalls Algorithm

• Finds shortest paths between all pairs of vertices (if there are no negative weight cycles)

– O(|V|3)

• Shortest paths between all pairs by other algorithms

– Dijkstra O(V. (Vlog V + E)) (better for sparse graphs)

– Bellman-ford O(V.VE)

Pseudo-Code for FlloydWarshall

For i = 1 to V

For j = 1 to V

wd ijij0

For k = 1 to V

For i = 1 to V

For j = 1 to V

),min(

111

ddddk

kj

k

ik

k

ij

k

ij

Complexity analysis

• 3 nested loops

• Each loop is executed V times

• Hence, O(V3)

Johnsons Algorithm

• Let the graph be sparse

• It is a better idea to run Dijkstras algorithm V times

• However, Dijkstras algorithm operates only for edges with nonnegative weights

• Can we change the edge weights to make them nonnegative?

• But under reweighing shortest paths might change

• So we need to reweigh such that the shortest paths remain the same with the new weights– Shortest path weights may change though

Reweighing scheme

wnew(u,v) = w(u,v) + h(u) – h(v)

Let h(u) be a real number associated with vertex u (we will discuss later how to choose them)

Let us compute the weight of any path p under this new scheme

p = (v0, v1,…..vk-1, vk)

wnew(p) = w(v0 ,v1) + h(v0) – h(v1) + w(v1 ,v2) + h(v1) – h(v2)+…

+ w(vk-2 ,vk-1) + h(vk-2) – h(vk-1) + w(vk_1 ,vk) + h(vk-1) – h(vk)

wnew(p) = w(v0 ,v1) + w(v1 ,v2) +… + w(vk-2 ,vk-1) + w(vk_1 ,vk) + h(v0) – h(vk)

wnew(p) = w(p) + h(v0) – h(vk)

Under the new weighting scheme, weight of every path between v0 and vk is incremented by constant amount (decremented if the constant is negeative).

So shortest paths remain the same under the new weights.

Still need to ensure that weight of every edge is nonnegative

wnew(u,v) = w(u,v) + h(u) – h(v) >= 0

Will add a node s to the existing network, and add an edge from s to every node .

•Weight of new edges are 0

p(s,u) is the shortest path weight between s and u under the old weights.

h(u) =p(s,u) (Is p(s,u) always 0?)

Will choose h(u)s appropriately

wnew(u,v) = w(u,v) + p(s, u) – p(s,v) >= 0

p(s,v) <= p(s,u) + w(u,v)

Johnsons Algorithm

• Start with the original graph• Add the new vertex s and the new edges with 0 weight to

all other vertices• Run Bellman-ford with source s, and original weights to

compute shortest path weights p(s,v) to every vertex v.– Can we run Dijkstra instead?

• Compute the new weights for the original edges:– wnew(u,v) = w(u,v) + p(s, u) – p(s,v)– Can get rid of the new vertex and edges at this point

• Run Dijkstra to compute the shortest paths

Complexity Analysis

• Adding new vertex and edges takes O(V)

• Bellman-ford takes O((V+1)(V + E)) or O(V(V + E))

• Computing the new weights takes O(E)

• Dijkstras algorithm takes O(V(VlogV + E))

• O(V + V(V + E) + V(VlogV + E))– O(V(VlogV + E))

Why choose shortest paths at all?

• Minimize cost• Maximize ``system performance’’• However, there is no guarantee that choosing

shortest paths would maximize system performance– Suppose path weights are propagation delays– All connections would follow the minimum weight path– Overload and congestion in minimum weight paths– Increase in overall delay

• So our target should be paths which optimize system performance

• System performance– Delay– Throughput (traffic carried by the network)

• Also, system performance would increase if sessions are allowed to split traffic between several paths

SourceDestination

Path 1

Path 2

1 1.5

0.5 2.5

Capacity of path 1 = 1 Mb/s

Capacity of path 2 = 0.5 Mb/s

If only one path can be used by the session, traffic served at the rate 1 Mb/s

If both paths can be used, traffic served at the rate 1.5 Mb/s

• Earlier we were choosing the shortest path among all given paths

• But some paths may not be inherently good– Unreliable (packet loss, security hazard)– Expensive

• So now we impose the condition that a session needs to transmit its traffic through a few pre-selected paths, but it can split its traffic through all of them

• The set of pre-selected paths may be different for different sessions

SourceDestination

Path 1

Path 23 session s between this source destination pair

Session 1 likes both paths, and splits traffic between them

Session 2 likes path 1 only

Session 3 likes path 2 only

• Preselected paths are given to the sessions• Routing decision needed for splitting traffic

– which packet to send along which path

• Scheduling decision needed to decide service order of packets

• Objective is to maximize system performance– throughput

Throughput

• Throughput for a particular session is the rate at which traffic is served out of the session destination

Source 1Destination 1

Path 1

Path 2

Source 2

Destination 2

• So throughput is a vector– There are multiple sessions using the network

• What does throughput maximization mean?

maximize sum of the throughputs?

• We will rather try to attain any ``attainable’’ throughput

Attainable Throughput

• Links have bandwidth limitation• This means any throughput vector can not be

attained• A throughput vector (a1, a2,….aN) is attainable if every

session i generates traffic at rate ai and the network is not overloaded.

• A throughput vector is attainable if the session traffics can be routed so that link bandwidths are not exceeded

SourceDestination

Path 1

Path 2

1 1.5

0.5 2.5

Capacity of path 1 = 1 Mb/s

Capacity of path 2 = 0.5 Mb/s

If only one path can be used by the session, maximum session 1 throughput is 1 Mb/s

If both paths can be used, maximum session 1 throughput is 1.5 Mb/s

N sessions:

If throughput vector (a1, a2,….aN) is attainable

Session n has Mn paths

for all edges eth of

en session

th tree

link crosses

m, n: m

m

na Ce

aaa a n

2

n

1

n.....n

M na

m

n

The traffic an of nth session can be split to the Mn paths that may carry session n traffic in proportion

(capacity condition)

e

2

1

1

11 aaa

aa1

22

a1

1 a1

2+ < 1

a1

a2S1 D1

a1

1

a2

1

D2

S2

Let Bu(t) be the queue length at node u at time t.

It can be shown that if the arrival rates do not satisfy the attainability conditions, and the arrival process is

Markov or

Stationary Ergodic

Then uBu(t) as t almost surely, independent of the routing and scheduling decisions.

(``almost surely’’ means probability of this taking place is 1)

Is it possible to devise a routing and scheduling strategy which will deliver any attainable throughput?

Suppose session n generates traffic at rate an and (a1, a2,….aN) constitutes some attainable throughput. Can my routing and scheduling policy guarantee that the output is this attainable throughput?

``A framework for routing and congestion control in multicast networks’’, S. Sarkar and L. Tassiulas, INFOCOM’ 1999

Intuitively, if throughput is not attainable, then system can not deliver the throughput.

Is the converse true?

Answer is ``Yes’’

Next, we will present a routing and scheduling policy which does that.

Routing Policy

• When a packet comes, route it along the least congested path.

• Congestion in a path depends upon the number of packets waiting for service along the nodes

SourceDestination

Path 1

Path 2

For routing decision we will consider the number of packets waiting at the source node only (queue lengths at the source node).

S1 D1

B1(t)

B2(t)

B1(t) is the number of packets routed to the blue tree, and waiting at the source node

B2(t) is the number of packets routed to the green tree, and waiting at the source node

When a packet comes, decide which path it will be routed to

A packet arriving at time t is routed to the blue tree if B1(t) <= B2(t) , else it is routed to the green tree

Intuitive or Counter-Intuitive?

• How about if we make the queue lengths at the source node reflective of the congestion in the entire path?

• We will use scheduling to do so– Service order for packets

– More than one session may traverse a tree

– At one slot, link can serve only one packet

– Which session does the link serve?

– Which packet of the session should be served?

Difference of Backlog Based Scheduling

Biu(t) is the number of packets of session i waiting at node u at time t (node u backlog) (Biu(t) =0 if u is destination of session i)

Consider a link e with source node u and destination node v

u v

For every session i traversing e, evaluate the difference in the source and destination backlogs (Biu(t) - Biv(t)) at any slot t

Select the session which has the maximum value of this quantity

Serve this session if the difference in backlog is positive for this session, else idle the link for the current slot

Example

u v

session 1

session 2B1u(t)=2, B2u(t)=3, B1v(t)=1, B2v(t)=1

Session 2 scheduled

u v

session 1

session 2B1u(t)=1, B2u(t)=1, B1v(t)=3, B2v(t)=2

No session scheduled

session 1

session 2u vB1u(t)=3, B2u(t)=2, B1v(t)=1, B2v(t)=1

Session 1 scheduled

eS1 D1

D2

S2

Intuition

A buildup for a path in a node causes a similar buildup at the preceding node and so on

As a result, a congested path has a huge buildup at the source, and is not selected for sometime till the congestion eases

During scheduling different paths of the same session are treated like different sessions even when they share edges.

Features of This Policy • Throughput optimal

Suppose session n generates traffic at rate an and (a1, a2,….aN) is also the output under some routing and scheduling policy (traffic rate vector satisfies attainability conditions)

Then the optimal routing and scheduling policy should also guarantee that the output is (a1, a2,….aN)

The queue lengths at the buffers have finite.

• Routing and scheduling decisions can be taken at per packet/per slot basis or in intervals

• Computationally simple

• Local information based• Asynchronous• Adaptive• Implicit feedback

• What are the links?– wireline– wireless

• What are the distinctions between wireline and wireless transmission?

• Transmission is over radio spectrum• Scarce resources

– Bandwidth– Power

• Mobility• Unreliable links• Interference u v

w x

• In wireline, contention is between sessions sharing a link

• In wireless, contention is between all sessions in a neighborhood

• Normally, there is one radio per mobile terminal– At most a limited number of radios

• A node can either receive or transmit at a time, but not both

In wireline, all 3 links can transmit at the same time

In wireless, at any time, either links e1 and e2 link e3 can be active

On account of interference and radio limitations,

Certain links can not be activated simultaneously (e1 and e2)

Only certain subsets of links can be activated simultaneously. These are called ``activation sets’’

Activation sets: {e1} , {e2 }, {e3 },{e1 , e3}

For wireline, every subset of the set of links is an activation set.

u v x ye1 e2e3

Assumptions

• Ignore mobility• Ignore power constraints• Ignore packet losses• Consider constraints due to interference and radio

limitations• Study the same problem as for the wireline case

– Preselected paths are given to the sessions– Routing decision needed for splitting traffic

• which packet to send along which path

– Objective is to maximize system throughput

• Can we get a routing and scheduling policy which attains any ``attainable’’ throughput?

• ``Stability Properties of Constrained Queueing Systems and Scheduling Policies for Maximum Throughput in Multihop Radio Networks’’,L. Tassiulas and A. Ephremides, IEEE Transactions in Automatic Control, 1992

• Charecterization of ``attainable’’ throughput– Little messy

Throughput Optimal Routing and Scheduling

Suppose session n generates traffic at rate an and (a1, a2,….aN) is also the output under some routing and scheduling policy.

Then the optimal routing and scheduling policy should also guarantee that the output is (a1, a2,….aN)

Problem Under Study

• Preselected paths are given to the sessions

• Routing decision needed for splitting traffic– which packet to send along which path

• Scheduling decision needed to decide service order of packets

• Objective is to maximize system throughput

Routing

• Same as for wireline case

• Select the path which has minimum queue length at the source node

S1 D1

B1(t)

B2(t)

Scheduling: Wireline CaseConstraints in wireline case:

Only one session can be served in a link at a time

Any combination of links allowed

In every link we choose the session which has the maximum difference in backlog, if this quantity is positive,

Otherwise we do not choose any session in the link

So, we actually choose the combination which has the maximum value for the total difference in backlog

Let the difference in backlog of a link be the maximum difference in backlog of any session traversing the link

Scheduling: Wireless case

Let the difference in backlog of a link be the maximum difference in backlog of any session traversing the link

We choose the activation set which has the maximum value for the total difference in backlog

Total difference in backlog of an activation set is the sum of the difference in backlogs of the links in the set.

Schedule every link in the activation set

For any activated link, serve the session which has the maximum difference in backlog for the link.

Example

u v x ye1 e2e3

Session 1

Session 2

Backlog of e2 = 6

Backlog of e1 = 1

Backlog of e3 = 1

Activate link e2, session 2

Activation sets: {e1} , {e2 }, {e3 },{e1 , e3}

Verify that no link with negative value of the maximum difference in backlogs is activated

No session is served in a link where the difference in backlog for the link is negative

What is the complexity of the routing?

What is the complexity of the scheduling?

wireline

wireless

Complexity Analysis

• Routing is O(MN)– N is the number of sessions– M is the maximum number of preselected

routes for any sessions

• Scheduling for wireline is O(EN)• Scheduling for wireless depends on the

structure of the activation sets– Worst case exponential complexity

–Special case like if there is no interference constraints, but only number of radio constraints (a node can either transmit or receive only)

Every activation set is a matching

Finding the activation set which is to be scheduled is equivalent to finding the maximum weighted matching O(V3)

Overall complexity in this case is O(NE +V3)

Features of This Policy • Throughput optimal

Suppose session n generates traffic at rate an and (a1, a2,….aN) is also the output under some routing and scheduling policy (satisfies some attainability conditions).

Then the optimal routing and scheduling policy should also guarantee that the output is (a1, a2,….aN)

The queue lengths at the buffers have a probability distribution.

• Routing and scheduling decisions can be taken at per packet/per slot basis or in intervals

• Not Computationally simple

• Not Local information based• Asynchronous• Adaptive• Implicit feedback• Contribution of this policy:

– At least we now know, that there exists some optimal policy ( a policy which nobody can beat in terms of throughput)

Characterize the Attainable Throughput Region

• Activation Vector• For every subset of links, we can have an

``indicator vector’’ indicating which links belong to the subset

• The indicator vector has E components, and every component is either 0 or 1.

• A component is 1 only if the corresponding edge belongs to the subset.

Indicator vector will have 3 components

The indicator vector for the subset {e1 , e2} is (1,1,0)

u v x ye1 e2e3

Activation vector is an indicator vector for an activation set

Consider an interval of T slots

The subset of link schedule in any slot is an activation set

So we should get average activation time for each link by summing up the activation vectors scheduled and dividing each component of the vector by T

u v x ye1 e2e3

First 2 slots schedule (e1, e3). Activation vector (1,0,1)

Third slot schedule e2 Activation vector (0,1,0)

Repeat this cycle

Average activation times are (2/3, 1/3, 2/3)

If you sum up (1,0,1), (1,0,1), (0,1,0), (1,0,1), (1,0,1), (0,1,0), …. All through T slots, and divide each component by T, will get close to (2/3, 1/3, 2/3)

Average time a link is used must be component-wise less than or equal to a convex combination of activation vectors

Average load a link can tolerate is the product of its link capacity and the average time it is active

(reminds of Littles law?)

For wireline case, the only constraint on the average time is that it is less than or equal to 1

Average load of a link depends on how we split the session traffic into the preselected paths.

Assume that all link capacities are 1. Thus average load equals average time in every link.

Intuitively, a throughput vector is sustainable, if we can somehow split the input traffic of different sessions into corresponding paths, such that the vector of average load of a link is component-wise less than or equal to the convex combination of some activation vectors

Intuitively, a throughput vector is sustainable, if we can somehow split the input traffic of different sessions into corresponding paths, such that the vector of average load of a link normalized by the link capacity is component-wise less than or equal to the convex combination of some activation vectors

N sessions:

If throughput vector (a1, a2,….aN) is attainable, then the following must hold:

Session n has Mn paths

for all edges eth of

en session

th tree

link crosses

m, n: m

m

na xe

aaa a n

2

n

1

n.....n

M na

m

n

the traffic an of nth session can be split to the Mn paths that may carry session n traffic in proportion such that

(capacity condition)

and for some convex combination x of activation vectors,

(1/Ce)

It can be shown that if the arrival rates do not satisfy the attainability conditions, and the arrival process is

Markov or

Stationary Ergodic

Then uBu(t) as t almost surely, independent of the routing and scheduling decisions.

• The routing and scheduling policy just presented achieves any throughput vector which satisfies the attainability property.

Given a throughput vector, how do we know whether it is attainable or not?

Generate traffic at the rates in the vector, and see whether the buffers blow up or not.

Possible, but need to wait a long time before any conclusion can be drawn

For wireline case, this can be verified using the attainability conditions, and a linear program in polynomial complexity

For wireless case, we need to find a convex combination of the activation vectors which satisfies the mentioned conditions.

We can do so using a linear program, but there are exponential number of activation vectors. So linear program will take exponential complexity!

However, there is a polynomial complexity solution, if the constraints are only because of number of radio limitations:

Sasaki and Hajek, ``Link scheduling in polynomial complexity’’, IEEE Transactions of Info. Theory, 1988

For more general constraints, this is an NP-hard problem!