On Solvability of an OSPF Routing Problem
Ericsson Traffic Laboratory, Budapest, Hungary
Department of Communication Systems, Lund Institute of Technology, Sweden
address:Alpar Jüttner, Ericsson Traffic Laboratory, Budapest, P.O.B 107, H-1300, Hungary,
This concise paper deals with a basic routing optimisation problem associated with the Open
Shortest Path First (OSPF) protocol. With OSPF, all the packets arriving at a node and
destined to some other node are directed along the shortest paths between the nodes,
regardless of the packets originating nodes. The shortest paths to destinations are identified
at the network nodes on the basis of the fixed links weight system. The main purpose of the
paper is to present a proof that a flow allocation problem corresponding to the OSPF routing
is NP-complete. This suggest that one has to use heuristic methods for solving the problem.
In the paper we also give a short survey of such methods.
IP traffic routing, OSPF, flow networks, flow allocation problems, NP-completeness
The paper deals with a basic routing optimisation problem associated with the Open Shortest
Path First (OSPF) protocol. The OSPF packet routing protocol  is one of the most
commonly used Interior Gateway Protocols in todays IP networks. The OSPF packet routing
rule, called the ECMP (Equal-Cost Multipath) rule, is essentially as follows: all the packets
arriving at node t and destined for node u are directed along the shortest paths from t to u,
regardless of the packets originating nodes. If there are more than one links outgoing from
node t and belonging to the shortest paths from t to u, then the packets are distributed evenly
among these links. The shortest paths to destinations are identified at the network nodes on
the basis of the links weight system w: each link e is assigned a positive number w
and each node is aware of the weights w=(w
) of all links.
The main question dealt with in the paper is the existence of a feasible OSPF link weight
system for a given demands matrix and links capacities. In other words, we ask whether
there exists a system of weights that generates flows realising the demands such that the
resulting links loads do not ex ceed the given links capacities. We consider the following
OSPF Flow Allocation Problem (FAP).
j=0,1,...,m(d) paths for flows realising demand d
volume of demand d to be realised
= 1 if link e belongs to path j realising demand d, 0 otherwise
capacity of link e
weight of link e (positive continuous variable), w = (w
(w) denotes the flow realising demand d on path j, implied by the links weight
system w. For a given weight system w, the flows x
(w) are computed according to the ECMP
rule. The rule is illustrated in Figure 1: the shortest paths s-a-c-t and s-a-d-t realise 0.25 of the
total demand volume between nodes s and t, whilst the
shortest path s-b-e-t realises the remaining 0.5 of the
volume. Note that the flow functions x
(w) are not given
explicitly. In order to make the ECMP flow splitting
procedure consistent, OSPF assumes that the link weights
are positive, so there can be no loops in the shortest paths.
Consequently, constraints (1) in FAP guarantee that all of
the demands are realised, and constraints (2) - that links
loads do not exceed their capacities.
The main result of the paper, presented in Section 2, is an
original, simple proof showing that the above formulated OSPF flow allocation problem is
NP-complete . It should be emphasised here that a certain NP-completeness result for an
uncapacitated counterpart of FAP (in which links capacities are not strictly fixed - they are
taken into account through the use of penalty functions) has been announced in .
Because of the NP-completeness of FAP one is forced to use heuristic methods for solving
the problem. In Section 3 we give a survey of such methods. In particular we discuss a
promising two-phase approach [4,5] in which in, Phase 1, the demands are allocated to single
paths and then, in Phase 2, we try to find a corresponding weight system w generating the set
of single demand allocation paths obtained in Phase 1 (this means that the paths found in
Phase 1 must be the unique shortest paths with respect to the weight system w). For Phase 1
we use an approach based on a meta-heuristic called Simulated Allocation . The paths
obtained in Phase 1 satisfy the necessary shortest paths uniqueness condition which requires
that if two paths meet at a certain node, they should share a common sequence of links until
they split for good. This condition is rather powerful and in most cases is also sufficient
(cf.[7,8]). For Phase 2 we use Linear Programming, as proposed in [7,8,4]. Concluding
remarks are given in Section 4.
2. The NP-completeness result
Below we shall demonstrate that FAP is an NP-complete problem. To do this we shall show
that the so called X3C Problem (Exact Cover by 3-Sets) ([SP2], p.221 in ) can be
transformed to (a simplified version of) FAP. X3C is known to be NP-complete and is as
} of p=3q elements (
=p) and a family C of n 3-subsets of X
=3, i=1,2,...,n), n
does C contain a subfamily C
C, of q (
=q) pair-wise disjoint subsets of X?
Consider the directed single-commodity flow graph depicted in Figure 2. Vertex s is the
source, vertex t is the sink. The vertices in the upper row correspond to the 3-sets of family
C, whilst the vertices in the lower row correspond to the elements of set X. The edges between
the two rows reflect the incidence relation between family C and set X: vertex C
to vertex x
if, and only if, x
(in the considered example C
}). In the sequel we shall assume that X
C, i.e. that family C covers set X
(otherwise the X3C problem is trivial).
It is easy to see that for the particular edges capacity values assumed in the considered
graph, the value of the maximal flow from s to t is equal to q+1. To see this we first note that
the flow cannot be greater than q+1, since no more flow than q+1 can be received by the sink.
On the other hand, we can saturate all the edges incoming to vertex u and hence achieve the
maximal flow. To do this, for each element of X we select one 3-subset from C that contains
the considered element and assign flow 1/3 to the corresponding edge. This operation
determines how much flow must be assigned to each edge from the source to the first row of
vertices. The maximal flow from s to t can be easily found in the described way in polynomial
Now let us constraint the admissible flows in the considered graph to the so called equal-
split flows (ES-flows). A flow f is an ES-flow if for each vertex v the flows assigned to the
edges outgoing from v are either equal to 0 or to some fixed, vertex-dependent positive value.
In other words, for any fixed vertex v and each edge of the form (v,w), there exists a number
z(v) such that f(v,w)=0 or f(v,w)=z(v). The basic observation leading to our NP-completeness
result is that the answer to the question in X3C is positive if and only if the maximal ES-flow
in the considered graph is equal to q+1.
Suppose the subfamily C
} exactly covers set X. We assign flow equal
1 to all edges (s,C
) for j=1,2,...,q (i.e. f(s,C
)=1, j=1,2,...,q), and flow equal 0 to the rest of
the edges of the form (s,C
). This assignment will force f(x
,u)=1/3 for k=1,2,...,p. Finally,
assigning f(s,t)=1 we arrive at an ES-flow with value q+1. Conversely, if the maximal ES-flow
is equal to q+1 then, due to the equal-split assumption, this can be achieved only in one way:
flow equal to 1 is assigned to edge ( s,t) and to exactly q out of p edges of the form (s,C
f(s,t)<1 the flow value q+1 could not be achieved because of the capacity q assigned to link
(u,t)). Note that this is the reason why edge ( s,t) is necessary: without it, it would be possible,
as illustrated in Figure 3, to find an ES-flow with value q even if there would be no exact 3-
cover.) The only possible way to maintain flow of value q down in the main part of the graph
(i.e. the left part, without edge (s,t)) is to saturate all edges incoming to vertex u. This implies
that the vertices C
)=1 define the family C
exactly covering set X.
Thus, we have proved our observation: the answer to the X3C question is positive if and
only if the maximal ES-flow is equal to q+1. Hence, if we were able to find an ES-flow equal
to q+1, or show that such a flow does not exist, in polynomial time, then we would give an
answer to the X3C question in polynomial time. This proves that the following ES-flow
integers p, q, n such that p=3q and n
q, and a graph of the structure depicted in Figure 1
does there exist an ES-flow of value q+1?
Note that any instance of ESF can be solved by solving a corresponding instance of FAP.
Such instances of FAP have only one demand d=1 (between s and t) with volume h
q+1, and the path structure and links capacities specified by the graph in Figure 1. The task
is to find a links (edges) weight system that combined with the ECMP rule defines an ES-
flow f answering the question in ESF. Of course, every ES-flow in the considered graph can
be generated by the weight system defined by assigning weights w=1 to all edges with positive
flows in the main part of the graph(these flows are either 1, 1/3 or q), weight w=4 to edge (s,t),
and weights w=
to all other edges.
Thus any algorithm solving FAP, solves also ESF, and hence X3C. This proves that FAP
3. Heuristic methods for solving FAP
As AP is an NP-complete problem., one cannot expect inventing any exact effective solution
methods for the networks of practical size, and is forced to use heuristics. Since the OSPF
routing problem is rather new, not many solution methods have been proposed so far. Below
we characterise some approaches to FAP known from the literature.
One such method, described in , has been devised for a version of FAP using a penalty
function instead of constraints (2). This means that instead of (2) an objective function is
minimise C(w) =
) is a link-dependent (more precisely, depending on the link capacity) piecewise-
linear convex function, with the link load as the argument. The method is a specialised version
of Local Search. Starting from random weights, the neighbourhood search is performed using
two basic operations (i) an arbitrary change of a single weight and (ii) a special weight change
that distributes the flows more evenly in the network. The tabu list used for avoiding cycles
in the local search is implemented with hashing tables in order to improve performance.
Numerical results for real-word and randomly generated network configurations show that
optimisation can improve network throughput by 50% to 110% compared to conventional
weight setting heuristics, in some cases even approaching the theoretical optimum. The
running times are within the range of one hour even for the largest problem instances tested.
Two other methods, one based on Local Search (called WA - Weights Adjustment) and
the other based on Simulated Annealing (called SAN) are discussed in . Both methods,
similarly to  scan the weight systems space, trying to find a feasible solution to the pure
allocation task (1)-(2).
WA starts with a random weight system and computes the flows and the resulting link
loads according to the ECMP rule. Next, the weights of the underloaded links are decreased
and the weights of the overloaded links increased, and the procedure is repeated. The weights
adjustments are performed according to certain simple rules which help avoiding cycling.
SAN also starts with a random system of (integer) weights. In one step it selects a link at
random and decrements or increments its weight by 1 (this choice is also random). Next the
algorithm computes the link loads according to the ECMP rule and accepts or rejects the new
solution using the standard Metropolis test of Simulated Annealing. Then the procedure is
repeated. The cost function used for the test depends on links overload values. In  it is
reported that for the considered examples both methods give similar near-optimal solutions,
still SAN requires much longer time.
A somewhat different approach is described in . Instead of using the links weights as
optimisation variables and solving AP directly, one can first route the demands on single
paths, hoping that the resulting set of paths is realisable with some OSPF system of weights.
The approach is called a Two-Phase Approach (TPA) and its two phases are follows.
Solve the following problem (indices and constants are as in AP of Section 2):
binary variables forcing the single-path flow of demand d
= 1 d=1,2,...,D (4)
Find a system of positive link weights w according to which the unique demand
paths resulting from Phase 1 are also unique shortest paths according to w (this is the so called
Unique Inverse Shortest Path problem, UISP, cf.).
Phase 2 can be solved with Linear Programming, as discussed in [7,8,4]. Phase 1 is more
troublesome. The problem in Phase 1 is a Mixed Linear-Integer Programming (MIP) problem
and as such can in principle be solved by means of e.g. CPLEX or other MIP solvers.
However, exact methods for MIPs (i.e. branch-and-bound and the cutting-plane method) are
exponential and usually fail for large networks because of excessive time and memory
requirements. In such cases available heuristic methods can be considered; still there is one
fundamental difficulty: it is likely that a solution obtained in Phase 1 will not be feasible from
the Phase 2 viewpoint.
In order to increase the chance of obtaining a feasible set of single paths, we have devised
an application of the Simulated Allocation meta-heuristic, called SAL+, described in .
In SAL+ any set of currently used paths fulfils a simple necessary uniqueness condition
illustrated in Figure 4. The condition (cf.[7,8]) requires that if two paths meet at a certain
node, they must continue their way along a common sequence of links until they split for good
(in Figure 4.1 the paths a-c-e-g and b-c-d-f on the left side satisfy this condition, whilst the
paths a-c-e-g and b-c-d-e-f to the right do not). The condition is known to be rather powerful
(cf.[7,8]). Note that for undirected graphs it is easy to
check the condition for a given pair of paths: if the paths
are not disjoint, the number of common nodes must be
exactly equal to the number of common links plus 1.
As reported in , for reasonably dimensioned
networks SAL+ performs very well. It is able to find the
feasible solutions to AP almost always and in a short
time, even for the large (above 50 nodes networks). In
some (rare) cases the solutions yielded by SAL+ are not
feasible from the UISP problem of Phase 2 viewpoint.
For such cases certain paths adjustment heuristics can
be applied for identifying a minimum set of paths P with the property that after deleting the
set P the rest of the paths are feasible. Then new paths corresponding to the demands realised
by the paths from P can reallocated in a feasible way.
1.OSPF Version 2, RFC2328 (www.ieft.org/rfc/rfc2328.txt), 1998
2.Garey, M.R., Johnson, D.S.: Computers and Intractability - A Guide to the Theory of NP-
Completness, W.H.Freeman and Company, 1979
3.Fortz, B., Thorup, M.: Internet Traffic Engineering by Optimizing OSPF Weights, INFO-
COM 2000, Tel-Aviv, May 2000
4.Pióro, M., Szentesi, Á., Harmatos, J., Jüttner, A., Gajowniczek, P., Kozdrowski, S.: On
OSPF Related Network Optimisation Problems, IFIP ATM IP 2000, Ilkley, July 2000
5.Gajowniczek, P., Pióro, M., Szentesi, Á., Harmatos, J.: Solving an OSPF Routing Problem
with Simulated Allocation, 1
Polish-German Teletraffic Symposium PGTS 2000,
Dresden, September 2000
6.Pióro, M.: Simulation Approach to the Optimisation of Multicommodity Integral Flow
Networks, Proc. International Conference on Optimization and Simulation, Singapore,
7.Faragó, A., Szviatovszki, B., Szentesi, Á.: Allocation of Administrative Weights in PNNI,
Networks'98, Sorrento, 1998
8.Ameur, W. Ben., Gourdin, E., Liau, B.: Dimensioning of Internet Networks, DRCN 2000,
Munich, April 2000.