Google Maps Route Optimization V1 Client - Class LoadCost (0.6.0)

Reference documentation and code samples for the Google Maps Route Optimization V1 Client class 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.

Generated from protobuf message google.maps.routeoptimization.v1.Vehicle.LoadLimit.LoadCost

Namespace

Google \ Maps \ RouteOptimization \ V1 \ Vehicle \ LoadLimit

Methods

__construct

Constructor.

Parameters
Name Description
data array

Optional. Data for populating the Message object.

↳ load_threshold int|string

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.

↳ cost_per_unit_below_threshold float

Cost of moving a unit of load, for each unit between 0 and threshold. Must be a finite value, and >= 0.

↳ cost_per_unit_above_threshold float

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.

getLoadThreshold

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.

Returns
Type Description
int|string

hasLoadThreshold

clearLoadThreshold

setLoadThreshold

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.

Parameter
Name Description
var int|string
Returns
Type Description
$this

getCostPerUnitBelowThreshold

Cost of moving a unit of load, for each unit between 0 and threshold.

Must be a finite value, and >= 0.

Returns
Type Description
float

hasCostPerUnitBelowThreshold

clearCostPerUnitBelowThreshold

setCostPerUnitBelowThreshold

Cost of moving a unit of load, for each unit between 0 and threshold.

Must be a finite value, and >= 0.

Parameter
Name Description
var float
Returns
Type Description
$this

getCostPerUnitAboveThreshold

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.

Returns
Type Description
float

hasCostPerUnitAboveThreshold

clearCostPerUnitAboveThreshold

setCostPerUnitAboveThreshold

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.

Parameter
Name Description
var float
Returns
Type Description
$this