162c PDF
162c PDF
162c PDF
user equilibrium
in static and dynamic traffic routing
by
Thesis
for the degree of
Master of Mathematics
(Master i Matematikk)
Juni 2007
2 Background theory 7
2.1 Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.1.1 Walks and paths . . . . . . . . . . . . . . . . . . . . . . . 7
2.1.2 Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.1.3 Distance, weighted graphs . . . . . . . . . . . . . . . . . 9
2.1.4 Capacity, flows . . . . . . . . . . . . . . . . . . . . . . . . 10
2.2 Optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.2.1 Convex sets, cones . . . . . . . . . . . . . . . . . . . . . 13
2.2.2 Halfspaces and polyhedron . . . . . . . . . . . . . . . . 14
2.2.3 Linear Programming . . . . . . . . . . . . . . . . . . . . 16
2.2.4 The dual problem . . . . . . . . . . . . . . . . . . . . . . 17
2.2.5 Convex optimization . . . . . . . . . . . . . . . . . . . . 18
2.2.6 Complexity . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2
5 Analysis 44
5.1 Special cases and simplifications . . . . . . . . . . . . . . . . . 44
5.1.1 Number of commodities . . . . . . . . . . . . . . . . . . 44
5.1.2 Special latency functions . . . . . . . . . . . . . . . . . . 45
5.1.3 Simplified networks . . . . . . . . . . . . . . . . . . . . . 47
5.1.4 Alternative optimality criteria . . . . . . . . . . . . . . 49
5.2 System optimal vs. user equilibrium . . . . . . . . . . . . . . . 50
5.3 The dynamic case, simplified latency model . . . . . . . . . . 61
5.3.1 System optimal planning . . . . . . . . . . . . . . . . . . 61
5.3.2 Existence and uniqueness of the system optimal so-
lution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
5.3.3 The time discrete graph . . . . . . . . . . . . . . . . . . 63
5.3.4 System optimal planning by use of the augmented
graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
5.3.5 Variable preferred arrival time . . . . . . . . . . . . . . 65
5.3.6 Properties of the augmented graph . . . . . . . . . . . 66
5.3.7 Examples of the augmented graph . . . . . . . . . . . . 66
5.3.8 Multi-commodity planning . . . . . . . . . . . . . . . . 71
5.4 Chain decomposable flows . . . . . . . . . . . . . . . . . . . . . 72
5.4.1 System optimal solution with chain flows . . . . . . . 73
6 Summary 87
7 Appendix 89
3
1 Introduction
Optimization is a large discipline of mathematics, and loosely said con-
cerns finding the best solution to some given problem. Numerous branches
exist within the field of optimization, such as linear optimization, con-
vex optimization, and integer optimization. Typically an optimization
problem has a function to minimize or maximize over a given domain,
and the problem might be easy or hard to solve, depending on both the
objective function and the feasible domain. Some problems might be
solved in a time polynomially proportional to a measure of the size of
the problem, while other problems have not yet been, or can never be,
solved faster than exponentially proportional to the size of the problem.
When solving a problem by hand any big problem can become almost
impossible to solve because of its sheer size, but with the aid of fast
computers mathematicians today can solve bigger and bigger problems.
In particular more and more real world problems can be solved to opti-
mality with the emerging possibilities.
4
this calculation; it is a mathematical representation of our problem, and
as such has a way of representing the traffic throughout the network
in a precise and quantitative way. We can then use the mathematical
model to check which different traffic routings are the best with regard
to our choice of minimization goal. It is very important that the chosen
mathematical model has properties that resemble those of the original
problem. Often finding a good mathematical model is not very hard,
but finding one that is not too complex for efficient optimization to take
place might be harder. Typically this transportation kind of problem
is regarded as a network problem where the network is represented as
a graph, and each edge in the graph has a cost associated to it that
depends on the amount of traffic flowing along it.
Another interesting viewpoint in traffic problems is that of each com-
muter, assuming the users of the network behave according to the ego-
istic goal of minimizing their own travel time in the network. This is by
many considered the situation that will occur in a real world traffic net-
work, and the "solution" we get from this approach can differ from the
solution to the similar optimization problem of e.g. least travel time. In-
terestingly the user approach yields a solution that is often much worse
in terms of total travel time. Bridging the gap between these two solu-
tions to the traffic flow problem might, at least for the environmentalists,
be of great interest.
5
I will conduct my own analysis of the problems, using the theory from
the previous section, and section 6 will contain a short discussion of
what I have achieved in the thesis.
6
2 Background theory
This section will contain an overview of terminology and concepts used
in the rest of the text. This will be from the fields of graph theory and
optimization (in particular linear optimization).
2.1 Graphs
A graph is a structure used to describe how different entities are related
to each other, through the means of representing each entity and each
relation by nodes and edges, respectively. More precisely an undirected
graph (or just graph) G consists of a set of nodes V and a set E of pairs
of these nodes. Each edge e = (v1 , v2 ) or v1 v2 represents a connection
between these two nodes. The nodes are said to be the endpoints of e,
and v1 and v2 are said to be adjacent. The edge is also incident to each
of the nodes, and vice versa. Two edges are adjacent if they are incident
to a common node.
If we demand that the set of pairs of nodes be a set of ordered pairs,
we obtain a directed graph, or digraph for short. It is then also common
to name the nodes vertices and the edges arcs instead, and the set of
arcs is called A instead of E. In this case an arc a = v1 v2 represents a
connection from v1 to v2 , but not the other way. These nodes are called
the source and target of a respectively. Note that removing the direction
of the arcs in a directed graph simply yields an undirected graph often
referred to as the underlying (undirected) graph. When using the term
graph without qualification we might mean undirected or directed graph,
based on the context.
Throughout this section I will give definitions for undirected graphs,
with supplements for the directed case where needed .
The degree of a node is the number of edges incident to it. For a
vertex we distinguish the indegree, which is the number of arcs entering
the vertex, and the outdegree, which is the number of arcs leaving the
vertex.
7
Figure 1: An example graph
2.1.2 Trees
Contained in the set of all possible graphs are several interesting subsets
or classes of graphs. Among the most important of these are trees. A
tree is a connected graph with no cycles. This, however, implies a few
8
other properties that the trees must have.
c) Between any pair of nodes in G there exists exactly one unique path.
Definition 2.1 The length of a walk is equal to the number of edges in it.
Definition 2.2 The distance between two nodes is equal to the length of a
shortest walk between them. If no such walk exists the distance is defined
to be ∞.
9
This may be used to define a metric in any undirected graph.
i d(v1 , v2 ) = 0 ⇐⇒ v1 = v2
Follows from the definition.
ii d(v1 , v2 ) = d(v2 , v1 )
Any path from v1 to v2 is also a path from v2 to v1 with the same
length, when reversed.
Definition 2.3 The (weighted) length of a walk is equal to the sum of the
lengths of the edges in it.
In a road network, the internet, or in any other real life network in which
commodities are transported there is some kind of limit to how much
stuff can be moved around during unit of time. In a graph this capacity
constraint is easily added as another function c : E → R + where c(e)
denotes the maximum amount of commodity that can be moved along
the edge e in one time unit. We will, however, also be interested in the
direction of flow along each edge, and because of this we hereby switch
our attention over to the directed graphs for the rest of the text.
When working with flow in graphs we also have a function f : A → R +
10
Figure 3: The distance from s to t is 6.
where f (a) denotes the flow currently assigned to arc a. The cost of
assigning a flow f (a) along the arc a is
f (a)l(a) (1)
where δout (v) denotes the leaving arcs of v and δin (v) denotes the en-
tering arcs.
11
This is also called the flow conservation property, and will be assumed
to hold for any flow f unless otherwise stated.
Definition 2.6 A flow that satisfies both the flow conservation property
and also the capacity constraint
0 ≤ f (a) ≤ c(a) ∀a ∈ A (3)
is called a feasible flow.
For a feasible flow we also talk about the value of the flow, which is
Definition 2.7 The value of a s − t-flow f is
X X
f (a) = f (a)
a∈δout (s) a∈δin (t)
Figure 4: A graph with costs and capacities on each arc, and a feasible
flow in the same graph.
2.2 Optimization
The most general form of an optimization problem may be written
max{f (x) : x ∈ D}
or
min{f (x) : x ∈ D}
where D is some domain called the feasible region. Multiplying f (x)
with −1 we see that the two problems are really the same. About such
a general problem there is not much to be said, and thus optimization
problems are divided into several categories according to the form of
both f and D:
12
• If both f and D are convex we have convex optimization
λc + (1 − λ)d ∈ C
13
We can easily verify that convex sets and convex cones are closed under
both intersection and sum.
A useful construction is the convex hull of a set X.
Although this definition is rather abstract, it can be shown that the defi-
nition is equivalent to a more useful characterization.
Definition 2.13 The cone cone(X) of a set X is the smallest convex cone
containing X. If X is finite cone(X) is finitely generated.
The polytopes and cones are closely related to another kind of convex
set, the polyhedron, which is the intersection of a finite number of half-
spaces.
H = {x : r T x ≤ δ}
14
Since scalar products commute with vector addition in R n , we see imme-
diately that all halfspaces are also closed convex sets.
Similar to the halfspace we have the hyperplane.
For a proof refer to [1] This means that everything that is true for poly-
topes (or sums of polytopes and finitely generated cones) is also true
for bounded (or general) polyhedron! Due to the explicit definition of
the polytopes and finitely generated cones it is often easier to prove
attributes of these, than it is for the polyhedron with their implicit defi-
nition.
The converse to this theorem is also true, but for us this theorem is of
most interest, as we will see in a moment.
15
2.2.3 Linear Programming
Misleading as the name may be, Linear Programming (LP) has little to do
with actual programming, but concerns rather the problem of finding the
maximum of minimum value of a linear function over a convex domain.
To this end several algorithms have been developed over the years, and
among those that stand out are the Simplex algorithm and the interior
point methods. Formally we have the objective function (i.e. the function
to maximize or minimize, and we will hereby assume minimization) f :
P → R where P is the domain polyhedron P = {x : Ax ≤ b}. Our problem
is thus to find
min{c T x : Ax ≤ b}
where A is the constraint matrix of the LP problem.
Intuitively the LP problem is very easy to solve, as the sets for which
the objective function have a constant value are hyperplanes. Thus solv-
ing an LP problem is really just the same as moving this hyperplane
along its normal vector, decreasing the value of the objective function,
until it reaches the boundary of the convex domain. This intuition also
tells us that the minimum value of the the objective function is attained
in at least one of the vertices of the domain, if at all. The objective
function might decrease along a direction in which the polyhedron is
unbounded. In this case we say that the LP problem is unbounded. The
other extreme case is when the polyhedron is empty, i.e. no solution
exists at all. This is an infeasible LP problem.
Of course finding the solution to an LP problem is not as easy as
intuition leads us to believe, but this is where the power of theorem
(2.4) can be used:
Theorem 2.5 For a feasible and bounded LP problem the optimal value
is always attained in a vertex of the domain polyhedron.
f (x) = f (λ1 v1 + · · · + λn vn )
16
Since any bounded polyhedron is also a polytope, we then have for
bounded LP problems that the minimum is attained in a vertex. Now
we might have an LP problem where the domain is unbounded, but
the minimum value for the objective function might still exist and be
finite. Proving that the optimal value here is attained in a vertex as
well requires some extra details. Assume now that the polyhedron P
is unbounded and has at least one vertex, and that f has a bounded
minimum value that is attained in P . Now we know that P = Q + C
where C is nonempty. Assume that there exists a vector z ∈ C such that
f (z) = f (0) + d, d > 0. But then f (nz) = f (0) + nd, and since nz ∈ C f
is unbounded, which contradicts the assumption that the problem was
bounded. Thus f (z) ≤ f (0) for all z ∈ C, and we may examine only
the points in P of the form x + y, x ∈ Q, y ∈ C where y = 0, that is
we may consider only the points of the polytope Q. Now since we know
that the minimum value is attained in the polytope Q, we also know that
it is attained in a vertex of Q, which is again a vertex of P by (2.4).
max{bT y : AT y ≥ c, y ≥ 0}
Now the famous duality theorem states that if both the original and the
dual problems are feasible, then their optimal solutions are the same:
Theorem 2.6 (LP duality theorem) For a linear optimization problem and
its dual we have min{c T x : Ax ≤ b, x ≥ 0} = max{bT y : AT y ≥ c, y ≥
0} if both problems are feasible.
17
2.2.5 Convex optimization
2.2.6 Complexity
max = S(1)
for (i = 2; i <= |S|; i++)
if (S(i) > max) max = S(i)
return max
18
If |S| = n this algorithm performs roughly n loops, of which roughly
log2 (n) contain four operations, and the rest contain three. In total this
is 3n + log2 (n) operations. However keeping exact track of the number
of operations is not of very much interest for the average algorithm
theoretician. When n grows large it is clear that 3n dominates log2 (n),
so our algorithm has a running time which is roughly 3n. Again constant
terms are not really significant. When comparing 3n to n2 it is clear that
for large enough values of n the extra term n dominates the term 3,
and so it is customary to also strip all constants. Thus we end up with a
running time roughly proportional to n for our algorithm, or we say that
it has complexity O(n) - at the order of n. And the problem of finding
the largest of n integers then also has complexity O(n).
Note that if we made the assumption that the integers in S were sorted,
a fastest algorithm would simply be
return S(|S|)
19
3 The traffic routing problem
In fact there is not the traffic routing problem, but this involves rather
a large amount of related problems. In the introduction the following
examples were given:
There was also a mention of the situation in which traffic is not directed
in any way. and that this could lead to another traffic routing. These
listed situations are examples of system optimal routing where we try
to minimize some measure of badness. On the other hand this second
situation would be a user equilibrium where the behavior of the users
decide the solution. Both scenarios can be studied using static network
flow formulations.
In addition one might add the dimension of time, leading to some slightly
harder problems. An example of this could be to route a given amount
of traffic through a network over time, and in such a way that the total
travel time of all the traffic was minimized. This would typically involve
avoiding congestion, and would be calculating the dynamic system op-
timal routing. On the other hand one could also study how this traffic
would route itself if no interference was done, and thus obtain the dy-
namic user equilibrium. Much effort is also being put into researching
the relation between the system and user equilibria, as finding a way
to use e.g. proper taxing to obtain a user equilibrium that equals the
system optimal solution would be rather splendid in a lot of real world
scenarios.
20
for me, the speed at which traffic flows and the amount of traffic that
there is room for along the road. Typically these two are inversely pro-
portional, something we see if we assume that each car desires to have a
certain amount of time to the car in front. Then this distance increases
proportionally with the speed of the car, and the amount of cars there
are room for per length then decrease. Let’s say that a sensible amount
of time to have between two cars is τ. In a sense this determines an
absolute capacity on this road, where the inflow rate of traffic cannot
be greater than τ1 cars per time unit for each lane of the road. But in
fact there is another mechanism that causes slowdown before this limit
is reached: When the concentration of cars is rather high, and one car
breaks, the one behind it will also have to break immediately to retain
the τ time distance to the car in front. But the second car does probably
not react instantly to the car in front, and thus has to break more than
the first car in order to stay far enough behind. Now the third car, be-
hind the second one, will have to break even more, and so on.
This all leads us to think of the travel time along a stretch of road as
a non-decreasing function of traffic concentration. And of course the
actual length of the road also factors into the travel time as one would
expect.
So we represent the network as a digraph where each arc has a latency
function la (xa ), la : R + → R + dependent on the flow assigned to the
arc. Note that this is the function we use as the length of each arc when
considering the network only as a graph. This latency function is usually
assumed to be convex and nondecreasing, and so we will assume here.
In addition each arc may have a capacity constraint c(a), c : A → R + ,
but when the cost function is increasing, this might also play the role of
a capacity in limiting the amount of flow assigned to the arc.
In the dynamic case we cannot use the simple network flow model
anymore, but must expand of change the traffic model to describe the
added time dimension. In this case our latency functions are often much
more complex, consisting of differential equations or the like, to accom-
modate for queues and variable latency situations. However this will not
be the main focus of this text, and when examining the dynamic prob-
lems I will assume the latency functions to be of a rather simple kind
that allows for only a small expansion of the network flow model.
Each traffic agent must have an origin and a destination, but since we
are not treating the commuters individually we use sources and sinks of
continuous flow. Since it is significant where the flows run from and to,
we have to treat travelers originating from a vertex s and destined to a
vertex t differently from other travelers, that is we need to distinguish
21
s − t-flows from all other flows for each pair (s, t). To this end we in-
troduce one commodity for each origin-destination pair, and index these
with i ∈ I. Thus we have |I| flow functions fi (a), fi : A → R + , and the
total flow along arc a is X
xa = fi (a)
i∈I
22
as a graph, where each arc has a travel time function (or latency func-
tion) dependent on the flow along it. The arcs may also have capacity
constraints. In addition we have a set origin and destination pairs, each
with a flow of a certain magnitude that needs to flow between them.
Each of these pairs correspond to one commodity.
What we wish to do is minimize the total travel time of all commuters.
The total travel time of all traffic is given by:
X
xa la (xa ) (4)
a∈A
where xa is the total flow along arc a and l is the latency function giving
the travel time along the arc as a function of traffic flow. Now this flow
is a composition of flows between several origin-destination pairs. Let
these pairs be indexed by the set I, and let fi (a) denote the amount of
flow of commodity i along arc a, such that
X
xa = fi (a)
i∈I
fi (a) ≥ 0 ∀a ∈ A, i ∈ I (6)
23
3.3 Static user equilibrium
The second problem I will consider is finding the user equilibrium rout-
ing in a static setting. The motivation for this problem is to calculate
what flow we will actually get in a given network if we let the users de-
termine the flow of traffic. Another aim is to find some characterizations
of these user equilibria, which may then be used in making a system op-
timal solution become a user equilibrium by taxation. The data we are
given is exactly the same as in the system optimal problem above.
How to solve this problem is not intuitively easy, but we can start with
the famous principle of Wardrop:
Postulate 3.1 (Wardrop’s first principle) The journey times in all utilized
routes are equal, and equal to or less than those which would be experi-
enced by a single vehicle on any unused route.
An equivalent formulation, viewing each traffic agent as a player, is that
the user equilibrium is a Nash equilibirum:
Postulate 3.2 In a user equilibrium no traffic agents can improve their
travel times by unilaterally changing routes.
This definition can not be used directly to calculate the user equilib-
rium, as the number of players is too great. We don’t even treat them
individually in our flow model. Luckily we can formulate an optimization
problem that gives us the user equilibrium! Consider the function
X Z xa
la (x)dx (8)
a∈A 0
where X
xa = fi (a)
i∈I
We want to show that this function actually is minimal exactly when the
postulates above hold. Let vertices s, t be the source and sink of fi for
some i ∈ I, let P , Q be two s − t-paths, and assume the cost of P is less
than the cost of Q. Now let Ap be the arcs in p that are not also in q,
and similarly for Aq . Then
X X
la (xa ) < la (xa )
a∈Ap a∈Aq
24
which is negative for sufficiently small δx since la is non-decreasing.
Thus all paths between each origin-destination pair have equal cost when
(8) is minimal. And we can formulate the problem of finding the user
equilibrium as minimizing (8) subject to the same constraints (5 - 7) as
the system optimal problem.
Again the assumption that each latency function is convex (or just
non-decreasing, in fact) makes this a convex optimization problem, solv-
able by known algorithms. I will also look at special cases of this prob-
lem later, as well as compare the user equilibrium flow and the system
optimal flow in the same network.
25
outflow functions fiout (a, t), xaout (t) and latency functions la (xain , t) for
each arc a at time t, where again
X
xain (t) = fiin (a, t)
i
and similarly for xaout , faout . The relation between xaout and xain needed
to satisfy the conservation of traffic is given by
1
xaout (t + la (xain , t)) = xain (t) δ
(10)
1+ l (xain , t)
δt a
and similarly for fiin (a, t), fiout (a, r + la (xain , t)). This is obtained by
differentiating the integral of inflow up to time t and outflow up to time
t + la (xain , t), which must be equal.
The FIFO principle directly translates as
which implies
δ
la (xain , t) ≥ −1
δt
And in addition we assume that whenever xain (t) > 0 we have
δ
la (xain , t) > −1
δt
These are all properties that need to be satisfied by our latency model,
and the models that are usable in this sense range from very simply to
very complex. The model I choose later in the text is quite simple.
We are ready to state the dynamic system optimal traffic routing
problem:
The total travel time of all traffic agents is given by
X ZT
xain (t)la (xain , t)dt (11)
a∈A 0
26
denote the difference in outflow and inflow of commodity i at vertex v
at time t, the total departure and arrival time deviation cost is
XZT
bi (si , t)gi (t) − bi (ti , t)hi (t)dt (12)
i 0
Note that the supplies at sources and sinks are not given explicitly as
functions of time, but are consequences of flow balance and total supply
at the terminal time t = T .
In addition the capacity constraints
fi (a, t) ≥ 0 (17)
27
apply as usual.
In this case we are very far from having solved the problem, even
though we have formulated it precisely. The unknowns are no longer
points in R, but functions from R + into R + . This is a problem since the
optimization methods we have mentioned will no longer be applicable.
In addition the latency functions la (xain , t) are functions of xain , which
are themselves functions of t, and the functions la may not at all be
simple; maybe even inexpressible.
28
4 Existing work and solution algorithms
As expected both optimization and graph theory in general, and traffic
planning specifically, has received lots of attention through the years,
and the amount of articles on the latter is vast. This section contains
the theory and algorithms I have found useful for solving to the traffic
assignment problems, and most of it is general theory found everywhere
in the literature.
Considering that a graph with 100 nodes is not at all large, this certainly
is a problem.
A different approach is needed. We will pursue a simple but nice idea
that actually inspires several more advanced algorithms later on:
Knowing all nodes reachable from s in k steps, find all nodes reachable
29
in k + 1 steps. When node t is encountered in the l-th step, we have that
the length of a shortest walk from s to t is exactly l. Let’s describe an
algorithm, called a breath first search (BFS), in more detail:
Let Vi , i = 0 . . . |V | be the set of nodes reachable from s in minimum i
steps. Let U be the set of unvisited nodes, let d(s, t be the distance from
s to t and let π : V → V be a mapping we will use to determine the actual
shortest path from s to any other node.
30
Now assume that t ∈ U after the algorithm terminates. Thus d(s, u) =
∞. We must show u ∈ U ⇐⇒ no walk from s to u exists.
⇒:In a graph with n nodes (of order n) there are no paths of length ≥ n.
This is because in a path each node is visited only once, and at each step
a new node is visited, making the maximum possible length of a path
n − 1. So if t is not reachable from s in n steps, we can conclude that no
path of any length exists from s to u.
⇐: If there exists a walk from s to t, there must also exist a path from s
to t, obtained by eliminating all cycles from the walk. So if no walk from
s to t exists, neither does a path of any length, so t is unreachable from
s and remains in U through the whole algorithm.
Directly from the algorithm we can also see that the algorithm is
quite fast:
31
Initialization U ←V
f (s) ← 0, f (t) ← ∞ ∀ t ∈ U \ {s}
Loop while U ≠ ∅:
find u ∈ U s.t. f (u) = min{f (u) : u ∈ U}
for a = uv ∈ δout (u) s.t. f (v) > f (u) + l(a):
f (v) ← f (u) + l(a)
π (v) ← u
U ← U \ {u}
Theorem 4.2 The function f gives the distance (of a shortest path) from
s to t for all t ∈ V . If no such path exists the distance is ∞.
Proof. Let d(s, t) be the distance from s to t. We will show that for
each u chosen in the loop, we have f (u) = d(s, u). Thus f (u) =
d(s, u) ∀ u ∈ V \ U by induction. Clearly this holds initially, when
V = U. Note that f (u) ≥ d(s, u) ∀ u ∈ V always holds, since f (u)
is the length of some path from s to u. Now assume f (u) > d(s, u).
Then a shortest s − u-path (s, a1 , v1 . . . , vn−1 , an , u) must pass through
U. Let i be the smallest index for which vi ∈ U. Now if we can show
f (vi ) ≤ d(s, vi ) ≤ d(s, u) < f (u), we have a contradiction to f (u)
being minimal. So we need to show f (vi ) ≤ d(s, vi ): If i = 0 then
f (vi ) = f (s) = 0 = d(s, s) = d(s, vi ). If i > 0 then we must have
f (vi ) ≤ f (vi−1 ) + l(vi−1 vi ) = d(s, vi−1 ) + l(vi−1 vi ) = d(s, vi ).
It can also be show that the running time of the algorithm, with the set
U implemented as a heap, is rather good:
Theorem 4.3 The Dijkstra-Prim shortest path algorithm (with heaps) has
a running time of O(|A|log2 (|V |)).
A typical use for the Dijkstra-Prim algorithm is to find the shortest path
through a graph for someone who wishes to travel from one place to an-
other in the graph, but since this is such an abstract notion the algorithm
obviously has many uses. For instance it can be used for determining
maximum flows through graphs when applied repeatedly to a series of
residual graphs, as we shall see later in this section. Another smart use
of it is to construct a graph in such a way that finding a shortest path
through it solves another, maybe more confusing, problem.
In the case the graph has negative cost arcs we can no longer use Di-
jkstra’s algorithm to find shortest paths. But in this case we we can still
use the Bellman-Ford algorithm for the same purpose. This algorithm
looks perhaps more like the breadth first search. Assume we want to
find the shortest s − v-paths in the graph, for some s. Let f and π be as
32
Figure 5: Snapshot of the Dijkstra-Prim algorithm. The vertices are la-
beled with the order in which the are chosen, and arcs used for the
shortest paths are dashed. u is the next vertex to be picked. w is not
examined at all yet.
33
above.
The basic idea idea of the Simplex algorithm is that since the optimal
solution of the LP problem is attained in a vertex, we can look at only the
vertices of our feasible region, if any. Now finding a vertex of the feasible
region is not necessarily easy, but if we have found one vertex, finding
an adjacent one is no problem. Remember that a point is a vertex of the
polyhedron if and only if it satisfies to equality a number of the linear
independent inequalities equal to the dimension n of the space. Then
moving from one vertex to an adjacent one is done by exchanging one of
34
those equalities with another of the inequalities currently not satisfied
to equality, by moving along the n − 1 equalities until the boundary of
another halfspace is encountered. Now choosing to always travel in a
direction in which the objective function is nondecreasing (taking care
not to go back to the same vertex twice) will eventually lead to a vertex
with the optimal value of the objective function! Doing all this sounds
like a lot of book-holding, but all this is beautifully kept track of by the
Simplex algorithm, as we shall see.
35
Written out the first formulation of the problem looks like:
minimize: f = 5x1 − 4x2 + 3x3
subject to: x4 = 5 − 2x1 − 3x2 − x3
x5 = 11 − 4x1 − x2 − 2x3
x6 = 8 − 3x1 − 4x2 − 2x3
x≥0
Now the book-holding of the Simplex algorithm is done by assuming that
all the variables appearing on the first line, i.e. x1 , x2 , x3 in this case,
are all 0. This means we are in fact looking at the point (0, 0, 0) ∈ R 3 ,
since x1 , x2 , x3 correspond to the basis vectors of R 3 . Now this makes
it very easy to check the value of the objective function: It is 0. These
variables are called the non-basic variables. Now checking the value of
the variables x4 , x5 , x6 , we see that they are 5, 11, 8 respectively, and
so they are all greater than or equal to 0, and we see that our point is
feasible. Now this might not always be the case in the starting set-up
like here, but there are ways to deal with that. The variables appearing
on the left hand side of the equations, in this case x4 , x5 , x6 , are called
the basic variables.
Having seen that we are in fact at a feasible point of our LP we can
begin looking for a new vertex that improves the value of the objective
function. Looking at the expression f = 5x1 − 4x2 + 3x3 we see that
increasing x1 , x3 would lead to an increase in f , whereas increasing x2
would in fact lead to a decrease in f ! Now let’s try to do exactly this.
How we will do this is to exchange x2 with one of the basic variables,
making x2 basic and setting the other variable to 0. This is called a
pivot. To do this we see that we already have each of the basic variables
expressed as linear functions of the non-basic variables, and it is then
easy to find an expression also for a non-basic variable in terms of the
other non-basic variables and one basic one. Then after choosing a non-
basic and a basic variable we can simply substitute all occurrences of
the non-basic variable with its expression in terms of the chosen basic
and the other non-basic variables. Now the point is to choose the right
variable to exchange x2 with. We see that increasing x2 will lead to a
decrease in all of the basic variables, and taking into consideration that
each of them must still be non-negative after the pivot, we see that we
can check which one of the basic variables first becomes 0 as we are
increasing x2 . In this example we see that x4 will be 0 when x2 is 35 ,
which is the smallest value of x2 that will make any of the basic variables
equal to 0, so the variable we must pivot on is thus x4 . Looking at the
expression x4 = 5 − 2x1 − 3x2 − x3 we see that we can express x2 as
36
x2 = 31 (5 − 2x1 − x4 − x3 ). We then substitute each of the occurrences
of x2 by this expression and obtain the following:
20 23 4 13
minimize: f = −3 x
3 1
+ x
3 4
+ 3 3
x
5 2 1 1
subject to: x4 = 3
− x
3 1
− x
3 4
− x
3 3
28 10 1 5
x5 = 3
− x
3 1
+ x
3 4
− x
3 3
4 1 4 2
x6 = 3
− x
3 1
+ x
3 4
− x
3 3
x≥0
Now all the non-basic variables appear with positive signs in front, mean-
ing that increasing any of them above 0 will make the objective function
greater. In other words we have already obtained an optimal solution,
which is f = − 203
, and the point in which this value is attained is x1 = 0,
5
being a non-basic variable, x2 = 3 , being a basic variable, and x3 = 0,
again being a non-basic variable. Or (0, 53 , 0) in short.
Now in general we can expect to have several non-basic variables with
negative sign in the objective function, and choosing which one should
enter the basis can be done in several ways. One common method is sim-
ply to choose the variable with the greatest negative coefficient, and if
there are ties, just choose one of them. This is known as the greatest co-
efficient rule. Now to determine the variable leaving the basis when there
are ties, a common method is the lexicographical pivot rule in which each
of the slack variables are increased by a arbitrarily small value at the
start of the algorithm. We define
0 < ǫn+m << ǫn+m−1 << · · · << ǫn+1 << all other data
and for each slack variable xi we add ǫi to the right hand side of the
equation determining xi . Using this perturbation our starting dictionary
in the problem above would look like this:
Now the idea here is that this perturbation of the original problem is
so small that it does not change the solution, and can thus be removed
again when an optimal dictionary is found, but that it makes the choices
of leaving variables during the algorithm unambiguous, thus preventing
the algorithm from going in circles.
37
4.3.3 Correctness and complexity
Without going into details on this, it can be shown that the Simplex
algorithm (with proper pivot rules) terminates for a given LP problem,
and that it finds an optimal solution to the given problem if one exists.
Otherwise it determines if the problem is either unbounded or infeasible.
The complexity analysis will not be done properly here, but in short it
is believed that there is no variant of the Simplex algorithm that has
better worst-case time than exponential. However the average running
time of the algorithm is rather good. Using n and m as a measure of
the size of an LP problem we see that in general we must expect nm
updates for each pivot, as we can expect all the equations to be affected
by the pivot, and these contain nm variables in total. Now the number
of pivots is the hard part to analyze thoroughly, but we can imagine
a worst case scenario where all the vertices of the feasible domain are
visited once. Since the number of vertices can be exponentially large in
n, this could potentially be bad for the algorithm. In practice however an
expected number of pivots is no more than O(m), which is rather good.
Although polynomial time algorithms for solving LP problems exists,
they are often outperformed by the Simplex algorithm in practice.
min{c T x : Ax = b, x ≥ 0} (18)
A = [B N] (19)
" #
xB
x= (20)
xN
38
Our constraints are then
" #
xB
Ax = [B N] = BxB + Nxn = b (21)
xN
Now the fact that the basic variables can be written as functions of the
non-basic variables corresponds to the matrix B being invertible in (21),
and we get:
xB = B −1 b − B −1 Nxn (23)
Now the algorithm consist of keeping track of which variables are basic
and which are non-basic, updating the values of xB and the objective
function, and pivoting on chosen variables. The computationally heavy
part is solving the set of equations involving B, as B changes each time
a pivot is performed. Note that mathematically this is exactly the same
as the above approach to the Simplex algorithm.
min{lT x : 0 ≤ x ≤ c, Ax = −b}
To solve this we will first look at the problem with the simplification that
we are ignoring the capacities, i.e.
min{lT x : 0 ≤ x, Ax = −b}
What makes the network flow problem interesting is the special form of
the matrix B which is used for the basic variables here. It can be shown
that the matrix A has rank m − 1. We delete one row from A to obtain
a new matrix A′ and the corresponding entry from b to get b′ . We call
the node corresponding to the deleted row the root node. The following
theorem contains the main idea for the network Simplex algorithm:
39
For a proof refer to [5]
Now solving the set of equations BxB = −b′ actually is very simple.
It corresponds to fulfilling the flow balance equations at each node of
the graph, assuming all non-tree arcs have 0 flow. The following is an
efficient method of calculating the flow along the spanning (basis) tree
arcs:
Pick a leaf node. The flow along all arcs entering and leaving this node
are known, except one. The supply of the node is also known. Calculate
the flow along the last arc, and remove the node and this arc from the
spanning tree, producing a smaller tree. Repeat the process until the
tree is empty.
Of course the matrix B must have properties that allow us to solve the
set of equations in the same way, and we can verify this by examining it
closer. In fact we never have to do neither multiplications nor divisions,
which speeds things up a bit in a computer.
Now doing a pivot in the tree simplex algorithm corresponds to choosing
a non-basic arc to enter the basis, as usual. Adding this arc to the tree
results in exactly one (undirected) cycle in the tree, and we then update
the flows along only the arcs of this cycle as we increase the flow along
the chosen non-basic arc. Which arc to leave the basis is determined by
which arc has the least potential for change, as usual.
To add the capacity constraints along the arcs to our problem we use
the trick of introducing some extra nodes and arcs to our graph. Assume
we have vertices vi , vj with the arc aij having a capacity cij , cost lij . To
enforce the capacity constraint on the flow along aij we can introduce
an extra node vk and replace aij by aik and ajk . Here we let aik have
cost lik = dij and ajk has cost ljk = 0. In addition we increase the
supply of vj by cij and give the new node vk a supply of −cij . Now we
are again in the situation of a network without capacities, but one that
corresponds to the original one with capacities. To recover the solution
of the original network flow problem, simply take the f (aik ) to be f (aij )
of the original problem, ignoring the f (ajk ) arc. Since the cost cjk = 0
the two problems will also have the same cost. The operation on the
matrix A is less complicated:
Add a new column for the new arc ajk (and just keep the aij as aik ).
Add a new row expressing
· · · + f (aik ) + · · · = −bj
40
to obtain
· · · − f (ajk ) + · · · = −bj − cij
The situation we have looked at so far with network flows has had only
one kind of flow commodity. In practice we often encounter problems
where there is not one kind of commodity, but several. These problems
are called multi-commodity flow problems, and are a rather straightfor-
ward generalization of the single-commodity flow problem, as we shall
see now.
Instead of having a single commodity with sources and sinks, we now
have several commodities, each with its own supply in each vertex of the
network. The difference now is that it is not irrelevant which commodity
ends up where, but the flow balance property must hold individually for
each commodity. Let the n commodities be defined by the index set I,
such that the functions bi (v) : V → R defines the magnitude of com-
modity i at vertex v, and fi (a) : A → R + denotes the flow of commodity
i along arc a. Then we require that
X X
fi (a) = bi (v) + fi (a) ∀i ∈ I, ∀v ∈ V
a∈δout (v) a∈δin (v)
fi (a) ≥ 0 ∀i ∈ I, a ∈ A
41
4.5.2 Maximum flows
Another approach to network flow is not finding the minimum cost flow
satisfying some supplies/demands, but finding the maximum flow be-
tween a pair of vertices s, t. That is the flow with the greatest value. Let
G = (V , A) be a graph, with a length function l : A → R and a capacity
function c : A → R + . We assume G has no negative cost directed cycles.
Let f : A → R + be a flow in G. We then construct the residual graph Gf
of f as follows:
For each arc a = uv with f (a) > 0 add a residual arc a−1 = vu with
length l(a−1 ) = −l(a) and capacity c(a−1 ) = f (a). Then reduce the ca-
pacity of a to c(a) − f (a), and if the new capacity equals 0 remove a
from Gf .
We are ready to formulate the flow augmenting algorithm of Ford
and Fulkerson (or the Successive Shortest Path algorithm since we are
choosing shortest paths in the algorithm). The algorithm is based on
calculating flows g in the residual graph Gf , and then augment the ex-
isting flow f with the new flow, resulting in a flow f + g with a greater
value. This process is repeated until the residual graph no longer con-
tains any s − t-paths, at which point we have a maximum value flow.
We choose to augment the existing flow along the shortest path in the
residual graph.
Initialization f =0
Loop while true:
P ← shortest s − t-path in Gf
if l(P ) = ∞ STOP
µ ← mina∈P {c(a)}
g ← g(a) = µ : a ∈ P ∩ A, −µ : a ∈ P ∩ A−1 , 0 : a ∉ P
f ←f +g
It can be shown [1] that the algorithm terminates when the capacities
c(a) are rational, and that the resulting flow is maximal. But since we
chose to augment the existing flow along a shortest path in each itera-
tion of the algorithm, we can show even more: The algorithm computes
a maximum flow with a minimal cost, and in fact each flow f during the
course of the algorithm is minimum cost among all flows with the same
value! This deserves a theorem:
42
nates with a maximum value flow if the capacities c(a) are rational. If c
is integer and bounded by M the algorithm has running time O(M|E||A|).
Figure 6: The same graph as in figure (2.1.4), and the residual graph
corresponding to the flow in that example. Negative, or residual, arcs
are dashed.
43
5 Analysis
In this section I will examine the problems posed in section 3. I will look
at simplifications and special cases in an attempt to gain some insight
into the problems, and to see which problems are solvable and how good
solution methods we have for each of them.
This is done first for the static problems, and then I will go on and study
the connection between the system optimum and the user equilibrium
in the static setting, and actually present an algorithm that makes the
system optimum a user equilibrium!
In the last part of this section I take a closer look at the dynamic system
optimum problem. First by the rather intuitive approach of discretizing
the time dimension of the dynamic network. And then by the less intu-
itive, but computationally faster and more compact, approach of chain
decomposition of flow; flows that exist during certain time intervals.
44
any other way. Using this we can expect to reduce the number of com-
modities by a great amount. In a graph where all vertices are sources
of flow to all other vertices, this trick would reduce the number of com-
modities to the square root of the original amount. And in a graph with
only one source the number of commodities would be reduced to just
one!
Alternatively we could treat all flow going to the same sink t as one flow
Figure 7: A network with several sinks for the same commodity is shown
to the left. To the right is shown a network with the same routing prob-
lems, but with only one sink and thus only one commodity.
Remember that the total travel time of all commuters was given as
X
xa la (xa )
a∈A
where X
xa = fi (a)
i
45
This was also the objective function of the static system optimality prob-
lem, whereas the user equilibrium objective function was
X Z xa
la (x)dx
a∈A 0
la (x) = la , la ∈ R +
46
Observation 5.2 In the case when our latency functions are constant the
objective function of both the system optimum and the user equilibrium
problems become linear, allowing the use of the Simplex algorithm. If
we also have only a single commodity we can use the Network Simplex
algorithm or the successive shortest path algorithm to find the solutions.
Another type of special cases we can look at is when the network graph
itself has special properties. I will also look for simplifications that can
be done without altering the solution, like the commodity number re-
duction above.
It is clear that any vertex v with no supply b(v) = 0 and with a single
entering arc a and a single leaving arc b can be removed, joining the two
arcs a, b to a new arc c. The latency is then summed together
We could also try joining two parallel arcs a, b to form one arc c with
the same source and target as a and b. It is then clear that the capacity
of the new arc would be the sum of the capacities of the two original,
c(c) = c(a) + c(b). Unfortunately finding the latency function of the
new arc is a bit harder, and is actually influenced by whether we want to
find the user equilibrium or the system optimum.
47
If we want the user equilibrium we should make the assumption that
flow xc is spread between the two arcs a and b in such a way that
la (xa ) = lb (xb )
xa = l−1 −1
a (L), xb = lb (L)
Since
xc = xa + xb
this implies
l−1 −1 −1
c (L) = la (L) + lb (L)
The problem with this expression for lc is that in many cases l−1 a or
−1
lb might not be defined. Take for instance la (x) = la , a constant la-
tency function. Then l−1 a is not defined. But even though we found
a way of working around this problem, which I’m sure we could, find-
ing inverses can be a problem in itself. And on top of that many func-
−1
tions which could result from adding l−1 a and lb don’t even have ex-
pressible inverses! Assume for instance la (x) = x, lb (x) = x 2 , then
1 −1
lc (x) = x + x 2 which to the best of my knowledge is not express-
ible.
If we want the system optimum we should assume the flow xc spread
between a and b in a way that minimizes the total cost of using those
two arcs. As shown below this is equivalent to
′ ′
(xa la (xa )) = (xb lb (xb ))
48
Since xlc (x) = 0 when x = 0 we then finally get
Z
1 x 1
lc (x) = 1 1 dy
x 0 ′ + ′
(yla (y)) (ylb (y))
or without the identification above
Z
1 x h ′ i−1 h ′ i−1 −1
lc (x) = yla (y) + ylb (y) dy
x 0
Unfortunately this is even more impractical than in the user equilibrium
case.
The way we defined the two problems of user equilibrium and system
optimality in the static network were very different. The user equilib-
rium problem was initially stated as finding a flow such that for origin-
destination pair s, t all paths in use from s to t were of equal cost. This
in turn led to a minimization problem with the objective function
X Z xa
la (y)dy
a∈A 0
This problem also has a formulation similar to that of the user equilib-
rium, expressed locally on each s − t-path for each origin-destination
pair.
Let P be an s − t-path and let xP be the flow along this path. Then I claim
the following:
is equal for all used paths P and equal or less than for any unused path.
49
Proof. →: Let P , Q be two s − t-paths with LP < LQ , and let AP be the
arcs in P not in Q and similarly for AQ . Then shifting a flow of value δx
from Q to P changes the value of (25) by
X X
((xa + δx)la (xa + δx) − xa la (xa ))− (xa la (xa ) − (xa − δx)la (xa − δx ))
a∈AP a∈AQ
which is negative for small enough δx, since we have assume that LP <
LQ .
←: We have assume that each latency function la (x) is convex and non-
decreasing in the interval 0 ≤ x ≤ c(a). Then
′
xla (x) = la (x) + xl′a (x)
50
We have a network as shown in figure 8, where la (x) = 1, a constant
latency function, and lb (x) = x, a linear one. This means that the first
arc has the same travel time regardless of how much flow is assigned to
it, while the other arc has a travel time directly proportional to the flow.
Now assume we are to route a flow of value 1 from s to t. The objective
Figure 8: A small network with two arcs. Both arcs have unlimited ca-
pacity, and latencies are shown in the figure.
τs = xa + xb2
τs′ = −1 + 2xb
1 2
τu = xa + x
2 b
Differentiated this is
τu′ = −1 + xb
And we see that τu has a minimum at xb = 1, which gives τs = 1. So the
user equilibrium has in this case 34 of the total travel time of the system
optimal solution. None of the users accept that any other can travel
faster than themselves, and thus everyone end up on the same road b,
51
worsening the travel time for all the other commuters, and ultimately
themselves.
How bad great can the difference between the system optimal and
user equilibrium solutions be? It has been shown [3] that for linear la-
tency functions the relation is never greater than 34 . But with arbitrary
latency functions, even convex ones, we can get arbitrarily large differ-
ence. Replacing lb (x) = x with lb (x) = x n we can do the same analysis
again.
τs = xa + xbn+1
τs′ = −1 + (n + 1)xbn
n1
1
xb0 =
n+1
1
And the optimal solution is 1 − xb0 + xbn+1
0
= 1 − xb0 1− n+1
which gets
arbitrarily small with a sufficiently large choice of n.
For the user equilibrium we get
1
τu = xa + x n+1
n+1 b
τu′ = −1 + xbn
xb0 = 1
And the total travel time is again 1. Comparing with the system optimal
we see that the quotient becomes arbitrarily large with sufficiently large
n!
Theorem 5.2 The quotient of the total travel time of the user equilibrium
and the system optimal solution may be arbitrarily large for arbitrary
latency functions.
The other extreme case to consider is when all latency functions are
constant. Then we see that the terms in the objective functions for the
system optimal and user equilibrium problems coincide:
Zx Zx
′
xl(x) = xl0 = l0 dx = l(x ′ )dx ′
0 0
And we therefore get that the system optimal and the user equilibrium
problems are exactly the same!
Theorem 5.3 The user equilibrium and the system optimal solutions co-
incide if all latency functions are constant functions.
52
Usually the latency functions are somewhere in between the two ex-
tremes, and it is meaningful to work with both cases.
How is it possible to force the user equilibrium and the system opti-
mum to coincide? In the first example above we could guess at adding a
toll of value 21 to the road with the linear latency function, thus replacing
1
lb (x) = x with lb (x) = x + 2 . Here the constant factor is not actually
time delay, but rather a tax you would have to pay to drive along that
road. This should work because the two arcs would then have the same
cost with the system optimal flow, and this should then also be a user
equilibrium flow. Repeating the analysis we get
1 2 1
τu = xa + x + xb
2 b 2
1 1
τu′ = −1 + xb + = − + xb
2 2
1
And we see that the minimum is now at xb = 2 , which is indeed the
system optimal solution! What about the general case?
Remember Wardrop’s characterization of a user equilibrium; that all
paths from s to t that are in use have the same cost, and cost equal to
or less than that of any unused path. In a system optimum this is not
necessarily the case. I want to introduce taxes to some of the arcs in a
given network such that the cost incurred by the travelers along arc a is
l(a) + T (a) where T : A → R + is the tax function. Then there is a system
optimal solution that minimizes the total travel cost fs , and there is
also a user equilibrium Fu corresponding to the new tax modified cost
functions. Let it be absolutely clear that these taxes do not directly affect
the latency along the arcs, but are only perceived by the travelers some
generalized cost which they want to minimize together with travel time.
Then I claim that if these taxes are chosen appropriately we can force
the system optimum fs and the user equilibrium fu to coincide! To solve
the problem of choosing an appropriate tax function I came up with the
following:
Theorem 5.4 Given an acyclic graph G, a length function l : A → R and
vertices s with in-degree 0 and t with out-degree0 it is possible to find a
function T : A → R + such that all s − t-paths have equal length when
considering the length function l + T , and such that the length of all these
equal the length of the longest s − t-path when considering only l. This
can be done in time O(|A|).
Proof. Since G is acyclic and s, t have in- and out-degrees 0 respectively
we can find a topological ordering v0 , v1 , . . . , vn of G where v0 = s and
53
vn = t, and where all arcs are of the form vi vj , i < j. This can be done
in time O(|A|).
Let Pvi denote all vi − t-paths and let Lvi = max{l(P ) : P ∈ Pvi . I will
prove by induction that for any vertex vi we can find T (a) such that
Corollary 5.1 The tax function T above also makes all vi − vj -paths
equally long when considering the length function l + T .
54
Algorithm for finding optimal tolls first in Gfs and then in all of G.
Lv ← −1 ∀v ∈ V
Lt ← 0
call findMaxDistance(s)
call unusedTolls()
function findMaxDistance(v)
if Lv ≥ 0 return Lv
Lv ← max{call findMaxDistance(u)+l
a fs (a) : a = vu ∈ δout (v), fs (a) > 0}
T (a) ← Lv − Lu − la fs (a) , ∀a = vu ∈ δout (v), fs (a) > 0}
return Lv
function unusedTolls()
d(v) ← Ls − Lv ∀v
U ←V
while U ≠ ∅
v ← u ∈ U s.t. d(u) is minimal
if d(v) > Ls BREAK
U ← U \ {v}
55
and all other paths have l + T -length greater than or equal to Ls .
Note that we could actually have chosen any acyclic flow f in the
algorithms above, not just the system optimal fs , as the theorem (5.4)
only requires the graph to be acyclic. So we see that we can make any
flow a user equilibrium by proper taxation! But for me, of course, the
system optimum makes the most sense.
What about the case when there is no longer just one commodity? We
can also solve the more general multi commodity problem by calculating
a set of tolls for each commodity. Then we would require knowledge of
the origin and destination of each traveler in the network. Although this
is currently impractical for real world traffic uses, it is an interesting
theoretical result. And with the ever increasing importance of computer
networks in our daily life, it might be possible to implement successfully
in the future.
It could also be possible to find a way of calculating just one tax function
for several commodities, such that the system optimum becomes a user
equilibrium when including taxes. Alas I have not been able to solve this
problem. I end this subsection with an example calculation of a static
Figure 9: An example graph with one source/sink pair and with latencies
and capacities as given on the arcs.
56
system optimal solution and corresponding taxes. Consider the graph
shown in figure (5.2). We are to route a flow of value 2 from s to t. To find
the system optimal solution I will use the alternative optimality criterion
derived in the previous subsection. Let P1 be the path P1 = s − u − t,
P2 = s − u − v − t, P3 = s − v − t, P4 = s − t along the arc with cost 6 and
P5 = s − t along the arc with cost 7. Then x1 + x2 + x3 + x4 + x5 = 2. And
L1 = 2(x1 + x2 ) + 4
L2 = 2(x1 + 3x2 + x3 ) + 1
L3 = 2(x2 + x3 ) + 4
L4 = 6
L5 = 7
Let us assume that x5 = 0. We will see later that this is a correct as-
sumption. Then the equalities above constitute a linear set of equations.
Solving this we get
1
x1 = x2 = x3 = x4 =
2
The corresponding flow is shown in figure (5.2), with the latencies in
parenthesis.
Using the latencies, or costs, in this graph, we run the taxing algorithm
on the graph shown in figure (5.2), where the resulting taxes are shown
as +T on each arc. Adding these taxes to the original graph we finally
get the graph in figure (5.2), where the latencies and taxes add up to
form the new costs along each edge. We easily check that the flow x1 =
1
x2 = x3 = x4 = 2 makes all s − t-paths in use equally expensive when
considering both latencies and taxes. And we also know that this flow
reduces the total travel time, since it was the solution to the system
optimality problem we started with.
Out of curiosity we can also find the user equilibrium in the original
problem in the same way as we found the system optimum. This turns
out to be
1 4
x1 = x3 = , x2 =
3 3
34 136
The total cost of the user equilibrium flow is then 3
= 12
, whereas the
system optimal flow has cost 394
= 117
12
.
57
Figure 10: The system optimal flow of this graph, along with latencies
corresponding to this particular flow fs .
58
Figure 11: The graph Gfs after computing taxes. Total arc costs l + T are
latencies + taxes on each arc.
59
Figure 12: The original graph, with necessary taxes added along the arcs.
The user equilibrium when considering latencies + taxes is now the same
as the system optimum when considering only the latencies.
60
5.3 The dynamic case, simplified latency model
One interesting special case of network models was the one where there
are absolute capacities on the arcs, and where the travel time (or cost)
along each arc remains constant with regard to loading. For a vehicle
traffic situation this seems a bit unrealistic, but for e.g. information flow
in networks these assumptions might very well be acceptable. In fact,
the deterministic queue model [2] exhibits exactly this behavior, under
the assumption that there are no queues! In this case very much is
known about our graph, and computing shortest paths, minimum cost
flows, maximum flows etc. is all possible with well known polynomial
time algorithms. Perhaps we might derive some useful results from this
already well established area?
d xa (t)
la xa , t = −1 (26)
dt c(a)
la (xa , t) = la (27)
if there is no queue, and the inflow xa (t) not is great enough for one to
form.
Let us also assume the departure deviation cost function g(t) = 0 to be
zero, and the arrival deviation cost function to be h(t) = 12 |t|.
In this case a system optimal solution will consist of a constant inflow
equal to the capacity of the bottleneck, such that the bottleneck is max-
imally utilized, but also such that no queues arise. The arrival time in-
V V
terval will, for a dynamic flow of value V , be [− 2c(a) , 2c(a) ], which causes
V V
the departure time interval to be [− 2c(a) − la , 2c(a) − la ].
The dynamic user equilibrium is again such that the total cost expe-
rienced by each traveller s equal.So the dynamic system optimum above
certainly differs from the user equilibrium in that several of the travel
61
agents could have done better by choosing a departure time that would
bring their arrival time closer to their desired arrival time t = 0. But in
doing so they would have caused all later entrants to be delayed by the
time it would have taken themselves to pass the bottleneck, and thus
a queue would have arisen, increasing the total cost of all later travel
agents. Here the dynamic flow that causes all travel agents to experi-
V
ence the same cost has a queue that starts to form at time t = 2c(a) − la
and grows at a rate such that
l′a (xa , t) = −h′ la (xa , t) + t
until the time when la (xa , t) = 0, at which the queue starts to shrink
again at a rate such that
l′a (xa , t) = −h′ la (xa , t) + t
The dynamic inflow that satisfies this is
( V V
2c(a) : − 2c(a) − la ≤ t < − 4c(a) − la
xa (t) = 2 V V
3
c(a) : − 4c(a) − la ≤ t < 2c(a) − la
Comparing the two solutions we see that the inflow happens during ex-
actly the same time interval, but in the user equilibrium case the inflow
is great enough to cause a queue, so that none of the later travelers get
a lower total cost than the very first ones.
In the rest of the treatment on dynamic flows I will, however, assume
there are no queues. We see that adding a time dependent toll
V 1
ξ(t) = − |t + la |
2c(a) 2
at the entrance to the bottleneck would cause the dynamic system opti-
mal flow to be a user equilibrium! And I expect it to be easy to find some
tolls that can be used to make the system optimal flow a user equilib-
rium, also in the more general case. The crudest approach could just
be to add tolls at the sink of a flow, equal to some constant minus the
arrival deviation cost function for the flow arriving at that sink, and pos-
sibly also negate the departure deviation cost in the same way. Thus the
rest of this section will focus on constant latency function networks. No
queues!
The system optimal solution being the one that minimizes the total
cost incurred by all users of the network, its existence is not hard to
62
prove. Since the total cost function is a continuous function into R with
a bounded minimum this minimum is attained by some dynamic flow.
In general it might be hard to say whether the system optimal solution
is unique or not, but in the case of the constant latency simplification
we can see that it is not necessarily unique, but convex: Let f1 and f2
be two system optimal solutions with no queues, and with total costs
C1 = C2 = C. Both these are governed by (27), since there are no queues.
Consider a convex combination f3 = λf1 + (1 − λ)f2 , λ ∈ [0, 1]. Then
along each arc in f1 the flow is always less than or equal to the capacity
of that arc, and the same for f2 , so a convex combination of flows along
each arc will again never exceed the capacity of that arc. Thus there will
not be any congestion in f3 either. Now since the latency of each arc
is constant with regard to flow, if Ca,i is the total cost associated with
using arc a in solution fi , then Ca,3 = λCa,1 + (1 − λ)Ca,2 , and thus the
total cost of f3 is just C3 = λC + (1 − λ)C) = C, so S3 is also system
optimal.
63
time discretization unit ∆t. There are also arcs from (v, tn ) to (v, tn+1 )
with cost equal to tn+1 − tn , representing waiting one time unit at node
v.
In addition there are two nodes for each origin destination pair; one
representing the origin at all time steps, the universal origin su , and one
representing the destination at all time steps, the universal destination
tu . Let (s, tn ) be the original origin node in each time step, then there
are arcs from su to (s, tn ) with cost equal to the departure deviation cost
at time tn , and similarly for the destinations. The universal origins and
destination are sources and sinks respectively with supply equal to the
total amount of traffic that must pass from the origin to the destination
in the original graph. An example of this construction is shown in figures
(5.3.7) - the original graph - and (5.3.7) - the augmented graph.
My claim is that finding a system optimal travel plan is equivalent to
finding a minimum cost flow through the augmented graph, that satis-
fies the source and sink constraints at the origins and destinations. This
can be seen by letting the time discretization steps go towards 0. Then
the total cost of the multi-commodity flow in the augmented graph ap-
proaches the dynamic system optimality objective function, as the sums
over all time steps approach the integrals. And since we minimize the
cost of the multi-commodity flow in the augmented graph, we also min-
imize the dynamic system optimality objective function.
We then see immediately that this model has good flexibility in several
aspects: varying capacity with time, using any kinds of departure and
arrival specific cost, time varying toll functions.
The system optimal solution is one which minimizes the total cost in-
curred by all travel agents. Since the cost of following a path from su via
(s, tn ) and (t, tm ) to tu in the augmented graph is the same as the cost
that a travel agent departing at time tn and arriving at time tm incurs,
then a minimum cost flow through the augmented graph must be the
same as a system optimal solution in the continuous case. This is with
the reservation that all time dependent cost functions are piecewise con-
stant in the time discrete graph, but may be continuous in the original
64
problem. But by choosing a fine enough discretization we can get arbi-
trarily close to the original continuous cost functions. This will, however,
lead to a graph with an arbitrarily huge number of nodes, something we
do not want, and thus choosing a fine enough but also not too fine dis-
cretization will be important.
Thus the problem of finding a system optimal flow in a network where
we assume constant travel time and absolute capacities on the arcs can
be approximated by finding a minimum cost flow in the augmented
graph. This results in a dynamic flow that is really a different static
flow for different time steps. But since it is a feasible flow for each of
these, the concatenation of each of these static flows result in a feasible
dynamic flow. So by finding a minimum cost static flow that satisfies
the constraints of the augmented graph, we have really found a dynamic
flow that satisfies the dynamic constraints (14 - 17).
It is also possible to solve the multi-commodity minimum cost problem
by use of linear programming, and thus we can even approximate sys-
tem optimal solutions to networks with several origin destination pairs!
Something the first outline of our time discrete graph did not allow for
was the option of having different preferred arrival times (or departure
times). I will give a solution to this for the arrival time case. The depar-
ture one is treated similarly.
By introducing some extra nodes and altering the arcs that enter the uni-
versal sink we get a graph where different choices of paths the last two
arcs correspond to different arrival time preferences. Let t be the orig-
inal destination node and (t, tn ) its time discretization as usual. Then
instead of having arcs from each of the (t, tn ) to tu we introduce an ex-
tra set of nodes, δhk , between these, such that each of these extra nodes
correspond to a different arrival deviation cost function hk . From (t, tn )
to δhk there are arcs with unlimited capacity and cost equal to hk (tn ),
i.e. the cost of arriving at time tn with cost function hk . And from each
of the δhk to tu there are arcs with capacity equal to the amount of travel
agents having hk as their arrival time cost function.
We see immediately that this allows for different preferences in arrival
time, as this is just the same as translating the cost function along the
time axis. But it also allows for any different kinds of cost functions!
65
5.3.6 Properties of the augmented graph
Proof. All nodes of the graph are one of the following types:
In fact the graph is not only acyclic, but in the case when the latency
and capacity functions are constant over time, which is the case we are
the most interested in, it contains a plethora of equal paths from say
(s, tn ) to (t, tm ), and then also from (s, tn+k ) to (t, tm+k ) with k ∈ Z.
We might expect that if one of these is used, then so will many of the
other equal paths be. Unfortunately this information is not utilized by
the Simplex algorithms. In the algorithm in the last part of this section I
do utilize this information, to find a much faster solution method than
this augmented graph method. This comes at the cost of the loss of
flexibility in time varying latencies and capacities.
I will demonstrate how to create and use the augmented graph by pre-
senting a small example. The network we will use is rather simple, con-
sisting only of an origin vertex and a destination vertex, and two dif-
ferent arcs between these. One of the arcs has a shorter length than
the other, and also greater capacity, but as the desired flow through the
66
Figure 13: A sample network we discretize and do some calculations
with.
graph exceeds the time unit capacity of the shorter arc we expect that
both arcs will be used. The original graph is drawn in figure 5.3.7.
In the first example I will show the first approach to our time dis-
crete graph, that is allowing only one arrival cost function. The time dis-
cretization is done here by choosing ∆t = 1, and by using 6 time steps
tn , i = −1, . . . , 4. The arrival cost function h(t) used here is piecewise
linear, with h(t) = −0.5t, t < 3 and h(t) = 2t, t > 3, and the departure
cost is g(t) = 0. Thus the costs along the arcs from the universal origin
su to the time discretizations (s, tn ) of the origin node are all zero, and
the capacities are infinite, and the arcs from the time discretizations of
the destination node (t, tn ) to the universal destination tu have costs
h(tn ) and infinite capacities. And also, the arcs from (s, tn ) to (t, tn+1 )
have cost 1 and capacity 10, and the arcs from (s, tn ) to (t, tn+2 ) have
costs 2 and capacity 5. The resulting graph is shown in figure 5.3.7.
Solving the problem of a minimum cost flow of value 60 we end up
with fully utilizing all the arcs marked in blue and cyan (dashed) colors,
and we also see that we could have used the green arcs (dotted) at the
expense of the cyan ones, something which would not make any differ-
ence to the total cost. Interpreting this we see that the faster arc will
be used over a greater time interval than the slower one, but that both
of them will indeed be used. Adding together the cost of the different
components of the flow, we get a total cost of 122.5. Now the way we
have defined the cost along the arcs that correspond to arrival costs, we
have assumed everyone arrives at exactly the same time, i.e. we have
chosen l (t, tn )tu = h(tn ). This is of course slightly wrong. We could
67
Figure 14: An augmentation of the sample graph, with time discretiza-
tion unit 1. A minimum cost flow is shown in thick blue and cyan
(dashed) lines. The green (dotted) arcs have the same cost as the cyan,
and could have been used as well.
68
instead have used the average cost of the flow with average arrival time
tn , and this will henceforth be used. Now since h is piecewise linear
this actually gives the same cost everywhere except where h has a break
point. In this example h only has one break point, namely at t = 3,
and the cost l (t, 3)tu here becomes 85 instead. Recalculating the total
7
cost then gives 131 8 , which is indeed the cost of this flow when viewed
continuously as well.
Solving analytically we get that the faster arc will be in full use in the
time interval that causes arrivals in the interval (− 26 , 119 ) and the slower
30 30
34 104
arc in the time interval that causes arrivals in the interval ( 30 , 30 ). In-
5
tegrating the flow cost terms here we get a total cost of 123 6 . We see
that we here have a better solution that the one we got by using the
augmented graph, which gave a solution that was roughly 6.5% more ex-
pensive. But remember that in the solution of the minimum cost flow
problem we had several equally expensive choices for routing the most
expensive part of the flow. If we had chosen do divert some flow to each
of them, we should expect to get a better result than we did. This is
again because the cost along the arrival cost arcs are based on arrival at
the mean time of the time interval represented by that arc, and if we had
only used a bit of that interval, we could have chosen the cheaper part
of it, thus obtaining a lower cost than our graph model shows.
Pursuing this idea I tried moving the desired arrival time from t = 3
to t = 2.5, which then changes only the costs along the last arcs in the
graph. Solving the minimum cost flow problem here gives a flow with
value 60 and cost only 125, or less than 1% more than the optimal cost!
This solution is shown in figure 5.3.7. We see that here we have no al-
ternative choices of arcs that would give the same total cost. Now the
optimal solution would still use some of the unused arcs to a very small
extent, at the expense of the most expensive choices here, but I think we
are pretty close, and with a rather simple discretization. We see, how-
ever, that we could also have bad luck when choosing our discretization.
An upper bound on the error of the cost obtained could be nice.
Now for the case with different arrival cost functions. Assume three
different arrival cost functions h1 , h2 , h3 with h2 as the cost function h
used above, with desired arrival time t = 3, and with h1 (t) = h2 (t + 1)
and h3 (t) = h2 (t − 1). The amount of traffic that has each cost function
is 20, 30 and 10 respectively. The augmented graph is set up above,
except for the last arcs. These now go to the three different vertices
for the different arrival cost functions, and then there are arcs from
each of these to the universal destination vertex. The graph is shown in
69
Figure 15: The same graph augmented, but with the time discretization
translated 12 time unit. This results in a much cheaper minimum cost
flow, in thick blue.
70
figure 5.3.7. Again the solution to the minimum cost flow problem with
a flow of value 60 is shown with the arcs in blue being fully utilized. The
solution has a total cost of 105.
Figure 16: Again the same graph, but with three different arrival cost
functions. The thick blue lines indicate again the minimum cost flow.
Having dealt with the case of routing a flow from an origin to a desti-
nation in a network across different times, we see that there’s a fairly
obvious generalization we should look at, and which we have already
mentioned: Dynamic networks with several origin/destination pairs.
How to construct the augmented graph in this case is rather straightfor-
ward: Just add universal origins and destinations (or sinks and sources),
possibly with corresponding departure or arrival cost nodes, for each
of the sources and sinks in the original network. Thus we get several
universal sources and sinks that will be used as the sources and sinks of
our new multi-commodity flow problem in the time discrete graph.
71
To solve the multi-commodity flow problem we need only solve the LP
problem we get from formulating the graph’s flow constraints and costs,
like in the static multi commodity case.
Thus we see that practically any dynamic system optimality problem can
be solved this way, but possibly resulting in a large graph for which the
multi-commodity flow problem takes long time to solve. Both the num-
ber of unknowns and constraints is proportional to both the number
of commodities and vertices. In the brief time analysis of the Simplex
algorithm we used the dimensions n, m of the constraint matrix as a
measure of problem size. Here n, m ∈ O(|T ||I|). We get slightly better
results for the single commodity case, but the time discretization can
still be a problem if the network already is large.
• The dynamic flow problem: Finding a dynamic flow from one source
to one sink satisfying a given supply within a certain time interval.
72
• Quickest dynamic transshipment problem: Finding a dynamic trans-
shipment flow in as short a time as possible. Uses the above algo-
rithm with binary search for smallest possible time interval.
Let us now reconsider the dynamic system optimal planning in the con-
stant latency setting. To summarize we have a network consisting of a
graph G with several origin-destination vertex pairs (si , ti ), each with a
supply/demand. Each arc a has a constant latency function la (x) = la
and a capacity c(a), c : A → Q+ . Each commodity also has a departure
cost function gi (t) and and arrival cost function hi (t) applying when
flow leaves the source or enters the sink.
Looking back at the general form of the system optimal planning prob-
lem (11 - 17) we see that the constant latency functions simplify the ob-
jective function slightly and the constraints massively. This is because
we no longer have the complicated relation between inflow and outflow
to each arc. We denote the inflow to arc a at time t by xa (t), and the
outflow at time t + la is then equal to xa (t).
We still have the objective function split in two parts. This really is just
like in the augmented graph above, but from a slightly different view-
point, as we no longer make a time discretization. The total travel time
is now:
X ZT
xa (t)la dt (28)
a∈A 0
And the total departure and arrival time deviation cost is:
XZT
bi (si , t)gi (t) − bi (ti , t)hi (t)dt (29)
0
i
73
The constraints apply just as before, but with the much simpler relation
between inflows and outflows.
If we choose to optimize with regards to the travel time only our
problem really simplifies. Since the total travel time is also the integral
over all traffic of the travel time experienced by each travel agent, it is
clear that minimizing the travel time of each infinitesimal piece of flow
minimizes the total travel time. But this is just the same as calculating
a shortest path through the graph, and routing traffic only along this
path until all the supply is satisfied! Of course this might lead to a
really long time during which traffic flows in the graph, and commuters
might be almost arbitrarily late (or early) for work. Thus minimizing
the total travel time alone makes little sense in the dynamic setting. On
the other hand optimizing only with regard to the departure and arrival
costs we try to find a cheapest (and thus shortest) possible set of time
intervals in which flow leaves the sources and enters the sinks. This is
close to the quickest dynamic flow problem for one origin/destination
pair, or the quickest transshipment problem with several pairs [4]. And
as we remember these problems are now solvable in polynomial time
with chain decomposition! But since travel time is not regarded at all,
disproportionally slow routes may be utilized, leading to a solution that
is not system optimal in the full sense. It is again not good enough
to consider only one part of the objective function. However using the
ideas pursued by Hoppe we might hope to devise a faster way of solving
the full dynamic system optimality problem by eliminating the use of
the time-augmented graph!
We still assume that all latency functions are constant, and that we
have capacity constraints on the arcs of our graph. We also assume that
all traffic shares the same convex departure and arrival cost function
g(t), h(t). I’ll start with the case of a single commodity, or dynamic s −t-
flow. What I propose is that the following Dynamic System Optimality
algorithm solves the system optimality problem with these assumptions.
This algorithm is based on the Successive Shortest Path algorithm in
section 4.5.2.
Let us first define a chain (flow):
74
reals denoting the time interval in which flow runs along Pi ; the starting
time tis at source s and the ending time tie at sink t.
Let F = {Fi } be a set of chains, and let li = l(Pi ) be the length of Pi for
compactness. Then the total dynamic flow F : A × R → R induced by F
is the sum of all chains in F , and the total amount of flow
X
ftot = ci tie − tis − li
i
Hi (τ) is then the total cost incurred by a traveler using path Pi at a time
such that she arrives at t at time τ. We assume that each Hi (t) has a
minimum for some t.
75
Dynamic System Optimum algorithm
old new
Cmax , Cmax ←0
F ←∅
G0′ ← G
i←0
for j = 1, . . . , i − 1
tjs ← min{t : Hj (t + lj ) = Cmax new
}
e new
tj ← max{t : Hj (t) = Cmax }
if ftot ≥ fdemand
BREAK
else
F ← F ∪ {(Pi , ci , tis , tie )}
Gfi ← Gfi−1 updated with flow ci along Pi
old new
Cmax ← Cmax
old new
find Cmax ∈ [Cmax , Cmax ] s.t. ftot = fdemand
s e
when ti , ti is updated accordingly to Cmax
F induces a system optimal dynamic flow F
The idea behind this algorithm is simple enough: Find a shortest path
in the residual graph and determine the minimum cost for anyone using
it, and the time at which this minimum is attained. Use this path ini-
tially at only the minimum cost time. Then increase the time interval for
which this path is in use, until some other path (possible with negative
arcs, meaning a modification to already existing flow) becomes equally
expensive at its minimum cost time. Then increase the time interval for
76
which both these paths are in use, until a third path becomes equally
expensive. And so on.
The chains are chosen and updated such that no infinitesimal chain in
use is more expensive than any not in use, and such that no infinitesi-
new
mal chain in use has cost greater than Cmax . In addition all infinitesimal
old
chains with cost less than or equal to Cmax is in use at the start of each
loop iteration, so the Cmax that gives a feasible total flow is always in
old new
the interval [Cmax , Cmax .
The total cost of the dynamic flow is the same as the sum of the costs
of each of the chains. So a chain with flow along negative arcs takes into
account the modification done to already existing static flow, and these
chains are then chosen in such a way that the total cost is always the
lowest. Note also that the total cost of dynamic flow F induced by F can
be much more compactly given with the chain representation. The total
cost of chain Fi is
Z te
i
Hi (t)dt
tis +li
Z te −li Z te
i i
= g(t)dt + h(t)dt + (tie − tis − li )li
tis tis +li
Notice that which arcs the chains use are of no direct importance, as the
total cost is fully determined by outflow from the source and inflow to
the sink.
Before proving correctness of the algorithm, let’s look at an example
application. The graph we consider is shown in figure (17). Here the
departure and arrival deviation cost functions are
1
g(t) = − t
2
1
h(t) = t + |t|
2
The first chain found by the algorithm follows path P1 = (s − u − v − t)
which has total latency l1 = 3 and capacity c1 = 3. We see that H1 (t) =
9
2
+ |t| which is minimal at t = 0. Thus F1 = (s − u − v − t), 3, −3, 0 is
old
added to F at the end of the first loop iteration, with Cmax = 29 .
The residual graph G1′ resulting from f1 is shown in figure (18). The
shortest path in G1′ is P2 = (s − v − u − t) with total latency l2 = 5 and
15
capacity c2 = 1. This gives H2 (t) = 2 + |t| which is minimal at t = 0.
new 15
Thus Cmax is raised to 2 , which increases the time intervalof use of F1
to t1s = −6, t1e = 3. This gives a total flow of 3 3 − (−6) − 3 = 18 < 26,
77
Figure 17: An example constant latency graph, with latencies and capac-
ities shown on each edge, and the total supply shown in the terminal
vertices.
78
so F2 = (s − v − u − t), 1, −5, 0 is added to F at the end of the second
iteration, with Cmaxold
= 15
2
In the third iteration the only s − t-path in G2′ is the slow arc st. We
get P3 = (s − t) with latency l3 = 7 and capacity c3 = 2. This gives
H3 (t) = 21 2
+|t| which is minimal at t = 0 with minimum value 21 2
. Raising
new 21 s e
Cmax to 2 we increase the intervals of use of F1 , F2 to t1 = −9, t1 = 6 and
t2s = −8, t2e = 3 which gives a total flow of 3 6 − (−9) − 3) + 1 3 − (−8) −
5 = 42 > 26. Thus we break the loop and search for a Cmax ∈ [ 15 2
, 21
2
]
that gives the correct amount of total flow. Since we have piecewise
linear cost functions in this example we quickly find that Cmax = 17 2
gives the intervals t1s = −7, t1e = 4 and t2s = −6, t2e = 1 resulting in exactly
26 total flow.
Figure 18: The residual graph G1′ . We see that the shortest s − t-path is
now (svut).
79
Figure 19: The system optimal dynamic flow shown at 12 different time
steps. Green (full drawn) represents the chain F1 , while red (dotted)
represents F2 .
The numbers inside the vertices is the number of the slice they belong
to (Definition 5.3 below).
80
Theorem 5.5 The Dynamic System Optimum algorithm above find a dy-
namic s − t-flow that is feasible and minimum cost.
Proving that this theorem is correct will be some work. First let’s show
that it produces a dynamic flow that is feasible at all times. For this we
need the following lemma:
Lemma 5.1 Suppose f is a minimum cost static flow in G, and let static
flow g augment f along a shortest s − t-path in residual graph Gf . Then
(1) f + g is a minimum cost static flow in G and (2) for any vertex v the
distance from s to v in Gf is less than or equal to the distance in Gf +g , or
df (s, v) ≤ df +g (s, v), and df (v, t) ≤ df +g (v, t).
Lemma 5.2 For any vertex v and any chains Fi , Fj , j < i covering v at
time intervals τFi (v), τFj (v) we have
Proof. For the source and sink vertices this is easy to show, as for each
Fi we have
Hi (tis + li ) = Cmax = H(tie )
So for the starting times we have
81
we can conclude that
tis ≥ ti−1
s
82
Definition 5.2 A static s −t-flow f is extreme if it is minimum cost among
all static s − t-flows with the same value.
So all flows in the Successive Shortest Path algorithm, and also the static
flows in this algorithm, are extreme. There is a useful characterization
of an extreme flow:
Lemma 5.3 A flow f is extreme if and only if the residual graph Gf con-
tains no negative cost cycles (or circulations).
of all vertices v at their respective time intervals Tj1 (v), the (2K − j)-th
slice is the union
∪v∈V v × Tj2 (v)
83
s s
Proof. Look
at (v, t) in the i-th slice. Then either (1) t ∈ ti +dfi−1 (s, v), ti+1 +
e e
dfi (s, v) or (2) t ∈ ti+1 − li+1 + dfi (s, v), ti − li+ dfi−1 (s, v) or (3) if
i = K then t ∈ tis + dfi−1 (s, v), tie − li + dfi−1 (s, v) .
(2) Look at vertex u. Then by traveling within the i-th slice the earliest
we can get to u is
e
t + dfi (v, u) ≥ ti+1 − li+1 + dfi (s, v) + dfi (v, u)
so this leads to
e
t + dfi (v, u) ≥ ti+1 − li+1 + dfi (s, u)
Now assume
dfi−1 (s, v) + dfi (v, u) < dfi−1 (s, u)
Let Psv be a shortest s − v-path in Gfi−1 and Pvu a shortest v − u-path
in Gfi . Then clearly Pvu ∩ Pi−1 ≠ ∅, since Fi must have made a shorter
path from v to u possible. With Pvu = a1 a2 . . . am let w be such that i
is maximal when ai = yw ∈ Pvu ∩ Pi−1 for some vertex y, and let x be
such that i is minimal when ai = zx ∈ Pvu ∩ Pi−1 for some vertex z. Let
Pwx be the w − x-component of Pi and Pxw the x − w-component of Pvu .
Then we must have
l(Pxw ) + l(Pwx ) = 0 (30)
−1
. Clearly it cannot be greater, as Pxw can be no longer than Pwx , and if it
was less then a flow of value ǫ along Pwx and back along Pxw would be
a negative cost circulation, contradicting the fact that fi−1 is extreme.
We can rewrite the assumption above as
Now since Fi only affects Pvu along Pxw we can split Pvu in Pvx , Pxw , Pwu
where the first and last ones are paths in Gfi−1 . It is clear that
84
But then (32) and (31) together with the splitting of Pvu become
From this it is clear that a negative length cycle in the dynamic residual
graph must stay within one slice. But a negative cost cycle within one
slice would imply a negative cost cycle in the static residual graph corre-
sponding to that slice, which contradicts the fact that all the static flows
are extreme. Thus we have:
Corollary 5.3 All shortest (1) s −t-paths and (2) t−s-paths in the dynamic
residual graph stay within one slice.
Proof. (1) A path ending at t in the i-th slice can leave s in the i-th
slice, but not later. (2) Similarly a path starting from t in the j-th slice
must follow a flow from s to t, all of which follows paths of length
0 ≤ l ≤ dfj−1 (s, t). Thus this flow cannot have started from s before the
j-th slice.
Note that the second statement is equivalent to saying that the slowest
flows in use by F are not slow enough to fall through to later time slices.
I am finally ready to prove Theorem 5.5.
Proof. [Theorem 5.5] Let F be the dynamic flow found by the algorithm
and let Z be a minimum cost dynamic flow with the same value. Then the
difference between the two dynamic flows Z − F can be written as a sum
85
of non-canceling dynamic circulations, possibly with non-constant flow
values, and including waiting at vertices. By non-canceling I mean that if
a dynamic circulation y has positive flow along arc a at time t then no
other dynamic circulation x can have negative flow along a (or positive
flow along a−1 ) at time t that cancels the flow of y. This independence is
important because we then know that each of these dynamic circulations
have to be feasible when added together with F , which again means that
any positive flow in such a circulation y has to be feasible together with
flow in F , and any negative flow in y can only cancel flow in F .
Now remember that the total cost of F was determined fully by outflow
from s and inflow to t. Consider the cost of an infinitesimal piece of one
of the circulations y, with constant travel time ly and unit value. If this
circulation contains neither s nor t the cost is 0. If it contains only s,
and leaves s at time τ the cost is
g(τ) − g(τ + ly ) + ly
−h(τ) + h(τ + ly ) + ly
In both these cases we see that for this cost to be negative we must have
ly < 0, because of the assumptions g ′ (τ) ≤ 1, h′ (τ) ≥ −1. But we have
already proven in Corollary 5.2 that this is impossible.
If it contains both s and t, leaves s at τs , travels to t along a path of
length l+ −
y , leaves t at τt and travels to s again along a path of length ly
the cost is
g(τs ) + h(τs + l+ + − −
y ) + ly − h(τt ) − g(τt + ly ) + ly
86
6 Summary
In this paper I have studied system optimal and user equilibrium flows
in static and dynamic networks, and how to find these in both general
and more specific situations. Of most interest are the alternative char-
acterization of static system optimal flows, the algorithm for turning a
static system optimal flow into a user equilibrium by taxes along the
arcs, and the chain flow algorithm for solving the dynamic system op-
timality problem with the assumption of constant latency functions on
the arcs. I will summarize these here.
that is equal, and equal to or less than that of any unused s−t-path.
87
I have also programmed this algorithm, and tested it for some sim-
ple graphs. The code is found in the appendix.
88
7 Appendix
Below follow the .java files containing the code I have written for han-
dling these graphs on the computer.
Arc represents an arc used in the graph implementation.
package trafficGraphs;
89
public String toGraphString() {
return source.getQuotedName() + " -> " + target.getQuotedName()
+ " [label = \""
+ (capacity == Double.POSITIVE_INFINITY ? "-" : capacity)
+ ", " + getCost() + "\"]";
}
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.*;
writer.println("}");
writer.close();
}
90
public abstract class CostFunction {
public abstract double getCost(double time, double step);
CostVertex extends Vertex, and is used for vertices with supplies, and
therefore cost functions.
package trafficGraphs;
91
}
Graph is the main class for representing a graph. It uses most of the
other classes here, and also contains the code that performs the dis-
cretization.
package trafficGraphs;
import java.util.*;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
public Graph() {
vertices = new HashMap<String, Vertex>();
arcs = new HashMap<String, Arc>();
}
/**
* Reads a graph from a text file.
*
* Assumes all vertices first, format: ’V’ name ’CV’ name magnitude [cost
* function]
*
* Then arcs, format: ’A’ name length [capacity [toll]] source target
*
*
* @param filename
*/
protected void fromTextFile(String filename) {
Scanner scanner;
try {
scanner = new Scanner(new File(filename + ".txt"));
} catch (FileNotFoundException e) {
System.err.println("The file was not found!");
e.printStackTrace();
return;
}
String type;
int linen = 0;
while (scanner.hasNextLine()) {
try {
type = scanner.next();
if (type.equals("V")) {
addVertex(new Vertex(scanner.next()));
} else if (type.equals("CV")) {// TODO: Fixit cost function.
addVertex(new CostVertex(scanner.next(), scanner.nextDouble(),
CostFunction.makeCostFunction(scanner.nextLine().trim())));
} else if (type.equals("A")) {
String[] line = scanner.nextLine().trim().split(" ");
switch (line.length) {
case 4:
addArc(new Arc(line[0], Double.parseDouble(line[1]),
vertices.get(line[2]), vertices.get(line[3])));
break;
case 5:
addArc(new Arc(line[0], Double.parseDouble(line[1]),
Double.parseDouble(line[2]),
vertices.get(line[3]), vertices.get(line[4])));
break;
case 6:
addArc(new Arc(line[0], Double.parseDouble(line[1]),
Double.parseDouble(line[2]),
92
Double.parseDouble(line[3]),
vertices.get(line[4]), vertices.get(line[5])));
break;
default:
System.err.println("Wrong number of arguments for arc "
+ line[0]);
}
}
} catch (Exception e) {
System.err.println("Error at line " + linen);
}
linen++;
}
scanner.close();
}
writer.println("param:\td\tc\t:=");
for (Arc arc : arcs.values())
writer.println(arc.getQuotedName() + " " + arc.getCost() + " "
+ (arc.getCapacity() == Double.POSITIVE_INFINITY ?
"Infinity" : arc.getCapacity()));
writer.println(";\n");
writer.println("param:\tm\t:=");
for (Vertex vertex : vertices.values())
writer.println(vertex.getQuotedName() + " "
+ vertex.getMagnitude());
writer.println(";\n");
writer.close();
try {
writer = new PrintWriter(filename + ".mod");
93
} catch (FileNotFoundException e) {
System.err.println("The file was not found!");
e.printStackTrace();
return;
}
writer.println("set Vertices;");
writer.println("set Arcs;");
writer.close();
}
writer.close();
}
writer.println("}");
writer.close();
}
94
arc.getTarget().getInArcs().remove(arc);
arcs.remove(arc.getName());
}
95
LinkedList<Vertex> removables = new LinkedList<Vertex>();
for (Vertex v : aug.vertices.values())
if (v.isRemovable())
removables.add(v);
while (!removables.isEmpty()) {
Vertex v = removables.poll();
aug.removeVertex(v);
for (Arc arc : v.getInArcs())
if (arc.getSource().isRemovable())
removables.add(arc.getSource());
for (Arc arc : v.getOutArcs())
if (arc.getTarget().isRemovable())
removables.add(arc.getTarget());
}
return aug;
}
TollFinder has the code for finding tolls to make all paths from a given
vertex s to a given vertex t equally expensive. It assumes an acyclic
graph. This code is no longer correct, as I discovered an error in the
theory around this algorithm, but didn’t have time to rewrite the code.
package trafficGraphs;
import java.util.Collection;
import java.util.HashMap;
96
maxd = Math.max(maxd, calculateTolls(wraps.get(a.getTarget()))
+ a.getLength());
for (Arc a : vw.v.getOutArcs())
if (used.contains(a))
a.setToll(maxd - wraps.get(a.getTarget()).distance
- a.getLength());
return vw.distance = maxd;
}
private VertexWrapper(Vertex v) {
this.v = v;
distance = -1;
}
}
findTolls(s, t, used);
for (Arc a : used)
System.out.format(
"%s: Total length: %.0f, of which %.0f is toll.\n",
a.getName(), a.getCost(), a.getToll());
}
}
import java.util.HashSet;
import java.util.Collection;
97
public Collection<Arc> getInArcs() {
return inArcs;
}
WaitArc extends Arc, and represents the arcs that are actually just wait-
ing at the same vertex some one time step.
package trafficGraphs;
98
References
[1] Alexander Schrijver A course in combinatorial optimization 2007
[4] Bruce Edward Hoppe Efficient dynamic network flow algorithms Ph.
D. Cornell University 1995
99