In vehicle routing problems (VRPs) it is often useful to account for the amount of time required to service a stop. This allows for a VRP model that aligns more closely with reality because loading and unloading times are represented in the model. This information can be added to the model using the Services
option.
Example
The router example is used as a base, where routes are created to visit seven landmarks in Kyoto using two vehicles. This time, we define service times for a few stops.
Save the following information in an input.json
file (see input and output for more information on working with input files).
Code
The following program uses the CLI Runner to obtain a solution and requires access to the Nextmv code repository on GitHub. To request access, please contact support@nextmv.io.
To proceed with running the example, create a main.go
file and use the code snippet below.
To execute the example, specify the path to the input.json
file using command-line flags and use jq to extract the solution state (see runners for more information on building and running programs).
Solution
The solution should look similar to this one:
The route durations in the output file now does not only account for the travel time alone but also the given service times.