Skip to main content

A flexible implementation of the adaptive large neighbourhood search (ALNS) algorithm.

Project description

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.

Cite

In case you have used this package in a published work, please consider citing it as

Wouda, N.A. 2019. A Python package for the adaptive large neighbourhood search metaheuristic. https://github.com/N-Wouda/ALNS.

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

alns-1.3.2.tar.gz (19.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

alns-1.3.2-py3-none-any.whl (26.9 kB view details)

Uploaded Python 3

File details

Details for the file alns-1.3.2.tar.gz.

File metadata

  • Download URL: alns-1.3.2.tar.gz
  • Upload date:
  • Size: 19.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.1

File hashes

Hashes for alns-1.3.2.tar.gz
Algorithm Hash digest
SHA256 a1cf20507ab323859f9f64c20e54a1c3bbcec64fa00a5d13a8074fb5def631c6
MD5 ba5cb1dfa944f37d51e5141b214c145c
BLAKE2b-256 fd445d149b24a1b21f615e567b892df5b7cd0e82f618dbc94c14e34ed0fbdebb

See more details on using hashes here.

File details

Details for the file alns-1.3.2-py3-none-any.whl.

File metadata

  • Download URL: alns-1.3.2-py3-none-any.whl
  • Upload date:
  • Size: 26.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.1

File hashes

Hashes for alns-1.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 86d14a688855c61dfafd39a33b4621b5c3a4b3321c2857ce13d4b9949d33837b
MD5 6da22f69e098e2a29709ccfc63b614f0
BLAKE2b-256 2185066829d19235cd476428527bd0002ccef05446b62bd9e11452d78ba7751b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page