Optimization by Simulated Annealing: an Experimental Evaluation; Part I
Total Page:16
File Type:pdf, Size:1020Kb
OPTIMIZATIONBY SIMULATEDANNEALING: AN EXPERIMENTAL EVALUATION;PART 1, GRAPH PARTITIONING DAVIDS. JOHNSON A T&T Bell Laboratories, Murray Hill, New Jersey CECILIAR. ARAGON University of California, Berkeley, California LYLE A. McGEOCH Amherst College, Amherst, Massachusetts CATHERINESCHEVON Johns Hopkins University, Baltimore, Maryland (ReceivedFebruary 1988; revision received January 1989; accepted February 1989) In this and two companionpapers, we reporton an extendedempirical study of the simulatedannealing approach to combinatorialoptimization proposed by S. Kirkpatricket al. That study investigatedhow best to adapt simulated annealingto particularproblems and comparedits performanceto that of more traditionalalgorithms. This paper(Part I) discusses annealing and our parameterizedgeneric implementationof it, describeshow we adapted this generic algorithmto the graphpartitioning problem, and reportshow well it comparedto standardalgorithms like the Kernighan- Lin algorithm.(For sparserandom graphs,it tended to outperformKernighan-Lin as the numberof verticesbecome large,even when its much greaterrunning time was taken into account.It did not performnearly so well, however,on graphsgenerated with a built-ingeometric structure.) We also discusshow we went aboutoptimizing our implementation, and describethe effectsof changingthe variousannealing parameters or varyingthe basicannealing algorithm itself. A ew approach to the approximate solution of new problems (even in the absence of deep insight difficult combinatorial optimization problems into the problems themselves) and, because of its recently has been proposed by Kirkpatrick,Gelatt and apparent ability to avoid poor local optima, it offers Vecchi (1983), and independently by Cerny (1985). hope of obtaining significantly better results. This simulatedannealing approach is based on ideas These observations, together with the intellectual from statistical mechanics and motivated by an anal- appeal of the underlying physical analogy, have ogy to the behavior of physical systems in the presence inspired articlesin the popular scientific press (Science of a heat bath. The nonphysicist, however, can view 82, 1982 and Physics Today 1982) as well as attempts it simply as an enhanced version of the familiar tech- to apply the approach to a variety of problems, in nique of local optimizationor iterativeimprovement, areas as diverse as VLSI design (Jepsen and in which an initial solution is repeatedly improved by Gelatt 1983, Kirkpatrick, Gelatt and Vecchi 1983, making small local alterationsuntil no such alteration Vecchi and Kirkpatrick 1983, Rowan and Hennessy yields a better solution. Simulated annealing random- 1985), pattern recognition (Geman and Geman 1984, izes this procedure in a way that allows for occasional Hinton, Sejnowski and Ackley 1984) and code gen- uphillmoves (changes that worsen the solution), in an eration (El Gamal et al. 1987), often with substantial attempt to reduce the probability of becoming stuck success. (See van Laarhoven and Aarts 1987 and in a poor but locally optimal solution. As with local Collins, Eglese and Golden 1988 for more up-to-date search, simulated annealing can be adapted readily to and extensive bibliographiesof applications.)Many of Subject classifications: Networks/graphs, heuristics: algorithms for graph partitioning. Simulation, applications: optimization by simulated annealing. Operations Research 0030-364X/89/3706-0865 $01.25 Vol. 37, No. 6, November-December 1989 865 ? 1989 Operations Research Society of America This content downloaded from 128.208.219.145 on Thu, 04 Jun 2015 21:20:57 UTC All use subject to JSTOR Terms and Conditions 866 / JOHNSON ET AL. the practical applications of annealing, however, have for sparse random graphs it tended to outperform been in complicated problem domains, where pre- Kernighan-Lin as the number of vertices became vious algorithms either did not exist or perfom-led large. For a class of random graphs with built-in quite poorly. In this paper and its two companions, geometric structure,however, Kernighan-Linwon the we investigate the performanceof simulated annealing comparisons by a substantialmargin. Thus, simulated in more competitive arenas, in the hope of obtaining annealing's success can best be described as mixed. a better view of the ultimate value and limitations of Section 4 describes the experiments by which we the approach. optimized the annealing parametersused to generate The arena for this paper is the problem of partition- the results reportedin Section 3. Section 5 investigates ing the vertices of a graph into two equal size sets to the effectiveness of various modifications and alter- minimize the number of edges with endpoints in natives to the basic annealing algorithm. Section 6 both sets. This application was first proposed by discusses some of the other algorithms that have been Kirkpatrick, Gelatt and Vecchi, but was not exten- proposed for graph partitioning, and considers how sively studied there. (Subsequently, Kirkpatrick 1984 these might factor into our comparisons. We conclude went into the problem in more detail, but still did not in Section 7 with a summary of our observationsabout deal adequately with the competition.) the value of simulated annealing for the graph parti- Our paper is organized as follows. In Section 1, we tioning problem, and with a list of lessons learned that introduce the graph partitioning problem and use it may well be applicable to implementations of simu- to illustrate the simulated annealing approach. We lated annealing for other combinatorial optimization also sketch the physical analogy on which annealing problems. is based, and discuss some of the reasons for optimism In the two companion papers to follow, we will (and for skepticism) concerning it. Section 2 presents report on our attempts to apply these lessons to three the details of our implementation of simulated anneal- other well studied problems: Graph Coloring and ing, describing a parameterized, generic annealing Number Partitioning (Johnson et al 1990a), and the algorithm that calls problem-specificsubroutines, and Traveling Salesman Problem (Johnson et al. 1990b). hence, can be used in a variety of problem domains. Sections 3 through 6 present the results of our 1. SIMULATEDANNEALING: THE BASIC experiments with simulated annealing on the graph CONCEPTS partitioning problem. Comparisons between anneal- ing and its rivals are made difficult by the fact that 1.1. Local Optimization the performance of annealing depends on the partic- To understand simulated annealing, one must first ular annealing schedule chosen and on other, more understand local optimization. A combinatorial opti- problem-specific parameters. Methodological ques- mization problem can be specified by identifying a set tions also arise because annealing and its main com- of solutions together with a cost function that assigns petitors are randomized algorithms (and, hence, can a numerical value to each solution. An optimal solu- give a variety of answers for the same instance) and tion is a solution with the minimum possible cost because they have running times that differ by factors (there may be more than one such solution). Given as large as 1,000 on our test instances. Thus, if com- an arbitrarysolution to such a problem, local opti- parisons are to be convincing and fair, they must be mization attempts to improve on that solution by a based on large numbers of independent runs of the series of incremental, local changes. To define a local algorithms, and we cannot simply compare the aver- optimization algorithm, one first specifies a method age cutsizes found. (In the time it takes to perform for perturbingsolutions to obtain different ones. The one run of the slower algorithm, one could perform set of solutions that can be obtained in one such step many runs of the faster one and take the best solution from a given solution A is called the neighborhoodof found.) A. The algorithmthen performsthe simple loop shown Section 3 describes the problem-specific details of in Figure 1, with the specific methods for choosing S our implementation of annealing for graph partition- and S' left as implementation details. ing. It then introduces two general types of test graphs, Although S need not be an optimal solution when and summarizes the results of our comparisons the loop is finally exited, it will be locally optimal in between annealing, local optimization, and an algo- that none of its neighbors has a lower cost. The hope rithm due to Kernighan-Lin(1970) that has been the is that locally optimal will be good enough. long-reigning champion for this problem. Annealing To illustratethese concepts, let us consider the graph almost always outperformed local optimization, and partitioning problem that is to be the topic of Section This content downloaded from 128.208.219.145 on Thu, 04 Jun 2015 21:20:57 UTC All use subject to JSTOR Terms and Conditions GraphPartitioning by SimulatedAnnealing / 867 1. Get an initialsolution S. Simulated annealing is an approach that attempts 2. While there is an untested neighbor of S do the to avoid entrapment in poor local optima by allowing following. an occasional uphill move. This is done under the 2.1 Let S' be an untested neighbor of S. influence of a random number generatorand a control 2.2 If cost (S') < cost (S), set S = S'. parametercalled the temperature.As typically imple- 3. Return S. mented, the simulated annealing approach involves a pair of nested loops and