ALNS logo

alns is a general, well-documented and tested implementation of the adaptive large neighbourhood search (ALNS) metaheuristic in Python. ALNS is an algorithm that can be used to solve difficult combinatorial optimisation problems. The algorithm begins with an initial solution. Then the algorithm iterates until a stopping criterion is met. In each iteration, a destroy and repair operator are selected, which transform the current solution into a candidate solution. This candidate solution is then evaluated by an acceptance criterion, and the operator selection scheme is updated based on the evaluation outcome.

It is common in the operations research community to re-implement heuristics such as ALNS. Such implementations are relatively limited, are typically tied tightly to one particular problem domain, and often implement just a single acceptance criterion and operator selection scheme. This inhibits experimentation with different aspects of the algorithm, and makes re-use by others or in other problem domains difficult. This alns package, by contrast, offers a clear and problem-agnostic API for using the ALNS algorithm, and provides many acceptance criteria and operator selection schemes. Additionally, we provide diagnostic statistics, plotting methods, logging, and the ability to register custom callbacks at various points of the search. These allow researchers and practitioners to rapidly develop state-of-the-art metaheuristics in a wide range of problem domains.

The alns package depends only on numpy and matplotlib. It can be installed through pip via

pip install alns

Hint

Have a look at the quickstart template to get started on your own ALNS metaheuristic. If you are new to metaheuristics or ALNS, you might benefit from first reading the introduction to ALNS. To set up an installation from source, or to run the examples listed below yourself, please have a look at the installation instructions.