factory

package
v0.27.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package factory is a package containing factory functions for creating next-route models.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultCustomResultStatistics added in v0.26.0

func DefaultCustomResultStatistics(solution nextroute.Solution) schema.CustomResultStatistics

DefaultCustomResultStatistics creates default custom statistics for a given solution.

func Format added in v0.26.0

func Format(
	ctx context.Context,
	options any,
	progressioner alns.Progressioner,
	solutions ...nextroute.Solution,
) runSchema.Output

Format formats a solution in a basic format using the schema.Output to format a solution.

func NewModel

func NewModel(
	input schema.Input,
	modelOptions Options,
) (nextroute.Model, error)

NewModel builds a ready-to-go vehicle routing problem. The difference with nextroute.NewModel is that NewModel processes the input and options to add all features to the model, such as constraints and objectives. On the other hand, nextroute.NewModel creates an empty vehicle routing model which must be built from the ground up.

Types

type Options added in v0.23.1

type Options struct {
	Constraints struct {
		Disable struct {
			Attributes         bool `json:"attributes" usage:"ignore the compatibility attributes constraint"`
			Capacity           bool `json:"capacity" usage:"ignore the capacity constraint"`
			DistanceLimit      bool `json:"distance_limit" usage:"ignore the distance limit constraint"`
			Groups             bool `json:"groups" usage:"ignore the groups constraint"`
			MaximumDuration    bool `json:"maximum_duration" usage:"ignore the maximum duration constraint"`
			MaximumStops       bool `json:"maximum_stops" usage:"ignore the maximum stops constraint"`
			MaximumWaitStop    bool `json:"maximum_wait_stop" usage:"ignore the maximum stop wait constraint"`
			MaximumWaitVehicle bool `json:"maximum_wait_vehicle" usage:"ignore the maximum vehicle wait constraint"`
			Precedence         bool `json:"precedence" usage:"ignore the precedence (pickups & deliveries) constraint"`
			VehicleStartTime   bool `json:"vehicle_start_time" usage:"ignore the vehicle start time constraint"`
			VehicleEndTime     bool `json:"vehicle_end_time" usage:"ignore the vehicle end time constraint"`
			StartTimeWindows   bool `json:"start_time_windows" usage:"ignore the start time windows constraint"`
		} `json:"disable"`
		Enable struct {
			Cluster bool `json:"cluster" usage:"enable the cluster constraint"`
		} `json:"enable"`
	} `json:"constraints"`
	Objectives struct {
		MinStops                 float64 `json:"min_stops" usage:"factor to weigh the min stops objective" default:"0.0"`
		EarlyArrivalPenalty      float64 `json:"early_arrival_penalty" usage:"factor to weigh the early arrival objective" default:"1.0"`
		LateArrivalPenalty       float64 `json:"late_arrival_penalty" usage:"factor to weigh the late arrival objective" default:"1.0"`
		VehicleActivationPenalty float64 `json:"vehicle_activation_penalty" usage:"factor to weigh the vehicle activation objective" default:"1.0"`
		TravelDuration           float64 `json:"travel_duration" usage:"factor to weigh the travel duration objective" default:"0.0"`
		VehiclesDuration         float64 `json:"vehicles_duration" usage:"factor to weigh the vehicles duration objective" default:"1.0"`
		UnplannedPenalty         float64 `json:"unplanned_penalty" usage:"factor to weigh the unplanned objective" default:"1.0"`
		Cluster                  float64 `json:"cluster" usage:"factor to weigh the cluster objective" default:"0.0"`
	} `json:"objectives"`
	Properties struct {
		Disable struct {
			Durations               bool `json:"durations" usage:"ignore the durations of stops"`
			StopDurationMultipliers bool `json:"stop_duration_multipliers" usage:"ignore the stop duration multipliers defined on vehicles"`
			DurationGroups          bool `json:"duration_groups" usage:"ignore the durations groups of stops"`
			InitialSolution         bool `json:"initial_solution" usage:"ignore the initial solution"`
		} `json:"disable"`
	} `json:"properties"`
	Validate struct {
		Disable struct {
			StartTime bool `json:"start_time" usage:"disable the start time validation" default:"false"`
			Resources bool `json:"resources" usage:"disable the resources validation" default:"false"`
		} `json:"disable"`
		Enable struct {
			Matrix                   bool `json:"matrix" usage:"enable matrix validation" default:"false"`
			MatrixAsymmetryTolerance int  `` /* 132-byte string literal not displayed */
		} `json:"enable"`
	} `json:"validate"`
}

Options configure how the NewModel function builds nextroute.Model.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL