-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0e5f468
commit 5e8bd78
Showing
17 changed files
with
133 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# How to extend solver | ||
|
||
This section's intention is to give a very brief explanation of some key concepts which might be needed for adding an extra | ||
feature on top of existing logic. For more detailed information, check the corresponding main crates documentation or | ||
source code | ||
|
||
## Constrains & objectives | ||
|
||
A Vehicle Routing Problem used to consist of various constraints and objectives functions, such as: | ||
* capacity constraint | ||
* time window constraint | ||
* job's total value maximization | ||
* cost/duration/distance minimization | ||
* etc. | ||
|
||
Internally, they can be divided into different groups: | ||
- `hard constraints`: a problem invariants which must be hold. Examples: vehicle capacity, job time window. | ||
- `soft constraints`: a problem variants which should be either maximized or minimized. Examples: job assignment, served job's total value. | ||
- `objectives`: an objective of optimization. Typically, it is hierarchical: first, try to assign all jobs, then reduce the total cost of serving them | ||
- `state`: an auxiliary logic to cache some important state and retrieve it faster during search | ||
|
||
|
||
Under the hood, a [feature](https://docs.rs/vrp-core/latest/vrp_core/models/struct.Feature.html) concept combines all these groups. | ||
This is based on observation, that many features requires constraint and objective defined at the same time. | ||
|
||
## A feature concept | ||
|
||
Let's take a brief look at some example: a total job value feature, which purpose to maximize value of assigned jobs. | ||
Here, each job has some associated value (or zero if it is not specified) and the purpose is to maximize it. | ||
|
||
The following code below utilizes `FeatureBuilder` to construct the feature: | ||
|
||
```rust,no_run,noplayground | ||
{{#include ../../../../vrp-core/src/construction/features/total_value.rs:30:45}} | ||
``` | ||
|
||
This builder gets: | ||
- a unique feature `name` | ||
- dedicated `objective function` which counts value and prefers solutions where it is maximized | ||
- a dedicated `constraint` which enforces some problem invariants regarding job value (in this case, only for proximity clustering) | ||
|
||
Additionally, the builder accepts `FeatureState`. Check existing features for more details. | ||
|
||
TODO: expand example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# Development | ||
|
||
This chapter describes development topics, such as code style, testing, etc. | ||
This chapter describes development topics, such as high level architecture, project structure, code style, testing, etc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Project structure | ||
|
||
The project consists of the main and auxiliary crates. Additionally, there is some logical separation inside each group. | ||
|
||
## Main crates | ||
|
||
The following crates are "the heart" of VRP solver: | ||
|
||
* [`rosomaxa`](https://docs.rs/rosomaxa/latest): contains key algorithms for solving optimization problems __without__ | ||
locking to the VRP domain such as hyper heuristics, evolution strategies, etc. | ||
* [`vrp_core`](https://docs.rs/vrp_core/latest): this crate provides all core VRP models with various meta heuristics to | ||
solve rich VRP | ||
* [`vrp_scientific`](https://docs.rs/vrp_scientific/latest): has a building blocks to solve problems from some of scientific | ||
benchmarks. It is useful to evaluate the solver performance in terms of solution quality, search stability and running time. | ||
* [`vrp_pragmatic`](https://docs.rs/vrp_pragmatic/latest): provides models and features to support rich VRP. It includes: | ||
* pragmatic model, serializable in json | ||
* solution checker | ||
* problem validator | ||
* [`vrp_cli`](https://docs.rs/vrp_cli/latest): exposes VRP solve as command line interface or static library. Additionally, | ||
has some extra features, such as: | ||
* various extra commands | ||
* pyO3 bindings to make library usable from Python | ||
* WASM bindings to run solver directly in the browser | ||
* .. | ||
|
||
For these crates, you can find extra information normally published on docs.rs. | ||
|
||
## Helper crates/functionality | ||
|
||
There are few: | ||
|
||
* `experiments/heuristic-research`: my way to experiment with heuristic using some hooks and visualizations. | ||
Live version is exposed [here](https://reinterpretcat.github.io/heuristics/www/) | ||
* `examples/json-pragmatic`: provides example how to use the library as a crate + contains tests and benchmarks on test data | ||
* `examples/jvm-interop` / `python-interop`: some examples how to call library from other languages | ||
* `examples/data`: various examples of problem definitions. Mostly used for testing and documentation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters