A reference for the options to configure vehicle routing.

If both an environment variable and its corresponding CLI flag are defined, the CLI flag will overwrite the environment variable.

These are the default options that are available with vehicle routing.

Nextmv Hybrid Optimization Platform VERSION
  -check.duration duration
    	maximum duration of the check (env CHECK_DURATION) (default 30s)
  -check.verbosity string
    	{off, low, medium, high} verbosity of the check (env CHECK_VERBOSITY) (default "off")
    	disable the progression series (env FORMAT_DISABLE_PROGRESSION)
    	ignore the compatibility attributes constraint (env MODEL_CONSTRAINTS_DISABLE_ATTRIBUTES)
  -model.constraints.disable.capacities value
    	ignore the capacity constraint for the given resource names (env MODEL_CONSTRAINTS_DISABLE_CAPACITIES)
    	ignore the capacity constraint for all resources (env MODEL_CONSTRAINTS_DISABLE_CAPACITY)
    	ignore the distance limit constraint (env MODEL_CONSTRAINTS_DISABLE_DISTANCE_LIMIT)
    	ignore the groups constraint (env MODEL_CONSTRAINTS_DISABLE_GROUPS)
    	ignore the maximum duration constraint (env MODEL_CONSTRAINTS_DISABLE_MAXIMUM_DURATION)
    	ignore the maximum stops constraint (env MODEL_CONSTRAINTS_DISABLE_MAXIMUM_STOPS)
    	ignore the maximum stop wait constraint (env MODEL_CONSTRAINTS_DISABLE_MAXIMUM_WAIT_STOP)
    	ignore the maximum vehicle wait constraint (env MODEL_CONSTRAINTS_DISABLE_MAXIMUM_WAIT_VEHICLE)
    	ignore the do not mix items constraint (env MODEL_CONSTRAINTS_DISABLE_MIXING_ITEMS)
    	ignore the precedence (pickups & deliveries) constraint (env MODEL_CONSTRAINTS_DISABLE_PRECEDENCE)
    	ignore the start time windows constraint (env MODEL_CONSTRAINTS_DISABLE_START_TIME_WINDOWS)
    	ignore the vehicle end time constraint (env MODEL_CONSTRAINTS_DISABLE_VEHICLE_END_TIME)
    	ignore the vehicle start time constraint (env MODEL_CONSTRAINTS_DISABLE_VEHICLE_START_TIME)
    	enable the cluster constraint (env MODEL_CONSTRAINTS_ENABLE_CLUSTER)
  -model.objectives.capacities string
    	capacity objective, provide triple for each resource 'name:default;factor:1.0;offset;0.0' (env MODEL_OBJECTIVES_CAPACITIES)
  -model.objectives.cluster float
    	factor to weigh the cluster objective (env MODEL_OBJECTIVES_CLUSTER)
  -model.objectives.earlyarrivalpenalty float
    	factor to weigh the early arrival objective (env MODEL_OBJECTIVES_EARLY_ARRIVAL_PENALTY) (default 1)
  -model.objectives.latearrivalpenalty float
    	factor to weigh the late arrival objective (env MODEL_OBJECTIVES_LATE_ARRIVAL_PENALTY) (default 1)
  -model.objectives.minstops float
    	factor to weigh the min stops objective (env MODEL_OBJECTIVES_MIN_STOPS) (default 1)
  -model.objectives.travelduration float
    	factor to weigh the travel duration objective (env MODEL_OBJECTIVES_TRAVEL_DURATION)
  -model.objectives.unplannedpenalty float
    	factor to weigh the unplanned objective (env MODEL_OBJECTIVES_UNPLANNED_PENALTY) (default 1)
  -model.objectives.vehicleactivationpenalty float
    	factor to weigh the vehicle activation objective (env MODEL_OBJECTIVES_VEHICLE_ACTIVATION_PENALTY) (default 1)
  -model.objectives.vehiclesduration float
    	factor to weigh the vehicles duration objective (env MODEL_OBJECTIVES_VEHICLES_DURATION) (default 1)
    	ignore the durations groups of stops (env MODEL_PROPERTIES_DISABLE_DURATION_GROUPS)
    	ignore the durations of stops (env MODEL_PROPERTIES_DISABLE_DURATIONS)
    	ignore the initial solution (env MODEL_PROPERTIES_DISABLE_INITIAL_SOLUTION)
    	ignore the stop duration multipliers defined on vehicles (env MODEL_PROPERTIES_DISABLE_STOP_DURATION_MULTIPLIERS)
    	disable the resources validation (env MODEL_VALIDATE_DISABLE_RESOURCES)
    	disable the start time validation (env MODEL_VALIDATE_DISABLE_START_TIME)
    	enable matrix validation (env MODEL_VALIDATE_ENABLE_MATRIX)
  -model.validate.enable.matrixasymmetrytolerance int
    	percentage of acceptable matrix asymmetry, requires matrix validation enabled (env MODEL_VALIDATE_ENABLE_MATRIX_ASYMMETRY_TOLERANCE) (default 20)
  -runner.input.path string
    	The input file path (env RUNNER_INPUT_PATH)
  -runner.output.path string
    	The output file path (env RUNNER_OUTPUT_PATH) string
    	{all, last} (env RUNNER_OUTPUT_SOLUTIONS) (default "last")
  -runner.profile.cpu string
    	The CPU profile file path (env RUNNER_PROFILE_CPU)
  -runner.profile.memory string
    	The memory profile file path (env RUNNER_PROFILE_MEMORY)
  -solve.duration duration
    	maximum duration of the solver (env SOLVE_DURATION) (default 30s)
  -solve.iterations int
    	maximum number of iterations, -1 assumes no limit; iterations are counted after start solutions are generated (env SOLVE_ITERATIONS) (default -1)
  -solve.parallelruns int
    	maximum number of parallel runs, -1 results in using all available resources (env SOLVE_PARALLEL_RUNS) (default -1)
    	run the parallel solver deterministically (env SOLVE_RUN_DETERMINISTICALLY)
  -solve.startsolutions int
    	number of solutions to generate on top of those passed in; one solution generated with sweep algorithm, the rest generated randomly (env SOLVE_START_SOLUTIONS) (default -1)

Valid time units for -solve.duration are as follows, according to time.ParseDuration from Go's standard library:

  • ns (nanoseconds)
  • us/µs (microseconds)
  • ms (milliseconds)
  • s (seconds)
  • m (minutes)
  • h (hours)

The solve duration is displayed in ns in the output.

The options are marshalled to the output when running an app, under the options key. Here is an example of how the options are displayed.

  "model": {
    "constraints": {
      "disable": {
        "attributes": false,
        "capacity": false,
        "capacities": null,
        "distance_limit": false,
        "groups": false,
        "maximum_duration": false,
        "maximum_stops": false,
        "maximum_wait_stop": false,
        "maximum_wait_vehicle": false,
        "mixing_items": false,
        "precedence": false,
        "vehicle_start_time": false,
        "vehicle_end_time": false,
        "start_time_windows": false
      "enable": {
        "cluster": false
    "objectives": {
      "capacities": "",
      "min_stops": 1,
      "early_arrival_penalty": 1,
      "late_arrival_penalty": 1,
      "vehicle_activation_penalty": 1,
      "travel_duration": 0,
      "vehicles_duration": 1,
      "unplanned_penalty": 1,
      "cluster": 0
    "properties": {
      "disable": {
        "durations": false,
        "stop_duration_multipliers": false,
        "duration_groups": false,
        "initial_solution": false
    "validate": {
      "disable": {
        "start_time": false,
        "resources": false
      "enable": {
        "matrix": false,
        "matrix_asymmetry_tolerance": 20
  "solve": {
    "iterations": 50,
    "duration": 10000000000,
    "parallel_runs": 1,
    "start_solutions": 1,
    "run_deterministically": true
  "format": {
    "disable": {
      "progression": true
  "check": {
    "duration": 30000000000,
    "verbosity": "off"

When working with platform, you may also modify the options in code, which would override the ones passed from the runner. Here is an example of how this is done and how the resulting output shows the modified options. Notice that options is modified multiple times inside the solver function.

// package main holds the implementation of the nextroute template.
package main

import (

	runSchema ""

func main() {
	runner := run.CLI(solver)
	err := runner.Run(context.Background())
	if err != nil {

type options struct {
	Model  factory.Options                `json:"model,omitempty"`
	Solve  nextroute.ParallelSolveOptions `json:"solve,omitempty"`
	Format nextroute.FormatOptions        `json:"format,omitempty"`
	Check  check.Options                  `json:"check,omitempty"`

func solver(
	ctx context.Context,
	input schema.Input,
	options options,
) (runSchema.Output, error) {
	// Customize options in the code.
	options.Model.Objectives.TravelDuration = 0.5
	options.Model.Objectives.UnplannedPenalty = 0.3
	options.Model.Constraints.Disable.Capacity = true
	options.Model.Constraints.Disable.Attributes = true
	options.Model.Constraints.Disable.Precedence = true
	options.Solve.Duration = time.Duration(11) * time.Second
	options.Solve.Iterations = 51
	options.Format.Disable.Progression = true

	model, err := factory.NewModel(input, options.Model)
	if err != nil {
		return runSchema.Output{}, err

	solver, err := nextroute.NewParallelSolver(model)
	if err != nil {
		return runSchema.Output{}, err

	solutions, err := solver.Solve(ctx, options.Solve)
	if err != nil {
		return runSchema.Output{}, err
	last := solutions.Last()

	output, err := check.Format(ctx, options, options.Check, solver, last)
	if err != nil {
		return runSchema.Output{}, err
	output.Statistics.Result.Custom = factory.DefaultCustomResultStatistics(last)

	return output, nil

Page last updated