HSF: A Generic Framework to Easily Design Meta ... - Semantic Scholar

5 downloads 7182 Views 249KB Size Report
Email: {[email protected],[email protected]} ... These tend to provide templates with the user having to define, for each problem addressed, the ...
MIC’2001 - 4th Metaheuristics International Conference

423

HSF: A Generic Framework to Easily Design Meta-Heuristic Methods Rapha¨el Dorne∗

Christos Voudouris∗



Intelligent Complex Systems Research Group BT Laboratories, Adastral Park, PP12/MLB1, Martlesham Heath Ipswich, IP5 3RE, Suffolk, United Kingdom Email: {[email protected],[email protected]}

1

Introduction

For some years now, Meta-Heuristic methods have demonstrated their ability to tackle large-scale optimisation problems. Up to now, several frameworks have been implemented for this family of methods. Some of them are either dedicated to Local Search such as EasyLocal++[5], Localizer[8], LocalSearch framework[1], Templar[7], HotFrame[4] or to Evolutionary Computation such as EOS[2], EASEA[3]. These tend to provide templates with the user having to define, for each problem addressed, the move operators and/or evolutionary operators with the need to construct tedious and hard-code move evaluation mechanisms. Furthermore, because of their structure most of the frameworks are limited in the choice of techniques provided. Therefore, it appears difficult using such existing frameworks to model efficient Meta-Heuristic methods as Hybrid Methods, combining evolutionary algorithms with local search methods. Such methods require more generalisation and more flexibility. Thus the main motivation behind the Heuristic Search Framework is to develop a Java object-oriented framework allowing to combine population and single solution algorithms offering generalisation, flexibility and efficiency in order to tackle academic problems and real applications.

2

Heuristic Search Framework

The Heuristic Search Framework (HSF) was created as a generic framework for the family of optimisation techniques known as Heuristic Search. The motivation here is to provide representation of existing methods, retain flexibility to build new ones and use the generalisation so as to avoid re-implementing concepts that have already been created in HSF. Three main concepts are the basis of HSF: Heuristic Search, Heuristic Solution and Heuristic Problem. • Heuristic Search is the concept used to define a search algorithm. • Heuristic Solution is the solution representation of an optimisation problem manipulated inside HSF. At the present moment, a vector of variables and a set of sequences are readily available. • Heuristic Problem is only an interface between an optimisation problem and HSF. In HSF, we make use of the realisation that many Heuristic Search algorithms can be broken down into a plurality of constituent parts, and that at least some of those parts are common between algorithms. Porto, Portugal, July 16-20, 2001

424

MIC’2001 - 4th Metaheuristics International Conference

For example, algorithm A could be considered as comprising parts a, b, c while algorithm B could be considered as comprising a, c, d. While with known systems, algorithms A and B are considered as independent algorithms; we identify constituent parts, then look to see which of these parts are already available within the framework. Such a constituent part is called Search Component (SC) and those components can be considered to comprise a ”library” of parts. Then HSF offers a user the capability to build a complete and complex algorithm by plugging several components together. Moreover, a user can even add new parts. For example, if, with algorithm B, parts a, b and c already exist in the framework, but part d does not, a user can create part d. This part is then added to the library and available for future use by other algorithms. Figure 1 shows a class hierarchy of the main search components necessary to build the core of a local search method. A Search instance determines if we are considering a Population or a Single Solution Heuristic Search.

6HDUFK&RPSRQHQW 1HLJKERUKRRG

1HLJKERUKRRG6HDUFK

3RVLWLRQ$VVLJQ0RYH1HLJKERUKRRG 3RVLWLRQ0RYH$W0RYH1HLJKERUKRRG 3RVLWLRQ6ZDS0RYH1HLJKERUKRRG 9DULDEOH,QGH[$VVLJQ0RYH1HLJKERUKRRG 6HOHFWDEOH9DULDEOH,QGH[$VVLJQ0RYH1HLJKERUKRRG 9DULDEOH,QGH[0RYH$W0RYH1HLJKERUKRRG 9DULDEOH,QGH[6ZDS0RYH1HLJKERUKRRG

&RPSRVLWH1HLJKERUKRRG6HDUFK

6HDUFK 3RSXODWLRQ+HXULVWLF6HDUFK 6LQJOH6ROXWLRQ+HXULVWLF6HDUFK

3HUIRUP%HVW2I$OO&16 3HUIRUP$OO&16 6LQJOH1HLJKERUKRRG6HDUFK $VSLUDWLRQ3OXV &LUFXODU$VSLUDWLRQ3OXV 5HVWDUW$VSLUDWLRQ3OXV %HVW,PSURYHPHQW %HVW0RYH1HLJKERUKRRG6HDUFK &LUFXODU)LUVW,PSURYHPHQW )LUVW,PSURYHPHQW )LUVW/HJDO0RYH1HLJKERUKRRG6HDUFK 5HVWDUW)LUVW,PSURYHPHQW 7KUHVKROG1HLJKERUKRRG6HDUFK

6LQJOH6ROXWLRQ0HWKRG &RPSRVLWH6LQJOH6ROXWLRQ0HWKRG *HQHUDWLRQ6LQJOH6ROXWLRQ0HWKRG 66*B8VLQJ&RQVWUXFWLRQ 66*B8VLQJ&XUUHQW3UREOHP 66*B8VLQJ5DQGRP /RFDO6HDUFK 5HGXFH&RQIOLFW/RFDO6HDUFK 3HUWXUEDWLRQ6LQJOH6ROXWLRQ0HWKRG 6HDUFK5HVWDUW6LQJOH6ROXWLRQ0HWKRG

,QYDULDQW6LPXODWHG$QQHDOLQJ

Figure 1: Search Components for a Single Solution Heuristic Search in HSF

The concept of a SingleSolutionMethod is a search component taking as input a Heuristic Solution, modifying it using its own process and returning as output a new Heuristic Solution. Under a SingleSolutionMethod, we find GenerationSingleSolutionMethod to generate initial solution, CompositeSingleSolutionMethod to link several single solution methods, LocalSearch to run a local search iterative process, SearchRestartSingleSolutionMethod to restart a search and PerturbationSingleSolutionMethod to perturb a solution. In particular, a LocalSearch component (within the SingleSolutionMethod) manipulates two other search components a NeighborhoodSearch and a Neighborhood to realise the iterative improvement process. A Neighborhood component in HSF is almost equivalent to the classic definition of a Neighborhood concept for a Local Search. Except, instead of returning a set of solutions, a HSF Neighborhood will return a set of potential Moves. A NeighborhoodSearch component is defined over a Neighborhood and describes the strategy on how-to select a neighbor among those received from a Neighborhood instance. For example, a BestMoveNeighborhoodsearch selects the best one among those provided by the Neighborhood. Figure 2 represents an implementation of a classic Hill-Climber (HC) algorithm. In HSF, an algorithm is a tree of search components, which are a subset of those components presented in Figure 1. Porto, Portugal, July 16-20, 2001

MIC’2001 - 4th Metaheuristics International Conference

425

Such a tree executes each search component going through them from the left to the right following a classic depth-first tree traversal algorithm. Each component can iterate on all its child search components. The following sequential algorithm is equivalent to the tree of Figure 2 (related component in parenthesis). 1. generate initial solution s (VectorSolutionRandomGeneration) 2. generate M (s) using Neighborhood instance (VariableIndexAssignMoveNeighborhood) 3. select the best move m in M (s) (all moves are evaluated here) (BestMoveNeighborhoodSearch) 4. perform move m on s (LocalSearch) 5. while stopping condition not satisfied, go back to step 2 (LocalSearch) This classification allows a generic Local Search algorithm to combine any NeighborhoodSearch with any Neighborhood. A Simulated Annealing (SA) algorithm can be seen as a classic HC with a specific neighborhood search mechanism, where a neighbor is selected if it verifies a specific predicate involving the current solution  s and the neighbor under consideration s . The following search components have been added to model the family of Threshold methods:

6LQJOH6ROXWLRQ+HXULVWLF6HDUFK &RPSRVLWH6LQJOH6ROXWLRQ0HWKRG 9HFWRU6ROXWLRQ5DQGRP*HQHUDWLRQ

&RPSRVLWH6LQJOH6ROXWLRQ0HWKRG /RFDO6HDUFK %HVW0RYH1HLJKERUKRRG6HDUFK 9DULDEOH,QGH[$VVLJQ0RYH1HLJKERUKRRG

Figure 2: Tree of Search Components for a Hill-Climber

• ThresholdNeighborhoodSearch extends NeighborhoodSearch and describes a specific Neighborhood strategy, which goes through all the potential neighbors and selects the first one satisfying the predicate isAccepted(Move move). • SimulatedAnnealing, which extends ThresholdNeighborhoodSearch, overrides the predicate isAccepted(Move move) to redefine it as the classic SimulatedAnnealing acceptance criterion using Temperature, Cooling programme, etc. With the addition of only two new components, a Threshold method has been included in HSF. As a result all existing Neighborhood instances are automatically available to any Threshold strategy. This addition of a new method means that HSF now covers a broader range of heuristic search methods. Another feature included in HSF is an event handling facilities. A Search Component can send events to, or listen for events from other components of HSF and can interact with them. Examples of event notification can be illustrated by considering a Tabu Search (TS) method. To implement a tabu mechanism, we need to listen for events sent by a NeighborhoodSearch (NS) instance: • InitialisationHasBeenPerformed: sent when a NS has been initialised, Porto, Portugal, July 16-20, 2001

426

MIC’2001 - 4th Metaheuristics International Conference

• MoveWillBeEvaluated: sent when a move is going to be evaluated in a NS instance, • MoveHasBeenPerformed: sent when a move has been performed in a NS instance. TS has a very specific behaviour which is to set as “tabu” restrictions to prevent the last configurations visited for a certain number of iterations. In HSF, a Tabu mechanism is a search component that can be added as a child of any NS instance, listening for events. A tabu instance t reacts as following if these events are detected from a NS instance ns: • InitialisationHasBeenPerformed: t initialises itself using the heuristic solution referenced in ns. • MoveWillBeEvaluated: t sets the tabu status of the current move m. • MoveHasBeenPerformed: t updates its tabu list according to the last move performed. Using these event notifications, a tabu mechanism appears as a generic component, which can be added to any NeighborhoodSearch. Other mechanisms as Aspiration Criterion or dynamic modification of the objective function are implemented in HSF using similar event scenarios. For a population heuristic search, the goal is similarly to identify the pertinent principles governing the search algorithms, this time specifically related to population-based algorithms. A PopulationMethod is a similar concept to the SingleSolutionMethod but taking as input a Heuristic Population and returning as output another Heuristic Population modified by operators contained in a population method such as Crossover, Mutation, etc. In particular a mutation is generically described as an operator that locally modifies a Heuristic Solution to generate a new Heuristic Solution. Notice the Search Components defined for a Single Solution Heuristic Search are reused here. A NeighborhoodSearch, or a SingleSolutionMethod, can be plugged as a mutation into a Population Heuristic Search. Thus confirming the reusability of HSF as any novel Neighborhoodsearch is automatically available for any mutation. As a result of using HSF, users can develop and evaluate wide ranging types of algorithms in a relatively short time, simply by plugging various parts together. Such a facility is particularly advantageous in the field of approximate methods, where new algorithms are continually being developed and require evaluating over a wide range of problems. Search Components can be ”glued” together very easily (as described above) and in many different ways, to create many different types of algorithms. These algorithms can then be applied to a problem, so that the performance of the different algorithms can be evaluated very easily.

3

Using HSF with the Problem Modelling Framework

The HSF framework is part of a complete project called iOpt created by the ICSR group of BT Laboratories. Typically, HSF interacts with both an Invariant library (IL) and a framework for Problem Modelling (PMF). The IL is a set of functions providing a complete mathematical algebra allowing definition of relations between variables, and performing incremental updates when the value of a variable is changed. This library is suitable for heuristic search methods, where we want to quickly evaluate the results of any change to a decision variable on the objective function. The PMF is a high level framework based on invariant library where a user can define a Constraint Optimisation Problem (COP) with decision variables, constraints and objective function. More precisely, PMF offers the possibility to use Boolean, Integer, Real, String and Object basic data types and also the capability to define a value domain for each of them. Therefore to illustrate the combination of Porto, Portugal, July 16-20, 2001

MIC’2001 - 4th Metaheuristics International Conference

427

PMF with HSF, we consider a classic Graph Coloring problem. Given a graph G(V, E) to color in k colors, we obtain the following problem description using COP format (X, D, C, F ) where: • X = set of integer decision variables representing the |V | nodes of the Graph G. • D = domain [1..k] for each variable • C = {cl |cl = {xi = xj }} for each edge between node i and node j contained in E • F = minimise the number of constraints in conflict, 0 means a complete coloring in k colors.

3RSXODWLRQ+HXULVWLF6HDUFK

6LQJOH6ROXWLRQ+HXULVWLF6HDUFK

6LQJOH6ROXWLRQ+HXULVWLF6HDUFK &RPSRVLWH6LQJOH6ROXWLRQ0HWKRG 9HFWRU6ROXWLRQ5DQGRP*HQHUDWLRQ &RPSRVLWH6LQJOH6ROXWLRQ0HWKRG /RFDO6HDUFK ,QYDULDQW6LPXODWHG$QQHDOLQJ

9DULDEOH,QGH[$VVLJQ0RYH1HLJKERUKRRG

&RPSRVLWH3RSXODWLRQ0HWKRG *HQHUDWLRQ3RSXODWLRQ0HWKRG

&RPSRVLWH6LQJOH6ROXWLRQ0HWKRG

9HFWRU6ROXWLRQ5DQGRP*HQHUDWLRQ &RPSRVLWH3RSXODWLRQ0HWKRG

9HFWRU6ROXWLRQ5DQGRP*HQHUDWLRQ &RPSRVLWH6LQJOH6ROXWLRQ0HWKRG

0XWDWLRQ3RSXODWLRQ0HWKRG 6LQJOH1HLJKERUKRRG6HDUFK0XWDWLRQ

/RFDO6HDUFK %HVW0RYH1HLJKERUKRRG6HDUFK 9DULDEOH,QGH[$VVLJQ0RYH1HLJKERUKRRG ,QWHJHU$VVLJQPHQW7DERR $VSLUDWLRQ&ULWHULRQ

)LUVW/HJDO0RYH1HLJKERUKRRG6HDUFK 9DULDEOH,QGH[$VVLJQ0RYH1HLJKERUKRRG &URVVRYHU3RSXODWLRQ0HWKRG 8QLIRUP&URVVRYHU 6HOHFWLRQ3RSXODWLRQ0HWKRG 6866HOHFWLRQ

6LPXODWHG$QQHDOLQJ

7DEX6HDUFK

*HQHWLF$OJRULWKPV7DEX6HDUFK

Figure 3: Default Heuristic Search Algorithms available for a Graph Coloring Problem

Then HSF is able to generically and automatically provide search trees for HC, SA, TS and Hybrid Genetic Algorithms methods (cf. Figure 3). These methods do not use any specific information from the Graph Coloring problem. They only assume two things. Firstly a Vector Solution is able to represent a potential solution of the problem, (valid as in a COP a set of variables can be represented as a vector of variables). Secondly, they assume that a Neighborhood modifying the values assigned to variables is sufficient, (valid as in a COP, the objective is to find the best assignment of values to variables). Thereafter HSF is capable, through its default Heuristic Problem interface, to access a problem instance from PMF, get the type and the domain of the decision variables, and read the objective value for any Heuristic Solution. Assuming a Vector Solution, HSF can build an initial heuristic solution and then apply NeighborhoodSearch, Mutation and Crossover. With regard to the Tabu Search, we assume a tabu mechanism, which sets “tabu” the last assignments made. Therefore this set of default methods appears to be automatically available for any COP. Thus HSF combined with PMF offers a complete and integrated solving system based on Heuristic Search methods.

4

Experiments: Graph Coloring

In this section, we have carried out experiments1 on a subset of well-known random graphs provided by Johnson et al. in [6]. We applied to them default methods provided by HSF: HC, SA, TS and GA+TS2 of the Figure 3. The results in the table 1 shows the lowest number of colors found and the time required to get that coloring over one run with a maximum of 5 000 000 moves evaluated. 1 More

experiments on applying HSF on instances of the Vehicle Routing Problem are reported in [9] to a Genetic Algorithms using a Tabu Search algorithm as mutation operator

2 corresponding

Porto, Portugal, July 16-20, 2001

428

MIC’2001 - 4th Metaheuristics International Conference

Problem

Colors

HC Time (sec.)

Colors

SA Time (sec.)

Colors

TS Time (sec.)

Colors

dsjc125.1.col dsjc125.5.col dsjc125.9.col

7 21 46

2 70 492

6 20 46

166 334 437

5 18 44

44 557 2904

5 18 45

GA+TS Time (sec.) 482 3339 6761

Table 1: Results for Graph Coloring In terms of the solution quality, the results reported here are equivalent and even better than those found by similar frameworks as Localizer[8] or EasyLocal++[5]. In terms of speed, HSF appears to be slower but still competitive with Localizer especially if we consider that HSF has been implemented in Java. EasyLocal++ remains clearly faster as it is less generic and declarative framework than both HSF and Localizer.

5

Conclusion

This paper has briefly presented HSF, a Java-based innovative framework, which proposes a new way to design Heuristic Search algorithms by identifying foundamental concepts already defined in the literature. Those concepts implemented as basic components, are thereafter plugged together to obtain a Heuristic Search algorithm. This approach allows to easily implement a wide range of well-known algorithms in a short time and facilitate the integration of future algorithms by quickly and easily add required new components. Combined with PMF, HSF is even capable to automatically provide a broad range of default algorithms for COPs. By its flexibility, generalisation and efficiency, HSF offers a complete solving system based on Heuristic Search algorithms.

References [1] A. Andreatta, S. Carvalho, and C. Ribeiro. An object-oriented framework for local search heuristics. In Proceedings of TOOLS USA’98, pages 33–45, 1998. [2] E. Bonsma, M. Shackleton, and Rob Shipman. EOS: an evolutionary and ecosystem research platform. BT Technology Journal, 18:24–31, 2000. [3] Pierre Collet, Evelyne Lutton, Marc Schoenauer, and Jean Louchet. Take it EASEA. In Marc Schoenauer, Kalyanmoy Deb, G¨ unter Rudolph, Xin Yao, Evelyne Lutton, Juan Julian Merelo, and Hans-Paul Schwefel, editors, Parallel Problem Solving from Nature – PPSN VI, pages 891–901, Berlin, 2000. Springer. [4] A. Fink, S. Voß, and D. Woodruff. Building reusable software components for heuristic search. In H.-J. L¨ uthi P. Kall, editor, Operations Research Proceedings 1998, pages 210–219, 1999. [5] L.D. Di Gaspero and A. Schaerf. Easylocal++: An object-oriented framework for flexible design of local search algorithms. Technical Report UDMI/13/2000/RR, 2000. [6] D.S. Johnson, C.R. Aragon, L.A. McGeoch, and C. Schevon. Optimization by simulated annealing: An experimental evaluation; part ii, graph coloring and number partitioning. Operations Research, 39(3):378–406, 1991. [7] M. Jones, G. McKeown, and V. Rayward-Smith. Templar: An object oriented framework for distributed combinatorial optimization. In UNICOM Seminar on Modern Heuristics for Decision Support, 1998. [8] L. Michel and P. Van Hentenryck. Localizer: A modeling language for local search. INFORMS Journal of Computing, 11:1–14, July 1999. [9] C. Voudouris and R. Dorne. Heuristic search and one-way constraints for combinatorial optimisation. In Proceedings of CP’AI-OR2001, Wye College (Imperial College), Ashford, Kent UK, April 8-10, 2001.

Porto, Portugal, July 16-20, 2001