* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Spanning tree manipulation and the travelling salesman
Survey
Document related concepts
Transcript
Spanning tree manipulation and the travelling salesman problem
By Alex K. Obruca*
The reasonable assumption is made that the majority of lines appearing in a minimal spanning
tree for any network also appear in an optimal solution to the corresponding travelling salesman
problem. A technique is described of manipulating the tree, by means of deletions and additions
of lines, into a chain and hence obtain a feasible solution. An extension is considered with regard
to the minimal wiring problem.
Manipulation of Tm
Consider a network N and any Tm on it. We see that
the cost of Tm will form a lower bound on the optimal
solution to the problem. From the examination of a
large number of networks, the corresponding minimal
spanning trees and optimal solutions the author felt that
the following assumption was reasonable. Suppose we
assume that a large number of lines in Tm also appear
in an optimal solution and in all probability these will
be those lines in Tm which are not members of stars. We
can thus try to manipulate Tm into a chain (and hence
obtain a feasible solution) by deleting lines within stars
(till they cease to become stars) and adding others (in
order to keep the subgraph connected). There is a
wide choice in the order of deletions and the variety of
choices will define all the feasible solutions in the set S.
Suppose we construct Tm and root it at some point.
We can, without loss of generality planarize Tm in order
to facilitate representation and manipulation within a
computer. Having done this we can define an ordering
on the points of Tm. Let us thus examine, within the
specified ordering, each of the points in turn, till we
reach a star. We now delete one of the lines in the star.
This will disconnect Tm into two subtrees. We can
rejoin them by the addition of another line from the
cotree to form a new tree Tc. The above process can be
repeated on Tc to form another Tc. We can thus obtain
a sequence of Tc. In order that the sequence should
converge to a chain, it is necessary to stipulate that the
choice of line to add should be from those which connect
end points of the two subtrees: the choice being the one
with least cost. This ensures that each new Tc has had
one of its stars reduced by one line.
We see that the set S1 is obtained by variations in the
following:
(1) choice of point to root in Tm,
(2) choice in the ordering of the points in Tc, and
(3) choice in the ordering of the deletions within any
star.
(1) and (2) are in fact the two computational choices
resulting from the theoretical one of the ordering of the
stars.
In order to illustrate the idea let us work through a
Definitions
Let us define a network, N, (of n points and m lines) to
be a graph with costs/distances to be associated with each
line. A tree, T, is defined as a connected graph of p
points and (/? — 1) lines. A rooted tree is one which
has had one of its points designated as the root point.
A planar tree is one which has been embedded in a plane.
The definition for a planar rooted tree follows as a consequence. A spanning tree Ts for a graph is one which
covers the graph (i.e. consists of every point of the
graph): the cotree is defined as consisting of those lines
which do not appear in Ts. We can associate with each
tree Ts of N a cost which will be equal to the sum of the
costs of the lines of Ts. That spanning tree with minimal
cost is called a minimal spanning tree, Tm and is not
necessarily unique. Algorithms for their construction
have been published by Kruskal (1956), Loberman &
Weinberger (1957), Prim (1957) and Obruca (1964).
Within T we define a star to be any point (and its
adjacent lines) with more than two lines incident to it.
A chain is a sequence of adjacent lines. A circuit is a
chain such that the first line is adjacent to the last. We
define a feasible solution to the. travelling salesman
problem as any circuit which covers the network. An
optimal solution will be a feasible one with least cost.
University of Strathclyde, Department of Computer Science, Glasgow, C.I.
374
Downloaded from http://comjnl.oxfordjournals.org/ at Pennsylvania State University on May 10, 2016
Most algorithms to tackle the travelling salesman
problem attempt to give the optimal solution. Some,
such as the branch and bound method of Eastman (1958)
give a continuous stream of solutions (to a subproblem,
the assignment problem) which converge to the optimal
from below. Others such as integer programming do so
from above, while others such as dynamic programming
wait until the end before divulging an answer. On the
whole these methods demand large storage requirements
or large amounts of time or both. The interest in the
research behind this paper lay in the desire to find a
method of obtaining a subset S of the set of feasible
solutions where S might include an optimal solution and,
if not, some solutions not far from it. Having defined S
we then search through it looking for smaller and smaller
solutions. We can terminate the process at any instant
when we think a solution so far obtained is good enough,
or when a certain amount of time has been expended.
Spanning tree manipulation
u)
Fig. 3
(c)
be from left to right, i.e. clockwise, and downwards.
The first line to be deleted will thus be (4,1) yielding
Fig. 2(a). Let (3,1) be the least of {(3,1), (3,5), (2,1), (2,5)},
the lines of the cotree joining end points of either subtree.
We now form Tc as in Fig. 2(b). This is a chain and so
we add the remaining line thus obtaining a circuit and
hence a feasible solution. The two other deletions at
v4 will yield the chains of Fig. 2{d) or Fig. 2(f). In the
above example, which is trivial because there was only
one star, 5 will consist of at most 3 solutions.
Consider the next example, the Tm as in Fig. 3(a).
The diagrams are almost self-explanatory, the strokes
on the lines indicate the ordering of deletions within a
star. The ordering of the points in Fig. 3(a)
(d)
(e)
was:
In Fig. 3(6) it was:
in Fig. 3(/) it was:
in Fig. 30) it was:
(f)
Fig. 2
1,5,3,2,6,4,7.
1,5,2,6,4,3,7 and
1,5,3,4,6,7,2 and
1,3,5,2,6,4,7.
We can find more solutions, not necessarily different, if
we had rooted Tm at one of the other points.
simple example. Let the Tm be rooted as in Fig. 1 (the
root being the lowest point in a diagram).
Let us define the ordering to be such that for the tree
in Fig. 1 it would yield us the points in the following
order: 2,4,1,5,3. The first (and only) star to be met
will be at point 4 or v4. Within a star let the ordering
Computational aspects
It can be seen that in order to manipulate the tree we
shall have to represent it in such a way as to be able to
go both up and down the tree quickly. We shall assume
375
Downloaded from http://comjnl.oxfordjournals.org/ at Pennsylvania State University on May 10, 2016
00,
Spanning tree manipulation
Let possucc(x~) = posnbr{x), if posnbr{x) 4= 0, else
possucc{below{x)), if below(x) 4= x,
else x (x being the root).
possucc(x) is the mnemonic notation for the positive
successor of x (see Obruca (1963)). Conversely
negsucc(x) can be similarly defined. We thus see that
the application of any of the above functions on a
point JC, either produces another point (not necessarily
different) or zero, indicating the lack of a suitable
transform. We can now define rd(x), the "right or
down" function:
f 0, else
rd(x) = posnbr(x), if posnbr(x) ==
JC, if x is the root, else
—below(x).
Corresponding to the below function we have an above
function above{x):
above{x) = 0, if x is an end point, else
y, where negnbr(y) = 0 and below(y)=x.
Combining above(x) and negsucc(x) into the "left up or
down" function we obtain
lud{x) = x, if above(x) = 0 and negsucc{x) — root, else
—below(negsucc(x)), if above(x) = 0, else
above(x).
rd and lud are functions slightly different from the others
in that they sometimes result in a negative value. The
use of the minus sign is purely to flag the point indicating
a special relationship, the relationship in both cases being
that the application of the function on any of these
points produces a point lower in the tree.
We can now represent the planar rooted tree by the
arrays lud,rd [1 : n], as defined above, rd [1 : «] would
have defined the tree uniquely. However, the lud function
is used to enable us to move up the tree quickly.
376
Having gone up Tc, found a star, deleted a line and
rejoined the two subtrees, we have produced another Tc.
We can store these trees Tc in a variable push-down
stack. The stack moves in the following fashion. We
examine Tc, the current tree on top of the stack. If we
can find a deletion to make and thus obtain another Tc,
we push the new Tc on top of the stack (thus pushing all
the rest down). If, however, Tc is a chain, we form a
feasible solution and reject it from the stack. We now
examine the one below it which has now "popped up"
to the top of the stack. While examining a Tc we might
find that even though it is not a chain we have to reject
it because we have made all possible deletions upon it.
The process is terminated when there is only one tree
left in the stack, the orginal Tm, and we find we have
made all possible deletions upon it. We can never make
more than n successive deletions upon any Tc hence the
stack has to be at most n units deep. In the examples
of Fig. 3, the tree in Fig. 3(a) lies on the bottom of the
stack. The tree in the second level will be one of those
in Figs. 3(6), (/) or (_/). The third level will be one of the
remainder. It is true that the storage requirement of
this stack will be of the order of n2. However, it is in a
form suitable for magnetic-tape handling. That is, we
shall store in the fast access store only part of the stack
near the top. As soon as the stack has nearly filled the
fast store we can write onto magnetic tape the lower
portion of it. If we find that the stack is going down too
fast we simply add some more from the magnetic tape.
If we also keep the cost matrix in the listed representation
as opposed to the matrix representation (see Aarni Perko
(1965)) we shall have reduced the storage requirements
to that of the stack or part of it plus something of the
order {n-\-ni). The program in KDF9 ALGOL was
reasonably fast. Most of the time is spent on the tree
manipulation as ALGOL does not lend itself to efficient
programming in this respect.
Conclusion
The method was applied on 460 sets of randomly
generated cost matrices, satisfying the triangular inequality rule, with n varying from 5 to 11. In no case
was the best solution found more than 15% greater than
the optimal. In 56% of the cases the solutions were
identical with the optimal. The author realizes that no
great conclusion can be drawn on data consisting of
such small number of points. The method was applied
on published problems, e.g. Dantzig (1959), Held and
Karp (1962), Croess (1958) etc. and the method found
solutions varying from 0-8% to 5-8% higher than the
speculated optimum. In the Dantzig 42 town problem,
the program was terminated after half an hour and had
found a solution within 4 • 4 % of the optimum.
The method originally developed from the minimal
wiring problem. In conclusion we shall indicate an
extension or use of this method in the wiring problem
with certain restrictions. The minimal wiring problem
is as follows. Given a set of terminals how do we
connect them using the minimum amount of wire? The
Downloaded from http://comjnl.oxfordjournals.org/ at Pennsylvania State University on May 10, 2016
that the n points of any tree have their labels chosen
from the set of positive integers {1,2,...,«}. Let us
devote a few lines describing our representation, the
discussion being in terms of a functional notation. Let
below(x) represent the point adjacent to vx and on the
chain between vx and the root point. In the special
case, below(rooi) = root. Define posnbr(x), the positive
neighbour of x, as the point y which has below(y)
= below(x) and upon moving in a clockwise direction
around below(x), the first point to be met after x is the
point y: if there is none we put posnbr(x) = 0. Negnbr(x)
is similarly denned in the anticlockwise direction. Thus
if we are given the values of below(x) for all vx we can
reconstruct the corresponding rooted tree. If we are
also given the values of posnbr{x) we can reconstruct
the corresponding planar rooted tree. Any permutation
of the repeated application of the below and/or posnbr
function on the point vy will only yield points of the
tree either below and/or to the right of it. If we wish to
obtain the point lying above vy we must process the
functions below(x) for all x, repeatedly. This is a very
slow process. Let us define further functions.
Spanning tree manipulation
that the join be between any pair of points neither of
which has its maximum number of lines incident to
itself. We stop reducing stars as soon as they satisfy
all the given conditions.
solution will be the minimal spanning tree. However,
in practice we might have to insert the restrictions such
that the following terminals vu v2, v3,. . ., vn have no
more than /(«,), t(v2), t(v3),. . ., t(vn) numbers of wires
incident to them.
We could manipulate the minimal spanning tree as
we did for the travelling salesman problem with the
following relaxation of one of the restrictions. We
stipulated that when joining the two subtrees the join
had to be from end points of each tree: this was in order
to make Tc converge. We can alter this to the restriction
Acknowledgements
This work was carried out under the guidance of
H. I. Scoins of the Computer Laboratory at the University of Newcastle upon Tyne and with the help of a
maintenance grant from the Science Research Council.
References
W. L. (1958). A Solution to the Travelling Salesman Problem, (Presented at the American Summer Meeting of the
Econometric Soc. Cambridge, Mass.).
LITTLE, J. D. C , MURTY, K. G., SWEENEY, D. W., and KAREL, C. (1963). An Algorithm for the Travelling Salesman Problem.
Opn. Res., Vol. 11, pp. 972-989.
KRUSKAL, J. B. (1956). On the Shortest Spanning Subtree of a Graph and a Travelling Salesman Problem, Proc. Amer. Math.
Soc, Vol. 7, p. 48.
LOBERMAN, H., and WEINBERGER, A. (1957). Formal Procedures for connecting Terminals with a Minimal Total Wire Length,
/. Assoc. Comp. Mach., Vol. 4, p. 428.
PRIM, R. C. (1957). Shortest Connection Matrix Network and some Generalisations, Bell System Tech. J., Vol. 36, p. 1389.
OBRUCA, A. (1963). M. Sc. Dissertation, University of Newcastle upon Tyne.
OBRUCA, A. (1964). Algorithm Mintree, Computer Bulletin, Vol. 8, p. 67.
DANTZIG, G., et al. (1959). On a L.P. Combinational Approach to the Travelling Salesman Problem, Oper. Res., Vol. 7, pp. 58-66.
HELD, M., and KARP, R. (1962). A Dynamic Programming Approach to Sequencing Problems, /. of S.I. A.M., Vol. 10, p. 196.
CROESS, G. A. (1958). A Method for Solving Travelling Salesman Problems, Oper. Res., Vol. 6, p. 791.
PERKO, A. (1965). Some computational notes on the shortest route problem, The Computer Journal, Vol. 8, p. 19.
EASTMAN,
Logic and Algorithms, by R. R. Korfhage, 1967; 194 pages.
(New York and London: John Wiley and Sons Inc., 64s.)
Fundamental Boolean Algebra, by J. Kuntzmann, 1967; 320
pages. (London: Blackie and Son Ltd., 75s.)
These two books to a large extent complement each other.
The first (L & A), though including one section in one
chapter on switching networks, is primarily concerned, as its
title implies, with the application of logic to algorithms and
computer languages. The second book (FBA) is much more
concerned with development of the theory of Boolean functions. However, the applications it does give are directed
more towards logic design. This is in keeping with the
remark in its preface: "our work in this field has been inspired
by the desire to assist computer designers".
The important difference of context is the inclusion in
FBA of three-valued Boolean functions. It might be difficult
for computer designers to find relevance in this generalization
and sometimes hard for them to separate properties of
Boolean functions from the generalization. The author
seems to realize the problem and heads certain chapters and
sections with statements declaring which he is discussing (see,
for example, the heading to Chapter 5), but he does not
entirely succeed in overcoming the ambiguity. One wonders
377
whether the contents of FBA might fall between the needs of
computer designers on the one hand and logicians on the
other.
L & A describes very well some fundamental notations
and concepts such as Polish notation and the theory of
algorithms. It is a pity that rather more attention is not paid
to applications of these ideas to the structure and implementation of computer languages.
Both books avoid the pitfall of so many, which is to use
terms not yet denned, but this might be expected of logician
authors. One might argue that a better title for FBA would
be "Theory of Boolean Functions". There is much more
emphasis on algebraic structure in L & A. The more
didactic approach of providing exercises and solutions is a
credit to L & A. A further credit to L & A are the historical
references both in the text and in a concluding chapter. In
this context there is an unfair implication that computers
appeared outside the U.S.A. only after 1952. It is wrong to
credit Hollerith with the invention of the punched card. This
honour usually goes to Jacquard in the 18th century and
Babbage was envisaging their use 40 years before Hollerith's
application (L & A page 155).
R. J. ORD-SMITH (Bradford)
Downloaded from http://comjnl.oxfordjournals.org/ at Pennsylvania State University on May 10, 2016
Book Reviews