Lecture 2

advertisement
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 subproblems
• 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
• Weight of a path is the maximum weight of
a link in the path
Path 1
Source
1
1.5
0.5
2.5
Path 2
Weight of path 1 = 1.5
Destination
Weight of a path is the minimum bandwidth
available in the path
– Select a path with maximum bandwidth
1
1
5
u
1
3
p1
p2
v
w
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
k
• d ij is the shortest path weight between i and
j under the condition that the intermediate
vertices are 1,….,k
d
d
d
k
ij
0
ij
 wij
k 1
k 1
k 1
 min( d ij , d ik  d kj )
|V |
ij
and j
is the shortest path weight between vertices i
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)
•
Refer to supplement for pseudo-code
Pseudo-Code for FlloydWarshall
For i = 1 to V
For j = 1 to V
d
0
ij
 wij
For k = 1 to V
For i = 1 to V
For j = 1 to V
d
k
ij
k 1
k 1
k 1
 min( d ij , d ik  d kj )
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 reweighting 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
Reweighting scheme
Let h(u) be a real number associated with
vertex u (we will discuss later how to choose
them)
wnew(u,v) = w(u,v) + h(u) – h(v)
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 choose h(u)s appropriately
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 th old weights.
h(u) =p(s,u) (Is p(s,u) always 0?)
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 th 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
Path 1
Source
Destination
1
1.5
0.5
2.5
Path 2
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
preselected paths, but it can split its traffic through
all of them
• The set of preselected paths may be different for
different sessions
Path 1
Source
Destination
Path 2
3 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
Path 1
Source 2
Source 1
Destination 1
Path 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
Path 1
Source
Destination
1
1.5
0.5
2.5
Path 2
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:
Session n has Mn paths
If throughput vector (a1, a2,….aN) is attainable
The traffic an of nth session can be split to the Mn paths that
may carry session n traffic in proportion m
a
an  a
1
a
n
m
n
m, n: mth tree
of nth session
crosses link e
n
 a n  ..... a nM n
2
 Ce for all edges e
(capacity condition)
D2
a
S1
a1
2
1
a2 e
1
a
1

1
1

1
2
a a a1
a2  a2
1
1
1
1
2
a + a
<
1
S2
D1
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)
Intuitively, if throughput is not attainable, then system can not
deliver the throughput.
Is the converse true?
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
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 the
least congested path.
• Congestion in a path depends upon the
number of packets waiting for service along
Path 1
the nodes
Source
Destination
Path 2
For routing decision we will consider the number of packets
waiting at the source node only (queue lengths at the source
node).
Intuitive or CounterIntuitive?
B1(t)
S1
D1
B2(t)
When a packet comes, decide which path it will be routed
to
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
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
• 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
source and destination backlogs (Biu(t) - Biv(t)) at any slot t
Select the session which has 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
session 1
u
v
session 2
B1u(t)=2, B2u(t)=3, B1v(t)=1, B2v(t)=1
Session 2 scheduled
session 1
u
session 2
B1u(t)=1, B2u(t)=1, B1v(t)=3, B2v(t)=2
v
No session scheduled
session 1
u
session 2
v
Session 1 scheduled
B1u(t)=3, B2u(t)=2, B1v(t)=1, B2v(t)=1
Intuition
D2
S1
e
S2
D1
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 a probability
distribution.
• 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
Possible Term Projects
• Looks only at throughput
– How about delay?
• Policy has certain parameters
– Instead of taking decisions based on local queue lengths
we can take decisions based on linear functions of local
queue lengths
– Choice of parameters might affect relative quality of
service
• Assumed infinite buffer in the analysis
– How should we modify the policy for finite buffers?
• 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
u
e1
v
e2
x
e3
y
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.
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
B1(t)
S1
B2(t)
D1
Scheduling: Wireline Case
Constraints 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
Let the difference in backlog of a link be the maximum
difference in backlog of any session traversing the link
So, we actually choose the combination which has the
maximum value for the total difference in backlog
Scheduling: Wireless case
Let the difference in backlog of a link be the maximum
difference in backlog of any session traversing the link
Total difference in backlog of an activation set is the
sum of the difference in backlogs of the links in the set.
We choose the activation set which has the maximum value
for the total difference in backlog
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
Session 1
u
e1
v
x
e2
e3
Session 2
Activation sets: {e1} , {e2 }, {e3 },{e1 , e3}
Backlog of e1 = 1
Backlog of e2 = 6
Backlog of e3 = 1
Activate link e2, session 2
y
Verify that no link with maximum difference in backlogs
negative 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)
Term Project!
• How about trying some creative heuristics
which attain good performance, but uses
only local information?
– CSMA-CD based approaches possible in this
regard
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.
u
e1
v
e2
x
e3
y
Indicator vector will have 3 components
The indicator vector for the subset {e1 , e2} is (1,1,0)
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
e1
v
e2
x
e3
y
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
For wireline case, the only constraint on the average
time is that it is less than or equal to 1
Average load a link can tolerate is the product of its
link capacity and the average time it is active
(reminds of Littles law?)
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:
Session n has Mn paths
If throughput vector (a1, a2,….aN) is attainable, then
the following must hold:
the traffic an of nth session can be split to the Mn paths that
may carry session n traffic in proportion m such that
an  a  a
1
n
a
n
Mn

.....
an
n
2
and for some convex combination x of activation
vectors,
(1/Ce)
a
m
n
m, n: mth tree
of nth session
crosses link e
 xe
for all edges e
(capacity condition)
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!
Download