Reference documentation and code samples for the Google Maps Route Optimization V1 Client class ConstraintRelaxation.
For a group of vehicles, specifies at what threshold(s) constraints on
visits will be relaxed and to which level. Shipments listed in
the skipped_shipment field are constrained to be skipped; i.e., they
cannot be performed.
Generated from protobuf message google.maps.routeoptimization.v1.InjectedSolutionConstraint.ConstraintRelaxation
Namespace
Google \ Maps \ RouteOptimization \ V1 \ InjectedSolutionConstraint
All the visit constraint relaxations that will apply to visits on routes with vehicles in vehicle_indices.
↳ vehicle_indices
array
Specifies the vehicle indices to which the visit constraint relaxations apply. If empty, this is considered the default and the relaxations apply to all vehicles that are not specified in other constraint_relaxations. There can be at most one default, i.e., at most one constraint relaxation field is allowed empty vehicle_indices. A vehicle index can only be listed once, even within several constraint_relaxations. A vehicle index is mapped the same as ShipmentRoute.vehicle_index, if interpret_injected_solutions_using_labels is true (see fields comment).
getRelaxations
All the visit constraint relaxations that will apply to visits on
routes with vehicles in vehicle_indices.
Specifies the vehicle indices to which the visit constraint
relaxations apply. If empty, this is considered the default and the
relaxations apply to all vehicles that are not specified in other
constraint_relaxations. There can be at most one default, i.e., at
most one constraint relaxation field is allowed empty
vehicle_indices. A vehicle index can only be listed once, even within
several constraint_relaxations.
A vehicle index is mapped the same as
ShipmentRoute.vehicle_index,
if interpret_injected_solutions_using_labels is true (see fields
comment).
Specifies the vehicle indices to which the visit constraint
relaxations apply. If empty, this is considered the default and the
relaxations apply to all vehicles that are not specified in other
constraint_relaxations. There can be at most one default, i.e., at
most one constraint relaxation field is allowed empty
vehicle_indices. A vehicle index can only be listed once, even within
several constraint_relaxations.
A vehicle index is mapped the same as
ShipmentRoute.vehicle_index,
if interpret_injected_solutions_using_labels is true (see fields
comment).
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Google Maps Route Optimization V1 Client - Class ConstraintRelaxation (0.4.1)\n\nVersion latestkeyboard_arrow_down\n\n- [0.4.1 (latest)](/php/docs/reference/maps-routeoptimization/latest/V1.InjectedSolutionConstraint.ConstraintRelaxation)\n- [0.4.0](/php/docs/reference/maps-routeoptimization/0.4.0/V1.InjectedSolutionConstraint.ConstraintRelaxation)\n- [0.3.3](/php/docs/reference/maps-routeoptimization/0.3.3/V1.InjectedSolutionConstraint.ConstraintRelaxation)\n- [0.2.0](/php/docs/reference/maps-routeoptimization/0.2.0/V1.InjectedSolutionConstraint.ConstraintRelaxation)\n- [0.1.0](/php/docs/reference/maps-routeoptimization/0.1.0/V1.InjectedSolutionConstraint.ConstraintRelaxation) \nReference documentation and code samples for the Google Maps Route Optimization V1 Client class ConstraintRelaxation.\n\nFor a group of vehicles, specifies at what threshold(s) constraints on\nvisits will be relaxed and to which level. Shipments listed in\nthe `skipped_shipment` field are constrained to be skipped; i.e., they\ncannot be performed.\n\nGenerated from protobuf message `google.maps.routeoptimization.v1.InjectedSolutionConstraint.ConstraintRelaxation`\n\nNamespace\n---------\n\nGoogle \\\\ Maps \\\\ RouteOptimization \\\\ V1 \\\\ InjectedSolutionConstraint\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getRelaxations\n\nAll the visit constraint relaxations that will apply to visits on\nroutes with vehicles in `vehicle_indices`.\n\n### setRelaxations\n\nAll the visit constraint relaxations that will apply to visits on\nroutes with vehicles in `vehicle_indices`.\n\n### getVehicleIndices\n\nSpecifies the vehicle indices to which the visit constraint\n`relaxations` apply. If empty, this is considered the default and the\n`relaxations` apply to all vehicles that are not specified in other\n`constraint_relaxations`. There can be at most one default, i.e., at\nmost one constraint relaxation field is allowed empty\n`vehicle_indices`. A vehicle index can only be listed once, even within\nseveral `constraint_relaxations`.\n\nA vehicle index is mapped the same as\n[ShipmentRoute.vehicle_index](/php/docs/reference/maps-routeoptimization/latest/V1.ShipmentRoute#_Google_Maps_RouteOptimization_V1_ShipmentRoute__getVehicleIndex__),\nif `interpret_injected_solutions_using_labels` is true (see `fields`\ncomment).\n\n### setVehicleIndices\n\nSpecifies the vehicle indices to which the visit constraint\n`relaxations` apply. If empty, this is considered the default and the\n`relaxations` apply to all vehicles that are not specified in other\n`constraint_relaxations`. There can be at most one default, i.e., at\nmost one constraint relaxation field is allowed empty\n`vehicle_indices`. A vehicle index can only be listed once, even within\nseveral `constraint_relaxations`.\n\nA vehicle index is mapped the same as\n[ShipmentRoute.vehicle_index](/php/docs/reference/maps-routeoptimization/latest/V1.ShipmentRoute#_Google_Maps_RouteOptimization_V1_ShipmentRoute__getVehicleIndex__),\nif `interpret_injected_solutions_using_labels` is true (see `fields`\ncomment)."]]