In this tutorial, you will learn how to use the router
engine with a simple example.
Example
The aim of this example is to create routes to visit seven landmarks in Kyoto using two vehicles.
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:
You can see that one vehicle has six stops assigned and the other just a single stop, which is the farthest from the others.
See the router
engine overview page for additional options that can be added to extend this basic example.