hamilton institute tcp congestion control roughly speaking, tcp operates as follows: –data packets...
TRANSCRIPT
Hamilton Institute
TCP congestion control
• Roughly speaking, TCP operates as follows:
– Data packets reaching a destination are acknowledged by sending an appropriate message to the sender.
– Upon receipt of the acknowledgement, data sources increase their send rate, thereby probing the network for available bandwidth, until congestion is encountered.
– Network congestion is deduced through the loss of data packets (receipt of duplicate ACK’s or non receipt of ACK’s), and results in sources reducing their send rate drastically (by half).
Hamilton Institute
TCP congestion control
• Congestion control is necessary for a number of reasons, so that:
– catastrophic collapse of the network is avoided under heavy loads;
– each data source receives a fair share of the available bandwidth;
– the available bandwidth B is utilised in an optimal fashion.
– interactions of the network sources should not cause destabilising network side effects such as oscillations or instability
Hamilton Institute
TCP congestion control
• Hespanha’s hybrid model of TCP traffic.
– Loss of packets caused by queues filling at the bottleneck link.
– TCP sources have two modes of operation
• Additive increase
• Multiplicative decrease
– Packet-loss detected at sources one RTT after loss of packet.
Data source 1
Data source n
Data source 2
Bottleneck link l
Router Router
Hamilton Institute
TCP congestion controlData source 1
Data source n
Data source 2
Bottleneck link l
Router Router
Packet notbeing
dropped
Packetsdropped
Packet dropdetected
Half source rate
Hamilton Institute
TCP congestion controlData source 1
Data source n
Data source 2
Bottleneck link l
Router Router
Queuenotfull
Queuefull
Packet dropdetected
Half source rate
Hamilton Institute
Modelling the ‘queue not full’ state
• The rate at which the queue grows is easy to determine.
• While the queue is not full:
BQ
TRTT
BRTT
wdtdQ
p
i
RTTdtdwi 1
Hamilton Institute
Modelling the ‘queue full’ state
• When the queue is full
• One RTT later the sources are informed of congestion
RTTdtdwdtdQ
1
0
Hamilton Institute
TCP congestion control
Queue fills
ONE RTT LATER
QUEUE FULL
RTTdt
dwdt
dQ
1
0
BRTT
w
dt
dQ i
RTTdt
dwi 1
ii w.w 50
Hamilton Institute
TCP congestion control: Example (Hespanha)
Seconds 40T
packets 250Q
cpackets/se1250
p
max
.
B
0 100 200 300 400 500 6000
50
100
150
200
250
300
350
400
Hamilton Institute
TCP congestion control: Example (Fairness)
Seconds 40T
packets 250Q
cpackets/se1250
p
max
.
B
0 200 400 600 800 1000 12000
100
200
300
400
500
600
700
Robert N. Shorten Hamilton Institute
Modelling of dynamic systems: Part 3
System Identification
Robert N. Shorten & Douglas LeithThe Hamilton Institute
NUI Maynooth
Hamilton Institute
Building our first model
• Example: Malthus’s law of population growth
Government agencies use population models to plan.
What do you think be a good simple model for population growth?
Malthus’s law states that rate of an unperturbed population (Y) growth is proportional to the population present.
Introduction
kYdtdY
Hamilton Institute
1800 1820 1840 1860 1880 1900 1920 1940 1960 19800
50
100
150
200
250
YEAR
Pop
US Population Growth (millions) v. Year
Hamilton Institute
1800 1820 1840 1860 1880 1900 1920 1940 1960 19800
50
100
150
200
250
YEAR
Pop
US Population Growth (millions) v. Year
1800 1820 1840 1860 1880 1900 1920 1940 1960 19801.5
2
2.5
3
3.5
4
4.5
5
5.5
Slope = k
Intercept = ey0
YEAR
ln(Pop)
Hamilton Institute
1800 1820 1840 1860 1880 1900 1920 1940 1960 19800
50
100
150
200
250
300
350
YEAR
Pop
US Population Growth (millions) v. Year
MODEL
Hamilton Institute
Modelling
• Modelling is usually necessary for two reasons: to predict and to control. However to build models we need to do a lot of work.
– Postulate the model structure (most physical systems can be classified as belonging to the system classes that you have already seen)
– Identify the model parameters;
– Validate the parameters (later);
– Solve the equations to use the model for prediction and analysis (now);
Introduction
Hamilton Institute
Modelling
• Modelling is usually necessary for two reasons: to predict and to control. However to build models we need to do a lot of work.
– Postulate the model structure (most physical systems can be classified as belonging to the system classes that you have already seen)
– Identify the model parameters;• Experiment design• Parameter estimation
– Validate the parameters (later);– Solve the equations to use the model for prediction and analysis (now);
Introduction
Hamilton Institute
What is parameter estimation?
• Parameter identification is the identification of the unknown parameters of a given model.
• Usually this involves two steps. The first step is concerned with obtaining data to allow us to identify the model parameters.
• The second step usually involved using some mathematical technique to infer the parameters from the observed data.
Hamilton Institute
Linear in parameter model structures
• The parameter estimation task is simple when the model is a linear in parameters model form.
• For example, in the equation
the unknown parameters appear as coefficients of the
variables (and offset).
• The parameters of such equations are estimated using the principle of least squares.
.baxy
Hamilton Institute
The principle of least squares
• Karl Friedrick Gauss (the greatest mathematician after Hamilton) invented the principle of least squares to determine the orbits of planets and asteroids.
• Gauss stated that the parameters of the models should be chosen such that ‘the sum of the squares of the differences between the actually computed values is a minimum’.
• For linear in parameter models this principle can be applied easily.
Hamilton Institute
The principle of least squares
• Karl Friedrick Gauss (the greatest mathematician after Hamilton) invented the principle of least squares to determine the orbits of planets and asteroids.
• Gauss stated that the parameters of the models should be chosen such that ‘the sum of the squares of the differences between the actually computed values is a minimum’.
• For linear in parameter models this principle can be applied easily.
Hamilton Institute
The principle of least squares
)y,x( 11
)y,x( 22
)y,x( kk
x
y
k
iii )yy()b,a(V
1
2
Hamilton Institute
The principle of least squares: The algebra
• For our example: we want to minimize
• Hence, we need to solve:
m
iii
m
iii
)baxy(
)yy()b,a(V
1
2
1
2
00
b
)b,a(Va
)b,a(V
Hamilton Institute
The principle of least squares: The algebra
• For our example: we want to minimize
• Hence, we need to solve the following equations for the parameters a,b.
012
02
1
1
))(baxy(b
)b,a(V
)x)(baxy(a
)b,a(V
m
iii
i
m
iii
m
ii
m
ii
m
iii
m
ii
m
ii
ymbxa
yxxbxa
11
111
2
Hamilton Institute
A linear model
• Example: Find the least squares line that fits the following data points.
X Y -1 10 0 9 1 7 2 5 3 4 4 3 5 0 6 -1
-1 0 1 2 3 4 5 6-2
0
2
4
6
8
10
x
y
Hamilton Institute
A linear model
• Example: Find the least squares line that fits the following data points.
X Y -1 10 0 9 1 7 2 5 3 4 4 3 5 0 6 -1
m
ii
m
ii
m
iii
m
ii
m
ii
ymbxa
yxxbxa
11
111
2
Hamilton Institute
A linear model
• Example: Find the least squares line that fits the following data points.
X Y -1 10 0 9 1 7 2 5 3 4 4 3 5 0 6 -1
m
ii
m
ii
m
iii
m
ii
m
ii
ymbxa
yxxbxa
11
111
2
64386071 .x.y
Hamilton Institute
A linear model
• Example: Find the least squares line that fits the following data points.
X Y -1 10 0 9 1 7 2 5 3 4 4 3 5 0 6 -1
64386071 .x.y
-1 0 1 2 3 4 5 6-2
0
2
4
6
8
10
12
x
y
Hamilton Institute
A polynomial model
• Least squares can be used whenever we suspect a linear in parameters model?Find the least squares polynomial fit to the following data points.
2
21 kk xccy
X Y 1.0000 2.9218 2.0000 5.9218 3.0000 10.9218 4.0000 17.9218 5.0000 26.9218 6.0000 37.9218 7.0000 50.9218 8.0000 65.9218 9.0000 82.9218
10.0000 101.9218 1 2 3 4 5 6 7 8 9 100
20
40
60
80
100
120
x
y
Hamilton Institute
A polynomial model
• By proceeding exactly as before:
27311 kk x.y
X Y 1.0000 2.9218 2.0000 5.9218 3.0000 10.9218 4.0000 17.9218 5.0000 26.9218 6.0000 37.9218 7.0000 50.9218 8.0000 65.9218 9.0000 82.9218
10.0000 101.92181 2 3 4 5 6 7 8 9 10
0
20
40
60
80
100
120
x
y
Hamilton Institute
Building our first model
• Example: Malthus’s law of population growth
Government agencies use population models to plan.
What do you think be a good simple model for population growth?
Malthus’s law states that rate of an unperturbed population (Y) growth is proportional to the population present.
Introduction
kYdtdY
Hamilton Institute
An exponential model (the first lecture)
ktAeY
• The solution to the differential equation is not linear in parameters.
• However, there is a change of variables to make it linear in parameters.
ktAln
elnAln
)Aeln(Ylnkt
kt
Hamilton Institute
1800 1820 1840 1860 1880 1900 1920 1940 1960 19800
50
100
150
200
250
YEAR
Pop
US Population Growth (millions) v. Year
Hamilton Institute
1800 1820 1840 1860 1880 1900 1920 1940 1960 19800
50
100
150
200
250
YEAR
Pop
US Population Growth (millions) v. Year
1800 1820 1840 1860 1880 1900 1920 1940 1960 19801.5
2
2.5
3
3.5
4
4.5
5
5.5
Slope = k
Intercept = ey0
YEAR
ln(Pop)
Hamilton Institute
Matrix formulation of least squares
• The least squares parameters can be derived by solving a set of simultaneous linear equations. This technique is effective but tedious for complicated linear in parameter models. A much more effective solution to the least squares problem can be found using matrices.
• Suppose that we wish to find the parameters of the following linear in parameters model and that we have m measurements.
cbzaxy
Hamilton Institute
Matrix formulation of least squares
• All m-measurements can be written in matrix form as follows
or more compactly as
c
b
a
zx
zx
zx
y
y
y
mmm 1
1
1
22
11
2
1
θΦY
Hamilton Institute
Matrix formulation of least squares
• The matrix is known as the matrix of regressors.This matrix (here a mx3 matrix) is usually not invertible. To find the least squares solution we multiply both sizes of the equation by the transpose of the regressor matrix.
• It can be shown that the least squares solution is given by the above equation.
θΦΦΦ
θΦΦΦ1
Y)(
YTT
TT
Φ
Hamilton Institute
A linear model
• Example: Find the least squares line that fits the following data points.
X Y -1 10 0 9 1 7 2 5 3 4 4 3 5 0 6 -1
-1 0 1 2 3 4 5 6-2
0
2
4
6
8
10
x
y
Hamilton Institute
A linear model
• The regressor is given by
• Hence
reg =[-1 1 0 1 1 1 2 1 3 1 4 1 5 1
6 1];
reg'*reg = [92 20 20 8]
Hamilton Institute
Summary: Linear least squares
• To do a least squares fit we start by expanding the unknown function as a linear sum of basis functions:
• We have seen that the basis functions can be linear or non-linear. The linear parameters can be found using:
.....)x(bf)x(af)x(y 21
θΦΦΦ
θΦΦΦ1
Y)(
YTT
TT
Hamilton Institute
Discrete time dynamic systems
• Our examples work beautifully for static systems. What about identifying the parameters of dynamic systems. Dynamic systems are in principle not any different to static systems. We define our regressors and solve the regression problem.
• Consider the following problem. We wish to build a model of the relationship between the throttle and the speed of an automobile. We begin by collecting data from an experiment.
CAR DYNAMICSVELOCITYTHROTTLE
Hamilton Institute
Discrete time dynamic systems
0 50 100 150 200 250 300 3506
7
8
9
10
11
12
Speed
time [sec]
0 50 100 150 200 250 3000.04
0.06
0.08
0.1
0.12
0.14
0.16
time [sec]
Hamilton Institute
Discrete time dynamic systems
• A good choice for the model structure is first order:
• We can solve for the parameters by solving
• yielding:
cbuavv kkk 1
θΦΦΦ
θΦΦΦ1
Y)(
YTT
TT
030839501 .u.v.)k(v kk
Hamilton Institute
Recursive identification
• The algorithms that we have looked at so far are called batch algorithms.
• Sometime we want to estimate model parameters recursively so that the parameters can be estimated on-line.
• Also, if system parameters change over time, then we need to continually estimate and verify the model parameters.
Hamilton Institute
Recursive least squares
• The least squares algorithm invented by Gauss can be arranged in such a way such that the results obtained at time index k-1 can be used to obtain the parameter estimates at time index k. To see this we use
• and note that
θΦΦΦ
θΦΦΦ1
Y)(
YTT
TT
m
im
T
m
m
i
T
m
T
m
yY1
ii
1ii
φΦ
φφΦΦ
Hamilton Institute
Recursive least squares
• With a little manipulation (show) we get:
• where:
• More complicated versions of the algorithm are available that avoid matrix inversion.
)y(P k
T
kkkkkk 11 θφφθθ
T
kkkk PP φφ1
1
1
Hamilton Institute
Recursive least squares (car example)
0 10 20 30 40 50 60 70 80 90 1000
0.5
1c
0 10 20 30 40 50 60 70 80 90 1000.5
1
1.5
a
0 10 20 30 40 50 60 70 80 90 1000
2
4
b
Time index k
Hamilton Institute
Recursive least squares (car example)
50 55 60 65 70 75 80 85 90 95 100
-0.1
0
0.1
c
50 55 60 65 70 75 80 85 90 95 100
0.6
0.8
1
a
50 55 60 65 70 75 80 85 90 95
1
2
3
b
Time index k
Hamilton Institute
The matrix inversion lemma
• One not-so-nice feature of the RLS formula is the presence of a matrix inversion at each step. This can be removed using the matrix inversion lemma (the Sherman-Morrisson formula).
111111
1-1-
and invertible is BCDA The matrices.
square invertible be BDAC and C,A,Let
DA)BDAC(BAABCD)(A -
Hamilton Institute
The RLS algorithm
• Application of the lemma results in the standard RLS algorithm.
1
1
1
11
φ
φφ1φ
θφθθ
k
T
kkk
kk
T
k
kkk
k
T
kkkkk
P)GI(P
PP
G
)y(G
Hamilton Institute
Time-varying systems
• Much of the appeal of the RLS algorithm is that we can potentially deal with time-varying systems.
• Example: Suppose that a rocket ascends from the surface of the earth propelled a thrust force generated through the ejection of mass. If we assume that the rate of change of mass of the fuel is um and the exhaust
velocity is ve, then the physical equations governing the
rocket is:
emvug)t(mdtdv
)t(m
Hamilton Institute
Forgetting factors
• For time varying systems we must estimate the parameters recursively. How can we modify the basic RLS algorithm?
• To estimate time-varying parameters we would like to forget past data points. The only place in the above formula that depends on past data points is the covariance matrix.
)y(P k
T
kkkkkk 11 θφφθθ T
kkkk PP φφ1
1
1
Hamilton Institute
Forgetting factors
• For time varying systems we must estimate the parameters recursively. How can we modify the basic RLS algorithm?
• This corresponds to minimising the time-varying cost function:
kkkkk eP φθθ 1
k
iii
ik )yy()k,(V1
2λθ
T
kkkk PP φφλ 1
1
1
Hamilton Institute
The RLS algorithm
• Application of the matrix inversion lemma results in the standard RLS algorithm with a forgetting factor.
1
1
1
11
φλ1
φφλφ
θφθθ
k
T
kkk
kk
T
k
kkk
k
T
kkkkk
P)GI(P
PP
G
)y(G
Hamilton Institute
Example
• Consider the dynamic system
where the parameters ak, bk vary as shown.
0 50 100 150 200 250 300-0.5
0
0.5
time [sec]
a
0 50 100 150 200 250 300-1
-0.5
0
0.5
time [sec]
b
kkkkk ubyay 1
Hamilton Institute
Example
0 50 100 150 200 250 300-0.5
0
0.5
1
time [sec]
a
0 50 100 150 200 250 300-1
-0.5
0
0.5
1
time [sec]
b
Hamilton Institute
Numerical issues
• RLS algorithm is of great theoretical importance. However, it suffers from one very big disadvantage. It is numerically unstable.
• The numerical instability stems from the equation:
• If no information enters the systems, P becomes singular and the estimator returns garbage.
T
kkkk PP φφλ 1
1
1
Hamilton Institute
Numerical issues
0 100 200 300 400 500 600 7000
0.5
1
time [sec]
a
0 100 200 300 400 500 600 700-1
0
1
2
time [sec]
b
0 100 200 300 400 500 600 700-1
0
1
time [sec]
inpu
t
Hamilton Institute
Persistence of excitation
• One final thought: Persistence of excitation
• Persistence of excitation has a strict mathematical definition.
• Roughly speaking, PE means that the input signal has been chosen such that the least squares estimate is unique.
• The really interested student should consult Astrom for more on this topic.
Hamilton Institute
Error surfaces and gradient methods
• All the examples that we have looked at so far involved linear in parameter models. In this case finding the least squares solution was easy because the error surface is quadratic.
• Huh! What is meant by a quadratic cost function.
• Consider the examples of the line fitting. We were trying to minimize:
m
iii
m
iii
)baxy(
)yy()b,a(V
1
2
1
2
Hamilton Institute
Least mean squares and gradient methods
• To make life simple, let’s assume that we have two observations (m=2) and that we assume that b = 0. Then.
• Remember we are trying to find the parameter a that minimises this function. But the function is quadratic in a.
2
2
2
12211
22
2
2
1
2
22
2
11
22 yya)xyxy(a)xx(
)axy()axy()a(V
Hamilton Institute
Least mean squares and gradient methods
• The quadratic surface looks like the following for a single parameter.
-6 -4 -2 0 2 4 6 80
50
100
150
a
V(a
)
Hamilton Institute
Least mean squares and gradient methods
• With two parameters we get some thing like:
Hamilton Institute
A word on gradient methods
• Another way of estimating the best parameters is to estimate the parameters in an interative manner in the direction of the gradient.
• For linear in parameter structures the batch version of least squares is better. However, the above idea can be extended to deal with model structures that are not linear in parameters (Doug will tell you all about this).
)(V)k()k( θλθ1θ