Routing and Timetabling by Topological Search

Alexander Schrijver

Abstract. We discuss how decomposing the search space into homotopy classes can help in finding solutions to combinatorial optimization problems. Searching any homotopy class then amounts to finding a group function ψ on the arcs of a directed graph such that ψ is cohomologous to a given function ϕ and such that ψ has values in a prescribed range.

We describe applications to two specific classes of NP-complete problems: routing wires on a chip (where the main tool is solving the cohomology problem in a free group, and a main result the polynomial-time solvability of the wire-routing problem for any fixed number of modules), and finding a periodic timetable (applied to the Dutch railway timetable, where liftings of the period group C_{60} to the integers give the classes to be searched).

The methods also imply a characterization of the existence of an isotopy of a compact surface S that brings a given set of disjoint closed curve on S to a given undirected graph embedded on S.

1991 Mathematics Subject Classification: 05C85, 05C90, 90B06, 90B10, 90B35 Keywords and Phrases: homotopy, disjoint paths, routing, timetabling, closed curves, compact surface

1. Introduction

A basic technique in combinatorial optimization, and more generally, in integer programming, is to extend (‘relax’) the feasible solution set X ⊆ Z^{k} to conv.hull(X) ⊆ R^{k}, and to use the solution of the relaxed problem as a guideline in an approximative method or in a branch and bound process. This is based on the hope that a fractional solution is close to the integer solution, and on the idea that the relaxed problem can be solved fast with linear programming techniques.

Mathematically, the idea can be described as embedding the group Z^{k} into the group R^{k}, where Z^{k} is a ‘hard’ group, while R^{k} is a ‘tractable’ group (as long as the feasible region is convex).

In this survey we describe a different technique of reducing problems on ‘hard’ groups to problems on ‘tractable’ groups. Instead of embedding the hard group into a tractable group, we lift the hard group to a tractable group. We give two examples where this technique can be applied successfully, although it is not as generally applicable as the embedding technique described above. We will not venture upon describing the method in its full generality, but hope that the reader will see that the frameworks we describe have a common underlying structure.

The type of problems where the technique applies can be described as follows. Let D = (V, A) be a directed graph, and let G be a group. Call two functions ϕ, ψ : A → G cohomologous (denoted by ϕ ∼ ψ) if there exists a function p : V → G such that for each arc a = (u, v) one has

ψ(a) = p(u)^{−1}ϕ(a)p(v).  (1)

Consider the following cohomology feasibility problem:

given: ϕ : A → G and Ψ : A → 2^{G},

find: ψ ∼ ϕ such that ψ(a) ∈ Ψ(a) for each a ∈ A.

(2)

This problem is in general hard to solve, even if G = C_{3}. Then, if ϕ(a) := 1 and Ψ(a) := G \ {1} for a ∈ A (assuming that G is the multiplicative group with three elements), the cohomology feasibility problem has a solution if and only if the directed graph D is 3-vertex-colourable. As the latter problem is NP-complete, the cohomology feasibility problem is NP-complete.

On the other hand, there are groups where the cohomology feasibility problem is solvable in polynomial time, provided that the sets Ψ(a) each are convex in a certain sense. For instance, if G = R^{k} and each Ψ(a) is convex, the cohomology feasibility problem can be solved in polynomial time by linear programming methods (assuming that the Ψ(a) are appropriately described).

Another tractable group is the group Z of integers, where each Ψ(a) is a convex subset of Z. The cohomology feasibility problem then can be solved with a variant of the Bellman-Ford method for finding shortest paths.

As an extension of this, we have shown in [6] that if G is a free group, and each Ψ(a) is hereditary (closed under taking contiguous subwords), then again the cohomology feasibility problem is solvable in polynomial time. This holds more generally for free partially commutative groups, if the subsets Ψ(a) are convex in a certain sense — see Section 3 ([7]).

We give two applications in which the cohomology feasibility problem with a hard group shows up (Z^{k}, C_{60}), and show how a lifting to a tractable group (the free group, Z) can help in solving the problem. (In fact, Z^{k} is a special case of a free partially commutative group; however, the subsets in the application are not of the prescribed type.)

2. Disjoint paths in directed planar graphs

The first application is that of routing the wires on a very large-scale integrated (VLSI) circuit (a chip). If we restrict ourselves to one layer, the following k disjoint paths problem emerges:

given: a planar directed graph D = (V, E), and distinct vertices s_{1}, t_{1}, …, s_{k}, t_{k} of D; find: pairwise disjoint directed paths P_{1}, …, P_{k}, where P_{i} runs from s_{i} to t_{i} (i = 1, …, k).

For general directed graphs, this problem is NP-complete even when fixing k = 2 (Fortune, Hopcroft, and Wyllie [1]). This is in contrast with the undirected case (for those believing NP≠P), where Robertson and Seymour [4] showed that, for any fixed k, the k disjoint paths problem is solvable in polynomial time for any undirected graph (not necessarily planar).

Also, for directed planar graphs, the k disjoint paths problem is NP-complete if we do not fix k (Lynch [2]). However, in [6] it is shown that for fixed k and for directed planar graphs, it is solvable in polynomial time. We sketch the method.

For each i = 1, …, k, choose a simple curve C_{i} in R^{2} connecting s_{i} and t_{i}, in such a way that the C_{i} are pairwise disjoint. Now the following k disjoint homotopic paths problem is solvable in polynomial time:

given: pairwise disjoint simple curves C_{1}, …, C_{k}, where C_{i} connects vertices s_{i} and t_{i} of D (i = 1, …, k); find: pairwise disjoint directed paths P_{1}, …, P_{k} in D, such that P_{i} is homotopic to C_{i} in the space R^{2} \ {s_{1}, t_{1}, …, s_{k}, t_{k}}.

The curves C_{i} can be described equivalently by a flow ϕ : A → FG_{k}, where FG_{k} denotes the free group with k generators g_{1}, …, g_{k}. Thus at any vertex v ∉ {s_{1}, t_{1}, …, s_{k}, t_{k}}, the flow conservation law should hold; that is, if a_{1}, …, a_{n} are the arcs of D incident with v in clockwise order, then the product

ϕ(a_{1})^{sign(a_{1},v)} · . . . · ϕ(a_{n}) ^{sign(a_{n},v)}

equals 1, where sign(a, v) = +1 if a enters v and sign(a, v) = −1 if a leaves v. If v = s_{i}, the product should be a conjugate of g_{i}^{−1}, and if v = t_{i}, a conjugate of g_{i}.

Let us call a flow ϕ : A → FG_{k} feasible if for each arc a: ϕ(a) ∈ {1, g_{1}, …, g_{k}}, and for each vertex v and for each two faces f and g incident with v, if a_{1}, …, a_{m} are the arcs incident with v met when going from f to g around v in clockwise order, then

ϕ(a_{1})^{sign(a_{1},v)} · . . . · ϕ(a_{m}) ^{sign(a_{m},v)}

belongs to {1, g_{1}, g_{1}^{−1}, …, g_{k}, g_{k}^{−1}}.

So feasible flows correspond to solutions to the original k disjoint paths problem. Now given a flow ϕ : A → FG_{k}, we can find in polynomial time a feasible flow ψ : A → FG_{k} homotopic to ϕ, if it exists. Here ϕ and ψ are called homotopic if there exists a function p : F → FG_{k} such that for each arc a of D, if f and f′ denote the faces incident with a at its left-hand and right-hand side, respectively, then ψ(a) = p(f)^{−1}ϕ(a)p(f′). (Here F denotes the collection of faces of D.)

This follows from the polynomial-time solvability of the cohomology feasibility problem for free groups, with each Ψ(a) hereditary. Indeed, by passing from the graph D to its (planar) dual graph D^{∗}, the problem of finding a feasible flow homotopic to a given flow, is transformed to the cohomology feasibility problem.

The polynomial-time solvability of the k disjoint homotopic paths problem implies that for fixed k, the k disjoint paths problem in directed planar graphs is polynomial-time solvable: it can be shown that one can enumerate in polynomial time (for fixed k) flows ϕ_{1}, …, ϕ_{N} : A → FG_{k} with the property that each feasible flow is homotopic to at least one of ϕ_{1}, …, ϕ_{N}. (The exponent of the polynomial depends on k.) This is the proof method for:

Theorem 1. For each fixed k, the k disjoint paths problem in directed planar graphs can be solved in polynomial time.

Note that the k disjoint paths problem asks for any flow; that is, one not restricted by its homotopy class. In other words, we ask for a feasible flow ϕ : A → Z^{k}. (So the generators may commute; this corresponds to the possibility that curves may be shifted over each other.) Not fixing k, this is an NP-complete problem. By lifting Z^{k} to FG_{k}, we restrict the solution set, and obtain a polynomial-time solvable problem (also polynomial-time for nonfixed k). As the number of liftings can be bounded by a polynomial for fixed k, we can solve the original problem for fixed k in polynomial time. (In fact, generally there are infinitely many liftings, but only a restricted number of them potentially gives a feasible solution.)

3. Free partially commutative groups

The algorithm for solving the cohomology feasibility problem for free partially commutative groups (with convex sets Ψ(a)) implies a necessary and sufficient condition for the existence of a solution ψ, which we describe now.

There is an obvious necessary condition for the existence of such a function ψ. Let us denote a path P in D as a word a_{1} ⋯ a_{t} over the alphabet {a, a^{−1}|a ∈ A}. In this way we indicate that P traverses the arcs a_{1}, …, a_{t} in this order, where a_{i} = a^{−1} means that arc a is traversed in backward direction. A v − w path is a path starting in v and ending in w.

Define ϕ(a^{−1}) := ϕ(a)^{−1} and Ψ(a^{−1}) := Ψ(a)^{−1}. For any path P = a_{1} ⋯ a_{t} define ϕ(P) := ϕ(a_{1}) ⋯ ϕ(a_{t}) ∈ G and Ψ(P) := Ψ(a_{1}) ⋯ Ψ(a_{t}) ⊆ G.

A necessary condition for the existence of ψ in the cohomology feasibility problem (2) is:

for each v ∈ V and each v − v path P there exists an x ∈ G such that x^{−1}ϕ(P)x ∈ Ψ(P).

(3)

Indeed, we can take x = p(v) where p is as in (1).

In some cases this condition is sufficient as well, for instance, if G is the infinite group with one generator g and each Ψ(a) is convex (that is, if g^{i}, g^{j} ∈ Ψ(a) then also g^{k} ∈ Ψ(a) whenever k is inbetween i and j).

However, this condition generally is not sufficient. A stronger necessary condition is:

for each v ∈ V and each two v − v paths P_{1}, P_{2} there exists an x ∈ G such that x^{−1}ϕ(P_{1})x ∈ Ψ(P_{1}) and x^{−1}ϕ(P_{2})x ∈ Ψ(P_{2}),

(4)

since again we can take x = p(v).

Now for free partially commutative groups, condition (4) is also sufficient, for certain subsets Ψ(a). A free partially commutative group is constructed as follows. Let g_{1}, …, g_{k} be generators, and let E be a collection of pairs {i, j} with i, j ∈ {1, …, k} and i ≠ j. Then the group G = G_{k,E} is the group generated by g_{1}, …, g_{k} with relations g_{i}g_{j} = g_{j}g_{i} for each {i, j} ∈ E. So if E = ∅ then G_{k,E} is the free group generated by g_{1}, …, g_{k}, while if E consists of all pairs from {1, …, k} then G_{k,E} is isomorphic to Z^{k}.

There is the following direct reduction rule for words over the ‘symbols’ g_{1}, g_{1}^{−1}, …, g_{k}, g_{k}^{−1}: if symbol α commutes with each symbol occurring in word y, then xαyα^{−1}z = xyz. It can be shown that repeating this reduction as long as possible starting with a word w, one reaches the empty word 1 if w equals 1 in the group. So the word problem can be solved easily (cf. Wrathall [10]).

Applying this reduction to a general word w, one obtains a shortest possible word w′ (shortest among all words w′′ that are equal to w in the group). The length of w′ is denoted by |w|. This defines a ‘norm’ on G_{k,E}, satisfying |1| = 0, |u^{−1}| = |u| and |uw| ≤ |u| + |w|. So we can define a distance function dist on G by:

dist(x, y) := |x^{−1}y|

for x, y ∈ G. For x, y ∈ G let [x, y] be the set of all z ∈ G satisfying dist(x, z) + dist(z, y) = dist(x, y). Call a subset H of G convex if 1 ∈ H, [x, y] ⊆ H for all x, y ∈ H, [x, y] ⊆ H^{−1} for all x, y ∈ H^{−1}.

Note that if G is the free group then H ⊆ G is convex if and only if H ≠ ∅ and H is hereditary.

In [7] the following theorem is proved.

Theorem 2. Let G be a free partially commutative group and let each Ψ(a) be convex. Then the cohomology feasibility problem (2) has a solution ψ if and only if condition (4) is satisfied.

The proof is based on a polynomial-time algorithm giving either the function ψ or a pair of paths P_{1}, P_{2} violating (4). Therefore we also have:

Theorem 3. The cohomology feasibility problem (2) is solvable in polynomial time if G is a free partially commutative group and each Ψ(a) is convex.

We assume here that membership of Ψ(a) of a given word can be checked in polynomial time.

4. Disjoint closed curves in graphs on a compact surface

We describe a consequence of Theorem 2. Let S be a compact surface. A closed curve on S is a continuous function C : S^{1} → S, where S^{1} is the unit circle in C. Two closed curves C and C′ are called freely homotopic, in notation C ∼ C′, if there exists a continuous function Φ : S^{1} × [0, 1] → S such that Φ(z, 0) = C(z) and Φ(z, 1) = C′(z) for each z ∈ S^{1}.

For any pair of closed curves C, D on S, let cr(C, D) denote the number of crossings of C and D, counting multiplicities. Moreover, mincr(C, D) denotes the minimum of cr(C′, D′) where C′ and D′ range over closed curves freely homotopic to C and D, respectively. That is,

mincr(C, D) := min{cr(C′, D′)|C′ ∼ C, D′ ∼ D}.

Let G = (V, E) be an undirected graph embedded on S. (We identify G with its embedding on S.) For any closed curve D on S, cr(G, D) denotes the number of intersections of G and D (counting multiplicities):

cr(G, D) := |{z ∈ S^{1}|D(z) ∈ G}|.

The following was shown in Schrijver [5] (motivated by Robertson and Seymour [3]) — it can also be derived (with surface duality) from Theorem 2.

Theorem 4. Let G = (V, E) be an undirected graph embedded on a compact surface S and let C_{1}, …, C_{k} be pairwise disjoint simple closed curves on S, each nonnullhomotopic. Then there exist pairwise vertex-disjoint simple circuits C′_{1}, …, C′_{k} in G such that C′_{i} ∼ C_{i} (i = 1, …, k), if and only if for each closed curve D on S:

cr(G, D) ≥ ∑_{i=1}^{k} mincr(C_{i}, D),

with strict inequality if D is doubly odd.

Here we call a closed curve D on S doubly odd (with respect to G and C_{1}, …, C_{k}) if D is the concatenation D_{1} · D_{2} of two closed curves D_{1} and D_{2} such that D_{1}(1) = D_{2}(1) ∉ G and such that

cr(G, D_{j}) ≢ ∑_{i=1}^{k} cr(C_{i}, D_{j}) (mod 2),

for j = 1, 2.

The essence of the theorem is sufficiency of the condition.

The theorem can be extended to directed circuits in directed graphs embedded on a compact orientable surface, although the condition becomes more difficult to describe. (For the torus, see Seymour [9].) In any case, the method yields a polynomial-time algorithm finding the directed circuits.

5. Periodic timetabling

The cohomology feasibility problem also shows up in the problem of making the timetable for Nederlandse Spoorwegen (Dutch Railways), a project currently performed for NS by CWI (with Adri Steenbeek). The Dutch railway system belongs to the busiest in the world, with several short distance trajectories, while many connections are offered, with short transfer time.

Task is to provide algorithmic means to decide if a given set of conditions on the timetable can be satisfied. In particular, the hourly pattern of the timetable is considered. The basis of the NS-timetable is a periodic cycle of 60 minutes.

How can this problem be modeled? First of all, each departure time to be determined is represented by a variable v_{t}. Here t is a train leg that should go every hour once. So v_{t} represents a variable in the cyclic group C_{60}. Similarly, the arrival time of leg t is represented by a variable a_{t} in C_{60}.

In the problem considered, a fixed running time is assumed for each leg. This implies that if train leg t has a running time of, say, 11 minutes, then a_{t} − v_{t} = 11. The waiting period of a train at a station is prescribed by an interval. E.g., if t and t′ are two consecutive train legs of one hourly train, and if it is required that the train stops at the intermediate station for a period of at least 2 and at most 5 minutes, then one poses the condition that v_{t′} − a_{t} ∈ [2, 5] (as interval of C_{60}).

This gives relations between train legs of one hourly train. To make connections, one has to consider train legs of two different trains. So if one wants to make a connection from leg t, arriving in Utrecht say, of one train, to a leg t′ departing from Utrecht of another train, so that the transfer time is at least 3 and at most 7 minutes, then one gets the condition that v_{t′} − a_{t} ∈ [3, 7].

Finally, there is the condition that for safety each two trains on the same trajectory should have a timetable distance of at least 3 minutes. That is, if train leg t of one train and train leg t′ of another train run on the same railway section, then one should pose the condition v_{t′} − v_{t} ∈ [3, 57].

By representing each variable by a vertex, the problem can be modeled as follows. Let D = (V, A) be a directed graph, and for each a ∈ A, let Ψ(a) be an interval on C_{60}. Find a function p : V → C_{60} such that p(w) − p(u) ∈ Ψ(a) for each arc a = (u, w) of D.

This is a special case of the cohomology feasibility problem. Note that (as C_{60} is abelian) one may equivalently find a ‘length’ function l : A → C_{60} such that l(a) ∈ Ψ(a) for each a ∈ A and such that each undirected circuit in D has length 0. (For arcs a in the circuit traversed backward one takes −l(a) for its length.)

It is not difficult to formulate this problem as an integer linear programming problem. Indeed, if for any arc a = (u, w), Ψ(a) is equal to the interval [l_{a}, u_{a}], we can put:

l_{a} ≤ x_{w} − x_{u} + 60y_{a} ≤ u_{a},  (5)

where y_{a} is required to be an integer. Thus we get a system of |A| linear inequalities with |V | real variables x_{v} and |A| integer variables y_{a}. In fact, if there is a solution, there is also one with the x_{v} being integer as well (as the x variables make a network matrix).

Now in solving (5), one may choose a spanning tree T in D, and assume that y_{a} = 0 for each arc a in T (cf. Serafini and Ukovich [8]). Alternatively, one may consider the problem as follows.

A circulation is a function f : A → R such that the ‘flow conservation law’:

∑_{a∈δ^{−}(v)} f(a) = ∑_{a∈δ^{+}(v)} f(a)

holds for each vertex v of D. Here δ^{−}(v) and δ^{+}(v) denote the sets of arcs entering v and leaving v, respectively.

Let L be the lattice of all integer-valued circulations. Now one can describe the problem as one of finding a linear function Φ : L → Z such that there exist z_{a} (for a ∈ A) with the properties that l_{a} ≤ z_{a} ≤ u_{a} for each arc A and z^{T} f = 60Φ(f) for each f ∈ L.

The existence of such z_{a} can be checked in polynomial time, given the values of Φ on a basis of L. Indeed, for a ∈ T let y_{a} = 0, and for a ∉ T let y_{a} = ϕ(f), where f is the incidence vector of the circuit in T ∪ {a} (so f is a circulation: f(a′) = 1 on forward arcs a′ in the circuit, f(a′) = −1 on backward arcs a′ in the circuit, and f(a′) = 0 on each other arc a′). Then for this fixed y we can test (5) in polynomial time (with the Bellman-Ford method), which is equivalent to finding z as required.

Hence, in searching a feasible timetable one can branch on choices of Φ. Each Φ corresponds to a homotopy class of solutions of the timetable problem.

Again, this amounts to a lifting, now from C_{60} to Z. Indeed, we consider for each arc a ∉ T a translation by 60y_{a} of the feasible interval, considered as interval on Z, and try to solve the problem over Z.

We also note that, given Φ, if there exist z_{a}, one can optimize the z_{a} under any linear (or convex piecewise linear) objective function (for instance, passenger waiting time).

Typically, the problems coming from NS have about 3000 variables with about 10,000 constraints. In a straightforward way they can be reduced to about 200 variables with about 600 constraints. The above observations turn out to require a too heavy framework in order to solve the problem fast in practice (although they are of help in optimizing a given solution).

The package CADANS that CWI is developing for NS for solving the problem above, is based on a fast constraint propagation technique and fast branching heuristics designed by Adri Steenbeek. It gives, in a running time of the order of 1-10 minutes either a solution (i.e., a feasible timetable), or an inclusionwise minimal set of constraints that is infeasible. If CADANS gives the latter answer, the user should drop, or relax, at least one of the constraints in the minimal set in order to make the constraints feasible. Thus CADANS can be used interactively to support the planner. Alternatively, it can uncover bottlenecks in the infrastructure, and indicate where extra infrastructure (viaducts, flyovers, four-tracks) should be built in order to make a given set of conditions feasible.

References

[1] S. Fortune, J. Hopcroft, J. Wyllie, The directed subgraph homeomorphism problem, Theoretical Computer Science 10 (1980) 111–121.

[2] J.F. Lynch, The equivalence of theorem proving and the interconnection problem, (ACM) SIGDA Newsletter 5 (1975) 3:31–36.

[3] N. Robertson, P.D. Seymour, Graph minors. VII. Disjoint paths on a surface, Journal of Combinatorial Theory, Series B 45 (1988) 212–254.

[4] N. Robertson, P.D. Seymour, Graph minors. XIII. The disjoint paths problem, Journal of Combinatorial Theory, Series B 63 (1995) 65–110.

Routing and Timetabling by Topological Search 695

[5] A. Schrijver, Disjoint circuits of prescribed homotopies in a graph on a compact surface, Journal of Combinatorial Theory, Series B 51 (1991) 127–159.

[6] A. Schrijver, Finding k disjoint paths in a directed planar graph, SIAM Journal on Computing 23 (1994) 780–788.

[7] A. Schrijver, Free partially commutative groups, cohomology, and paths and circuits in directed graphs on surfaces, preprint, 1994.

[8] P. Serafini, W. Ukovich, A mathematical model for periodic scheduling problems, SIAM Journal on Discrete Mathematics 2 (1989) 550–581.

[9] P.D. Seymour, Directed circuits on a torus, Combinatorica 11 (1991) 261–273.

[10] C. Wrathall, The word problem for free partially commutative groups, Journal of Symbolic Computation 6 (1988) 99–104.

CWI, Kruislaan 413, 1098 SJ Amsterdam, The Netherlands and Department of Mathematics, University of Amsterdam, Plantage Muidergracht 24, 1018 TV Amsterdam, The Netherlands.

696

Documenta Mathematica · Extra Volume ICM 1998 · III ·