Class Vehicle.Types.LoadLimit.Types.LoadCost
Cost of moving one unit of load during a Transition.
For a given load, the cost is the sum of two parts:
- min(load,
load_threshold) *cost_per_unit_below_threshold - max(0, load -
load_threshold) *cost_per_unit_above_threshold
With this cost, solutions prefer to deliver high demands first, or equivalently pickup high demands last. For example, if a vehicle has
load_limit {
key: "weight"
value {
cost_per_kilometer {
load_threshold: 15
cost_per_unit_below_threshold: 2.0
cost_per_unit_above_threshold: 10.0
}
}
}
and its route is start,pickup,pickup,delivery,delivery,end with transitions:
transition { vehicle_load['weight'] { amount: 0 }
travel_distance_meters: 1000.0 }
transition { vehicle_load['weight'] { amount: 10 }
travel_distance_meters: 1000.0 }
transition { vehicle_load['weight'] { amount: 20 }
travel_distance_meters: 1000.0 }
transition { vehicle_load['weight'] { amount: 10 }
travel_distance_meters: 1000.0 }
transition { vehicle_load['weight'] { amount: 0 }
travel_distance_meters: 1000.0 }
then the cost incurred by this LoadCost is
(cost_below * load_below * kilometers + cost_above * load_above * kms)
- transition 0: 0.0
- transition 1: 2.0 * 10 * 1.0 + 10.0 * 0 * 1.0 = 20.0
- transition 2: 2.0 * 15 * 1.0 + 10.0 * (20 - 15) * 1.0 = 80.0
- transition 3: 2.0 * 10 * 1.0 + 10.0 * 0 * 1.0 = 20.0
- transition 4: 0.0
So the LoadCost over the route is 120.0.
However, if the route is start,pickup,delivery,pickup,delivery,end with transitions:
transition { vehicle_load['weight'] { amount: 0 }
travel_distance_meters: 1000.0 }
transition { vehicle_load['weight'] { amount: 10 }
travel_distance_meters: 1000.0 }
transition { vehicle_load['weight'] { amount: 0 }
travel_distance_meters: 1000.0 }
transition { vehicle_load['weight'] { amount: 10 }
travel_distance_meters: 1000.0 }
transition { vehicle_load['weight'] { amount: 0 }
travel_distance_meters: 1000.0 }
then the cost incurred by this LoadCost is
- transition 0: 0.0
- transition 1: 2.0 * 10 * 1.0 + 10.0 * 0 * 1.0 = 20.0
- transition 2: 0.0
- transition 3: 2.0 * 10 * 1.0 + 10.0 * 0 * 1.0 = 20.0
- transition 4: 0.0
Here the LoadCost over the route is 40.0.
LoadCost makes solutions with heavy-loaded transitions more expensive.
Experimental: See https://developers.google.com/maps/tt/route-optimization/experimental/load-cost/make-request for more details.
Implements
Namespace: Google.Maps.RouteOptimization.V1
Assembly: Google.Maps.RouteOptimization.V1.dll
Syntax
public sealed class Vehicle.Types.LoadLimit.Types.LoadCost : IMessage<Vehicle.Types.LoadLimit.Types.LoadCost>, IEquatable<Vehicle.Types.LoadLimit.Types.LoadCost>, IDeepCloneable<Vehicle.Types.LoadLimit.Types.LoadCost>, IBufferMessage, IMessage
Constructors
LoadCost()
Declaration
public LoadCost()
LoadCost(LoadCost)
Declaration
public LoadCost(Vehicle.Types.LoadLimit.Types.LoadCost other)
Parameters
| Type | Name | Description |
|---|---|---|
| Vehicle.Types.LoadLimit.Types.LoadCost | other |
Properties
CostPerUnitAboveThreshold
Cost of moving a unit of load, for each unit above threshold. In the special case threshold = 0, this is a fixed cost per unit. Must be a finite value, and >= 0.
Declaration
public double CostPerUnitAboveThreshold { get; set; }
Property Value
| Type | Description |
|---|---|
| double |
CostPerUnitBelowThreshold
Cost of moving a unit of load, for each unit between 0 and threshold. Must be a finite value, and >= 0.
Declaration
public double CostPerUnitBelowThreshold { get; set; }
Property Value
| Type | Description |
|---|---|
| double |
HasCostPerUnitAboveThreshold
Gets whether the "cost_per_unit_above_threshold" field is set
Declaration
public bool HasCostPerUnitAboveThreshold { get; }
Property Value
| Type | Description |
|---|---|
| bool |
HasCostPerUnitBelowThreshold
Gets whether the "cost_per_unit_below_threshold" field is set
Declaration
public bool HasCostPerUnitBelowThreshold { get; }
Property Value
| Type | Description |
|---|---|
| bool |
HasLoadThreshold
Gets whether the "load_threshold" field is set
Declaration
public bool HasLoadThreshold { get; }
Property Value
| Type | Description |
|---|---|
| bool |
LoadThreshold
Amount of load above which the cost of moving a unit of load changes from cost_per_unit_below_threshold to cost_per_unit_above_threshold. Must be >= 0.
Declaration
public long LoadThreshold { get; set; }
Property Value
| Type | Description |
|---|---|
| long |