The router engine is configured through a list of options that are passed in to the NewRouter
function. The opts ...Option
argument implies that any number of options can be passed, or none at all. Sometimes, not all the options needed to configure the router
are available at the time it is instantiated. The Options
function allows the router
to be configured at any time after it has been declared.
The router
engine's overview page provides a list of all options that can be configured, including those for:
- adding constraints,
- setting vehicle properties, and
- customizing the solver.
In this tutorial, the Options
function is showcased using vehicle's start and end locations.
Example
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.
The code snippet used to configure a vehicle's start and end locations can be modified to pass the vehicle end locations using the Options
function, as opposed to configuring this option as an argument for the NewRouter
function:
Running the code above will result in the same solution as before.