Skip to content

Cluster objective

Info

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

The cluster objective is used to encourage cluster compactness of routes. As the engine assigns stops to vehicles, the objective encourages assignment to vehicles whose centroid is closer to a stop cluster than other vehicles. This can be useful if drivers have preferences to stay within a certain neighborhood/region after leaving the depot and are willing to drive longer distances if it means they can stick to a cluster of stops. Note, clustered routes can be handled with either this hard constraint or with the cluster constraint.

To enable the cluster objective and set the penalty to, say 1000, you can run with the following option model.objectives.cluster 1000.0. See options for specifying options for both remote and local runs. Note, clustered routes can be handled with either this hard constraint or with the cluster objective.

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

options.Model.Objectives.Cluster = 1000.0

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