Package: lahc
Late Acceptance Hill ClimbingImplementation of Late Acceptance Hill Climbing (LAHC) algorithm by
Burke and Bykov[Burke2017]in python.InstallationEither download the repository to your computer and install, e.g. bypippip install .or install directly from the python package index.pip install lahcUsageThe package provides a base class for subclassing to a specific
problem. Themoveandenergymethods must be implemented by the
user before the algorithm is applied.The user controls the algorithm by adjusting a single algorithmic
parameter, thehistory length, and the termination criteria for
the algorithm. See subsection on each of the topics below.The search is started by calling therunmethod.The example is a good place to start using of the package.NoteThe implementation relies heavily on copying the state. The
default copy strategy (copy_strategy='deepcopy') relies on the
STLcopy.deepcopymethod which works for most data structures,
but is typically quite slow.Largeperformance gains can be
easily obtained by adapting a different copying strategy, see the
documentation of thecopy_statemethod.The history lengthThe behaviour of the LAHC algorithm is governed by a single parameter,
the history length. To alter the history length of the algorithm,
adjust thehistory_lengthparameter of the class.If the history length is set to one, the LAHC algorithm is equivalent
to a greedy Hill Climbing algorithm. Increasing the history length
generally improves the solution quality, but also increases the time to
convergence.Selection of the history length should therefore be based on
requirements for the quality of the solution and time available for
the analysis.A useful characteristic of the LAHC heuristic is that the runtime to
convergence is roughly proportional to the history length. The runtime
at any history length can therefore be estimated after applying the
algorithm at a few different history lengths.As a general recommendation, start at a low history length and
gradually increase it to determine the runtime and variation in the
estimated results. Select a shorter history length that allows
multiple runs in the time allocated for simulations rather than a
longer history length with a single run.Termination criteriaThe algorithm terminates when theterminate_searchmethod evaluates
toTrueor when a interupt signal (Ctrl-C) is sent to the process.The default behaviour of theterminate_searchmethod is to
terminate the algorithm when a minimum number of attempts has been
made and the algorithm has not been able to improve the solution for a
certain number of steps. The minimum number of steps and necessary
number of idle iterations can be adjusted with thesteps_minimumandsteps_idle_fractionparameters, respectively.The default value of thesteps_idle_fraction(0.02) is generally a
good choice for a variety of problems, but the defaultsteps_minimumvalue (100000) may have to be adjusted depending on
the problem. As a general recommendation, the user should reduce thesteps_minimumparameter if the algorithm consistently terminates atsteps_minimumafter running for a long period without improving
the solution.AcknowledgementsBoth the structure and parts of the source code for theLateAcceptanceHillClimberclass is copied from theAnnealerclass in thesimannealpython project. All contributions from thesimannealproject is hereby gratefully acknowledged. Check out thesimannealproject athttps://github.com/perrygeo/simannealwhich implements the widely used and sucessful Simulated Annealing
metaheuristic.SupportPleaseopen an issuefor support.ContributingPlease contribute usingGithub Flow.
Create a branch, add commits, andopen a pull request.Bibliography[BURKE2017]E. K. Burke, Y. Bykov, The late acceptance Hill-Climbing heuristic.
European Journal of Operational Research. 258, 70–78 (2017).