Features

Stop balancing objective

A how-to guide for using the stop balancing objective with vehicle routing.

This feature is configurable via options for both custom and marketplace routing applications. You can find a list of all available features here.

This how-to guide assumes you already completed the get started with vehicle routing tutorial.

The stop balancing objective is used to encourage stop balancing of routes. This objective penalizes the longest route in the solution while during search it tries to not make the longest route any longer.

To enable the stop balancing objective and set the penalty to, say 1000, you can run with the following option model.objectives.stopbalancing 1000.0. See options for specifying options for both remote and local runs. The higher the penalty, the more the solver will try to balance the stops between vehicles.

For custom apps, you can enable the option in code as follows:

    options.Model.Objectives.StopBalancing = 1000.0

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

Page last updated