Documentation
¶
Overview ¶
Package schema provides the input and output schema for nextroute.
Package schema provides the input and output schema for nextroute.
Package schema provides the input and output schema for nextroute.
Package schema provides the input and output schema for nextroute.
Index ¶
- func ConvertCustomData[T any](data any) (T, error)
- type AlternateStop
- type CustomResultStatistics
- type Defaults
- type DurationGroup
- type FleetDefaults
- type FleetInput
- type FleetStop
- type FleetStopDefaults
- type FleetVehicle
- type FleetVehicleDefaults
- type InitialStop
- type Input
- type Limits
- type Location
- type ObjectiveOutput
- type Options
- type PlannedStopOutput
- type RouterInput
- type SolutionOutput
- type SolverOptions
- type Stop
- type StopDefaults
- type StopOutput
- type Vehicle
- type VehicleDefaults
- type VehicleOutput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertCustomData ¶ added in v0.24.1
ConvertCustomData converts the custom data into the given type. If the conversion fails, an error is returned.
Types ¶
type AlternateStop ¶ added in v0.30.0
type AlternateStop struct {
Quantity any `json:"quantity,omitempty"`
Duration *int `json:"duration,omitempty"`
CustomData any `json:"custom_data,omitempty"`
MaxWait *int `json:"max_wait,omitempty"`
StartTimeWindow any `json:"start_time_window,omitempty"`
UnplannedPenalty *int `json:"unplanned_penalty,omitempty"`
EarlyArrivalTimePenalty *float64 `json:"early_arrival_time_penalty,omitempty"`
LateArrivalTimePenalty *float64 `json:"late_arrival_time_penalty,omitempty"`
TargetArrivalTime *time.Time `json:"target_arrival_time,omitempty"`
ID string `json:"id,omitempty"`
Location Location `json:"location,omitempty"`
}
AlternateStop represents an alternate stop.
type CustomResultStatistics ¶ added in v0.26.0
type CustomResultStatistics struct {
// ActivatedVehicles is the number of vehicles that were used in the
// solution.
ActivatedVehicles int `json:"activated_vehicles"`
// UnplannedStops is the number of stops that were not planned in the
// solution.
UnplannedStops int `json:"unplanned_stops"`
// MaxTravelDuration is the maximum travel duration of a vehicle in the
// solution.
MaxTravelDuration int `json:"max_travel_duration"`
// MaxDuration is the maximum duration of a vehicle (including waiting
// times) in the solution.
MaxDuration int `json:"max_duration"`
// MinTravelDuration is the minimum travel duration of a vehicle in the
// solution, excluding vehicles that were not used.
MinTravelDuration int `json:"min_travel_duration"`
// MinDuration is the minimum duration of a vehicle (including waiting
// times) in the solution, excluding vehicles that were not used.
MinDuration int `json:"min_duration"`
// MaxStopsInRoute is the maximum number of stops in a vehicle's route in
// the solution. The start and end stops of the vehicle are not considered.
MaxStopsInVehicle int `json:"max_stops_in_vehicle"`
// MinStopsInRoute is the minimum number of stops in a vehicle's route in
// the solution. The start and end stops of the vehicle are not considered.
MinStopsInVehicle int `json:"min_stops_in_vehicle"`
}
CustomResultStatistics is an example of custom result statistics that can be added to the output and used in experiments.
type Defaults ¶
type Defaults struct {
Vehicles *VehicleDefaults `json:"vehicles,omitempty"`
Stops *StopDefaults `json:"stops,omitempty"`
}
Defaults contains default values for vehicles and stops.
type DurationGroup ¶ added in v0.25.0
type DurationGroup struct {
Group []string `json:"group,omitempty"`
Duration int `json:"duration,omitempty"`
}
DurationGroup represents a group of stops that get additional duration whenever a stop of the group is approached for the first time.
type FleetDefaults ¶ added in v0.29.0
type FleetDefaults struct {
Vehicles *FleetVehicleDefaults `json:"vehicles,omitempty"`
Stops *FleetStopDefaults `json:"stops,omitempty"`
}
FleetDefaults holds the fleet input default data. FleetInput schema. DEPRECATION NOTICE: this part of the API is deprecated and is no longer maintained. It will be deleted soon. Please use Defaults instead.
type FleetInput ¶ added in v0.29.0
type FleetInput struct {
Options *Options `json:"options,omitempty"`
Defaults *FleetDefaults `json:"defaults,omitempty"`
Vehicles []FleetVehicle `json:"vehicles,omitempty"`
Stops []FleetStop `json:"stops,omitempty"`
StopGroups [][]string `json:"stop_groups,omitempty"`
AlternateStops []FleetStop `json:"alternate_stops,omitempty"`
DurationGroups []DurationGroup `json:"duration_groups,omitempty"`
}
FleetInput schema. DEPRECATION NOTICE: this part of the API is deprecated and is no longer maintained. It will be deleted soon. Please use Input instead.
func (FleetInput) ToNextRoute ¶ added in v0.29.0
func (fleetInput FleetInput) ToNextRoute() (Input, error)
ToNextRoute converters a legacy cloud fleet input into nextroute input format.
type FleetStop ¶ added in v0.29.0
type FleetStop struct {
ID string `json:"id,omitempty"`
Position Location `json:"position,omitempty"`
UnassignedPenalty *int `json:"unassigned_penalty,omitempty"`
Quantity any `json:"quantity,omitempty"`
Precedes any `json:"precedes,omitempty"`
Succeeds any `json:"succeeds,omitempty"`
HardWindow *[]time.Time `json:"hard_window,omitempty"`
MaxWait *int `json:"max_wait,omitempty"`
StopDuration *int `json:"stop_duration,omitempty"`
TargetTime *time.Time `json:"target_time,omitempty"`
EarlinessPenalty *float64 `json:"earliness_penalty,omitempty"`
LatenessPenalty *float64 `json:"lateness_penalty,omitempty"`
CompatibilityAttributes *[]string `json:"compatibility_attributes,omitempty"`
// contains filtered or unexported fields
}
FleetStop holds the fleet input stop data. DEPRECATION NOTICE: this part of the API is deprecated and is no longer maintained. It will be deleted soon. Please use Stop instead.
type FleetStopDefaults ¶ added in v0.29.0
type FleetStopDefaults struct {
UnassignedPenalty *int `json:"unassigned_penalty,omitempty"`
Quantity any `json:"quantity,omitempty"`
HardWindow *[]time.Time `json:"hard_window,omitempty"`
MaxWait *int `json:"max_wait,omitempty"`
StopDuration *int `json:"stop_duration,omitempty"`
TargetTime *time.Time `json:"target_time,omitempty"`
EarlinessPenalty *float64 `json:"earliness_penalty,omitempty"`
LatenessPenalty *float64 `json:"lateness_penalty,omitempty"`
CompatibilityAttributes *[]string `json:"compatibility_attributes,omitempty"`
}
FleetStopDefaults holds the fleet input stop default data. DEPRECATION NOTICE: this part of the API is deprecated and is no longer maintained. It will be deleted soon. Please use StopDefaults instead.
type FleetVehicle ¶ added in v0.29.0
type FleetVehicle struct {
ID string `json:"id,omitempty"`
Start *Location `json:"start,omitempty"`
End *Location `json:"end,omitempty"`
Speed *float64 `json:"speed,omitempty"`
Capacity any `json:"capacity,omitempty"`
ShiftStart *time.Time `json:"shift_start,omitempty"`
ShiftEnd *time.Time `json:"shift_end,omitempty"`
CompatibilityAttributes []string `json:"compatibility_attributes,omitempty"`
MaxStops *int `json:"max_stops,omitempty"`
MaxDistance *int `json:"max_distance,omitempty"`
MaxDuration *int `json:"max_duration,omitempty"`
StopDurationMultiplier *float64 `json:"stop_duration_multiplier,omitempty"`
Backlog []string `json:"backlog,omitempty"`
AlternateStops []string `json:"alternate_stops,omitempty"`
InitializationCost int `json:"initialization_cost,omitempty"`
// contains filtered or unexported fields
}
FleetVehicle holds the fleet input vehicle data. DEPRECATION NOTICE: this part of the API is deprecated and is no longer maintained. It will be deleted soon. Please use Vehicle instead.
type FleetVehicleDefaults ¶ added in v0.29.0
type FleetVehicleDefaults struct {
Start *Location `json:"start,omitempty"`
End *Location `json:"end,omitempty"`
Speed *float64 `json:"speed,omitempty"`
Capacity any `json:"capacity,omitempty"`
ShiftStart *time.Time `json:"shift_start,omitempty"`
ShiftEnd *time.Time `json:"shift_end,omitempty"`
CompatibilityAttributes []string `json:"compatibility_attributes,omitempty"`
MaxStops *int `json:"max_stops,omitempty"`
MaxDistance *int `json:"max_distance,omitempty"`
MaxDuration *int `json:"max_duration,omitempty"`
}
FleetVehicleDefaults holds the fleet input vehicle default data. FleetInput schema. DEPRECATION NOTICE: this part of the API is deprecated and is no longer maintained. It will be deleted soon. Please use VehicleDefaults instead.
type InitialStop ¶ added in v0.23.9
InitialStop represents an initial stop.
type Input ¶
type Input struct {
Options any `json:"options,omitempty"`
CustomData any `json:"custom_data,omitempty"`
Defaults *Defaults `json:"defaults,omitempty"`
StopGroups *[][]string `json:"stop_groups,omitempty"`
DurationMatrix *[][]float64 `json:"duration_matrix,omitempty"`
DistanceMatrix *[][]float64 `json:"distance_matrix,omitempty"`
DurationGroups *[]DurationGroup `json:"duration_groups,omitempty"`
Vehicles []Vehicle `json:"vehicles,omitempty"`
Stops []Stop `json:"stops,omitempty"`
AlternateStops *[]AlternateStop `json:"alternate_stops,omitempty"`
}
Input is the default input schema for nextroute.
func RouterToNextRoute ¶
func RouterToNextRoute(routerInput RouterInput) Input
RouterToNextRoute transforms router input to nextroute input.
type Limits ¶ added in v0.29.0
type Limits struct {
Duration string `json:"duration,omitempty"`
}
Limits represent the solver runtime limitation in fleet. DEPRECATION NOTICE: this part of the API is deprecated and is no longer maintained. It will be deleted soon. Please use [solve.Options] instead.
type ObjectiveOutput ¶ added in v0.23.8
type ObjectiveOutput struct {
Name string `json:"name"`
Objectives []ObjectiveOutput `json:"objectives,omitempty"`
Factor float64 `json:"factor,omitempty"`
Base float64 `json:"base,omitempty"`
Value float64 `json:"value"`
CustomData any `json:"custom_data,omitempty"`
}
ObjectiveOutput represents an objective as JSON.
type Options ¶ added in v0.29.0
type Options struct {
Solver *SolverOptions `json:"solver,omitempty"`
}
Options adds solver options to the input. DEPRECATION NOTICE: this part of the API is deprecated and is no longer maintained. It will be deleted soon. Please use [solve.Options] instead.
type PlannedStopOutput ¶ added in v0.23.8
type PlannedStopOutput struct {
Stop StopOutput `json:"stop"`
TravelDuration int `json:"travel_duration"`
CumulativeTravelDuration int `json:"cumulative_travel_duration"`
TravelDistance int `json:"travel_distance,omitempty"`
CumulativeTravelDistance int `json:"cumulative_travel_distance,omitempty"`
TargetArrivalTime *time.Time `json:"target_arrival_time,omitempty"`
ArrivalTime *time.Time `json:"arrival_time,omitempty"`
WaitingDuration int `json:"waiting_duration,omitempty"`
StartTime *time.Time `json:"start_time,omitempty"`
Duration int `json:"duration,omitempty"`
EndTime *time.Time `json:"end_time,omitempty"`
EarlyArrivalDuration int `json:"early_arrival_duration,omitempty"`
LateArrivalDuration int `json:"late_arrival_duration,omitempty"`
CustomData any `json:"custom_data,omitempty"`
}
PlannedStopOutput adds information to the input stop.
type RouterInput ¶
type RouterInput struct {
Stops []route.Stop `json:"stops"`
Vehicles []string `json:"vehicles"`
InitializationCosts []float64 `json:"initialization_costs"`
Starts []Location `json:"starts"`
Ends []Location `json:"ends"`
Quantities []int `json:"quantities"`
Capacities []int `json:"capacities"`
Precedences []route.Job `json:"precedences"`
Windows []route.Window `json:"windows"`
Shifts []route.TimeWindow `json:"shifts"`
Penalties []int `json:"penalties"`
Backlogs []route.Backlog `json:"backlogs"`
VehicleAttributes []route.Attributes `json:"vehicle_attributes"`
StopAttributes []route.Attributes `json:"stop_attributes"`
Velocities []float64 `json:"velocities"`
Groups [][]string `json:"groups"`
ServiceTimes []route.Service `json:"service_times"`
AlternateStops []route.Alternate `json:"alternate_stops"`
Limits []route.Limit `json:"limits"`
DurationLimits []float64 `json:"duration_limits"`
DistanceLimits []float64 `json:"distance_limits"`
ServiceGroups []route.ServiceGroup `json:"service_groups"`
}
RouterInput is the schema for the input of router.
type SolutionOutput ¶ added in v0.23.8
type SolutionOutput struct {
Unplanned []StopOutput `json:"unplanned"`
Vehicles []VehicleOutput `json:"vehicles"`
Objective ObjectiveOutput `json:"objective"`
Check *check.Output `json:"check,omitempty"`
}
SolutionOutput represents a solutions as JSON.
type SolverOptions ¶ added in v0.29.0
type SolverOptions struct {
Limits *Limits `json:"limits,omitempty"`
}
SolverOptions represent the solver runtime duration in legacy fleet. DEPRECATION NOTICE: this part of the API is deprecated and is no longer maintained. It will be deleted soon. Please use [solve.Options] instead.
type Stop ¶
type Stop struct {
Precedes any `json:"precedes,omitempty"`
Quantity any `json:"quantity,omitempty"`
Succeeds any `json:"succeeds,omitempty"`
CustomData any `json:"custom_data,omitempty"`
Duration *int `json:"duration,omitempty"`
MaxWait *int `json:"max_wait,omitempty"`
StartTimeWindow any `json:"start_time_window,omitempty"`
UnplannedPenalty *int `json:"unplanned_penalty,omitempty"`
EarlyArrivalTimePenalty *float64 `json:"early_arrival_time_penalty,omitempty"`
LateArrivalTimePenalty *float64 `json:"late_arrival_time_penalty,omitempty"`
CompatibilityAttributes *[]string `json:"compatibility_attributes,omitempty"`
TargetArrivalTime *time.Time `json:"target_arrival_time,omitempty"`
ID string `json:"id,omitempty"`
Location Location `json:"location,omitempty"`
}
Stop represents a stop.
type StopDefaults ¶
type StopDefaults struct {
UnplannedPenalty *int `json:"unplanned_penalty,omitempty"`
Quantity any `json:"quantity,omitempty"`
StartTimeWindow any `json:"start_time_window,omitempty"`
MaxWait *int `json:"max_wait,omitempty"`
Duration *int `json:"duration,omitempty"`
TargetArrivalTime *time.Time `json:"target_arrival_time,omitempty"`
EarlyArrivalTimePenalty *float64 `json:"early_arrival_time_penalty,omitempty"`
LateArrivalTimePenalty *float64 `json:"late_arrival_time_penalty,omitempty"`
CompatibilityAttributes *[]string `json:"compatibility_attributes,omitempty"`
}
StopDefaults contains default values for stops.
type StopOutput ¶
type StopOutput struct {
ID string `json:"id"`
Location Location `json:"location"`
CustomData any `json:"custom_data,omitempty"`
}
StopOutput is the basic struct for a stop.
type Vehicle ¶
type Vehicle struct {
Capacity any `json:"capacity,omitempty"`
StartLevel any `json:"start_level,omitempty"`
CustomData any `json:"custom_data,omitempty"`
CompatibilityAttributes *[]string `json:"compatibility_attributes,omitempty"`
MaxDistance *int `json:"max_distance,omitempty"`
StopDurationMultiplier *float64 `json:"stop_duration_multiplier,omitempty"`
StartTime *time.Time `json:"start_time,omitempty"`
EndTime *time.Time `json:"end_time,omitempty"`
EndLocation *Location `json:"end_location,omitempty"`
MinStops *int `json:"min_stops,omitempty"`
MinStopsPenalty *float64 `json:"min_stops_penalty,omitempty"`
MaxStops *int `json:"max_stops,omitempty"`
Speed *float64 `json:"speed,omitempty"`
MaxDuration *int `json:"max_duration,omitempty"`
MaxWait *int `json:"max_wait,omitempty"`
ActivationPenalty *int `json:"activation_penalty,omitempty"`
StartLocation *Location `json:"start_location,omitempty"`
AlternateStops *[]string `json:"alternate_stops,omitempty"`
InitialStops *[]InitialStop `json:"initial_stops,omitempty"`
ID string `json:"id,omitempty"`
}
Vehicle represents a vehicle.
type VehicleDefaults ¶
type VehicleDefaults struct {
Capacity any `json:"capacity,omitempty"`
StartLevel any `json:"start_level,omitempty"`
StartLocation *Location `json:"start_location,omitempty"`
EndLocation *Location `json:"end_location,omitempty"`
Speed *float64 `json:"speed,omitempty"`
StartTime *time.Time `json:"start_time,omitempty"`
EndTime *time.Time `json:"end_time,omitempty"`
MinStops *int `json:"min_stops,omitempty"`
MinStopsPenalty *float64 `json:"min_stops_penalty,omitempty"`
MaxStops *int `json:"max_stops,omitempty"`
MaxDistance *int `json:"max_distance,omitempty"`
MaxDuration *int `json:"max_duration,omitempty"`
MaxWait *int `json:"max_wait,omitempty"`
CompatibilityAttributes *[]string `json:"compatibility_attributes,omitempty"`
ActivationPenalty *int `json:"activation_penalty,omitempty"`
AlternateStops *[]string `json:"alternate_stops,omitempty"`
}
VehicleDefaults contains default values for vehicles.
type VehicleOutput ¶
type VehicleOutput struct {
ID string `json:"id"`
Route []PlannedStopOutput `json:"route"`
RouteTravelDuration int `json:"route_travel_duration"`
RouteTravelDistance int `json:"route_travel_distance,omitempty"`
RouteStopsDuration int `json:"route_stops_duration,omitempty"`
RouteWaitingDuration int `json:"route_waiting_duration,omitempty"`
RouteDuration int `json:"route_duration"`
CustomData any `json:"custom_data,omitempty"`
AlternateStops *[]string `json:"alternate_stops,omitempty"`
}
VehicleOutput holds the solution of the ModelVehicle Routing Problem.