From db4bb208e59d60cc0ac1a5a003d5f80e3c2e550e Mon Sep 17 00:00:00 2001 From: reinterpretcat Date: Sat, 4 Nov 2023 23:43:24 +0100 Subject: [PATCH] Add more information about algorithms --- docs/src/SUMMARY.md | 1 + docs/src/internals/algorithms/heuristics.md | 80 +++++++++++++++++++++ docs/src/internals/algorithms/index.md | 11 +++ docs/src/internals/algorithms/rosomaxa.md | 9 +++ 4 files changed, 101 insertions(+) create mode 100644 docs/src/internals/algorithms/heuristics.md diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index cd97b7c10..16c83a2e8 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -70,4 +70,5 @@ * [Development practices](internals/development/best-practices.md) * [Testing](internals/development/testing.md) * [Algorithms](internals/algorithms/index.md) + * [Heuristics](internals/algorithms/heuristics.md) * [Rosomaxa](internals/algorithms/rosomaxa.md) diff --git a/docs/src/internals/algorithms/heuristics.md b/docs/src/internals/algorithms/heuristics.md new file mode 100644 index 000000000..bdc841db1 --- /dev/null +++ b/docs/src/internals/algorithms/heuristics.md @@ -0,0 +1,80 @@ +# Heuristics + +This page provides some high level overview of general heuristic used to solve VRP. Some information can be found on +vrp-core crate's [documentation page](https://docs.rs/vrp-core/latest/vrp_core/solver/index.html) + + +## Starting from scratch: constructive heuristics + +To build initial solutions to start with, the solver internally can use different built-in constructive heuristics, such as: + +- variation of Clark & Wright Savings algorithm +- regret insertion +- insertion with blinks +- nearest neighbor +- random insertions +- etc. + +[Related documentation](https://docs.rs/vrp-core/latest/vrp_core/construction/heuristics/index.html) + +Typically, the solver builds four initial solutions and then they are memorized as initial population state by the one +of the population algorithms: + +- `greedy`: only best solution is kept +- `elitism`: N best solutions are kept which are met to some diversification criteria +- `rosomaxa`: a custom population-based algorithm which focuses on improving exploration/exploitation ratio. + +The latter is default, however, others can be used if amount of available CPU is low. + +[Related documentation](https://docs.rs/rosomaxa/latest/rosomaxa/population/index.html) + +## Searching for better solution: meta heuristics + +The goal of metaheuristic (or just heuristic for simplicity) is to refine one (or many) of the known solutions. Currently available heuristics: + +- `ruin and recreate` principle: ruin parts of solution and recreates them. Key ideas: + - use multiple ruin/recreate methods and combine them differently + - make a larger moves in solution space +- `local search`: use different local search operators. The main difference from R&R: + - try to avoid making a big steps in solution space + - target to improve specific aspects in solution +- `explorative heuristics`: these can be seen as generators for explorative moves in solutions space: + - `redistribute search`: removes jobs from specific route and prevents their insertion back to it + - `infeasible search`: allows constraint violations to explore infeasible solutions space. It has recovery step + to move back to feasible space. +- `decomposition search`: splits existing solution into multiple smaller ones (e.g. not more than 2-4 routes) and tries + to improve them in isolation. Typically, it uses all heuristics just mentioned. + +Each heuristic accept one of solution from population (not necessary the best known one) and tries to improve it (or diversify). +During one of refinement iterations, many solutions are picked at the same time and many heuristics are called then. This step +is called a `generation`. + +[Related documentation](https://docs.rs/vrp-core/latest/vrp_core/solver/search/index.html) + + +## What heuristic to pick: hyper heuristic + +As the solver is not limited to one heuristic, there is a problem: what is the best strategy to pick one of the pre-defined +heuristics at given search state? To solve that problem, there are two heuristics are available: + +- `static selective`: associate with every heuristic some probability weight and use it to decide which one to pick next +- `dynamic selective`: try to learn probability dynamically based on search progression over time. + +The latter is used by default. + +[Related documentation](https://docs.rs/rosomaxa/latest/rosomaxa/hyper/index.html) + + +## When to stop: termination criteria + +The search is terminated and the best known solution is returned when some termination criteria is met. The following +termination criteria are supported: + +- `time`: stop after some specified amount of seconds +- `generation`: stop after some specified amount of generations +- `coefficient variation`: stop if there is no `significant` improvement in specific time or amount of generations +- `user interrupted` from command line, e.g. by pressing Ctrl + C + +Interruption when building initial solutions is supported. Default is 300 seconds or 3000 generations max. + +[Related documentation](https://docs.rs/rosomaxa/latest/rosomaxa/termination/index.html) diff --git a/docs/src/internals/algorithms/index.md b/docs/src/internals/algorithms/index.md index 44e46baf0..b58f4e052 100644 --- a/docs/src/internals/algorithms/index.md +++ b/docs/src/internals/algorithms/index.md @@ -1,3 +1,14 @@ # Algorithms This chapter describes some used algorithms (WIP). + + +## References + +TODO: An incomplete list of most important references: + +- Clarke, G & Wright, JW 1964. Scheduling of vehicles from a Central Depot to a Number of the Delivery Point. Operations Research, 12 (4): 568-581 +- Schrimpf, G., Schneider, K., Stamm-Wilbrandt, H., Dueck, V.: Record Breaking Optimization Results Using the Ruin and Recreate Principle. J. of Computational Physics 159 (2000) 139–171 +- Jan Christiaens, Greet Vanden Berghe: Slack Induction by String Removals for Vehicle Routing Problems +- Thibaut Vidal: Hybrid Genetic Search for the CVRP: Open-Source Implementation and SWAP* Neighborhood +- Daniel J. Russo, Benjamin Van Roy, Abbas Kazerouni, Ian Osband and Zheng Wen: A Tutorial on Thompson Sampling https://web.stanford.edu/~bvr/pubs/TS_Tutorial.pdf \ No newline at end of file diff --git a/docs/src/internals/algorithms/rosomaxa.md b/docs/src/internals/algorithms/rosomaxa.md index 898e65d7b..1e61333b6 100644 --- a/docs/src/internals/algorithms/rosomaxa.md +++ b/docs/src/internals/algorithms/rosomaxa.md @@ -56,6 +56,15 @@ This helps to address [exploration-exploitation dilemma](https://en.wikipedia.or in applying a strategy of picking heuristics. +### Additional used techniques + +TODO: describe additional explorative techniques: + +- tabu list usage in ruin methods +- alternative objectives manipulation +- .. + + ## Further research * experiment with different solution characteristics