The default TravelTimeMeasures
in the router engine are constructed as a Haversine measure with the default velocity of 10m/s. It is likely that the Haversine measures (distances) used provide accurate enough results but the default velocity (10m/s) does not match your vehicles and thus, the calculated times are not leading to the expected results. In this case you can use the Velocities
option and provide more accurate velocities to be used for the calculation of time of arrivals. However, if you are still not satisfied with the results, you can create your own TravelTimeMeasure
that is not based on Haversine. You can read more on custom TravelTimeMeasures
here.
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 velocities for every vehicle.
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 the routes have not changes compared to other example because the solution cost is still calculated by the same Haversine measure. However, you can see that the route_duration
in the output is very long as a result of the slow velocities we provided in the input file.