Code Monkey home page Code Monkey logo

alns's Introduction

PyPI version Build Status codecov Codacy Badge

This package offers a general, well-documented and tested implementation of the adaptive large neighbourhood search (ALNS) meta-heuristic, based on the description given in Pisinger and Ropke (2010). It may be installed in the usual way as,

pip install alns

How to use

The alns package exposes two classes, ALNS and State. The first may be used to run the ALNS algorithm, the second may be subclassed to store a solution state - all it requires is to define an objective member function, returning an objective value.

The ALNS algorithm must be supplied with an acceptance criterion, to determine the acceptance of a new solution state at each iteration. An overview of common acceptance criteria is given in Santini et al. (2018). Several have already been implemented for you, in alns.criteria,

  • HillClimbing. The simplest acceptance criterion, hill-climbing solely accepts solutions improving the objective value.
  • RecordToRecordTravel. This criterion only accepts solutions when the improvement meets some updating threshold.
  • SimulatedAnnealing. This criterion accepts solutions when the scaled probability is bigger than some random number, using an updating temperature.

Each acceptance criterion inherits from AcceptanceCriterion, which may be used to write your own.

Examples

The examples/ directory features some example notebooks showcasing how the ALNS library may be used. Of particular interest are,

  • The travelling salesman problem (TSP), here. We solve an instance of 131 cities to within 2.1% of optimality, using simple destroy and repair heuristics with a post-processing step.
  • The cutting-stock problem (CSP), here. We solve an instance with 180 beams over 165 distinct sizes to within 1.35% of optimality in only a very limited number of iterations.

References

  • Pisinger, D., and Ropke, S. (2010). Large Neighborhood Search. In M. Gendreau (Ed.), Handbook of Metaheuristics (2 ed., pp. 399-420). Springer.
  • Santini, A., Ropke, S. & Hvattum, L.M. (2018). A comparison of acceptance criteria for the adaptive large neighbourhood search metaheuristic. Journal of Heuristics 24 (5): 783-815.

alns's People

Contributors

n-wouda avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.