Reference documentation and code samples for the Cloud Optimization V1 API class Google::Cloud::Optimization::V1::InjectedSolutionConstraint::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.
(::Array<::Integer>) — 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).
#vehicle_indices=
defvehicle_indices=(value)->::Array<::Integer>
Parameter
value (::Array<::Integer>) — 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).
Returns
(::Array<::Integer>) — 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-09 UTC."],[],[],null,["# Cloud Optimization V1 API - Class Google::Cloud::Optimization::V1::InjectedSolutionConstraint::ConstraintRelaxation (v0.12.0)\n\nVersion latestkeyboard_arrow_down\n\n- [0.12.0 (latest)](/ruby/docs/reference/google-cloud-optimization-v1/latest/Google-Cloud-Optimization-V1-InjectedSolutionConstraint-ConstraintRelaxation)\n- [0.11.1](/ruby/docs/reference/google-cloud-optimization-v1/0.11.1/Google-Cloud-Optimization-V1-InjectedSolutionConstraint-ConstraintRelaxation)\n- [0.10.0](/ruby/docs/reference/google-cloud-optimization-v1/0.10.0/Google-Cloud-Optimization-V1-InjectedSolutionConstraint-ConstraintRelaxation)\n- [0.9.2](/ruby/docs/reference/google-cloud-optimization-v1/0.9.2/Google-Cloud-Optimization-V1-InjectedSolutionConstraint-ConstraintRelaxation)\n- [0.8.2](/ruby/docs/reference/google-cloud-optimization-v1/0.8.2/Google-Cloud-Optimization-V1-InjectedSolutionConstraint-ConstraintRelaxation)\n- [0.7.0](/ruby/docs/reference/google-cloud-optimization-v1/0.7.0/Google-Cloud-Optimization-V1-InjectedSolutionConstraint-ConstraintRelaxation)\n- [0.6.0](/ruby/docs/reference/google-cloud-optimization-v1/0.6.0/Google-Cloud-Optimization-V1-InjectedSolutionConstraint-ConstraintRelaxation)\n- [0.5.0](/ruby/docs/reference/google-cloud-optimization-v1/0.5.0/Google-Cloud-Optimization-V1-InjectedSolutionConstraint-ConstraintRelaxation)\n- [0.4.1](/ruby/docs/reference/google-cloud-optimization-v1/0.4.1/Google-Cloud-Optimization-V1-InjectedSolutionConstraint-ConstraintRelaxation)\n- [0.3.0](/ruby/docs/reference/google-cloud-optimization-v1/0.3.0/Google-Cloud-Optimization-V1-InjectedSolutionConstraint-ConstraintRelaxation)\n- [0.2.1](/ruby/docs/reference/google-cloud-optimization-v1/0.2.1/Google-Cloud-Optimization-V1-InjectedSolutionConstraint-ConstraintRelaxation)\n- [0.1.1](/ruby/docs/reference/google-cloud-optimization-v1/0.1.1/Google-Cloud-Optimization-V1-InjectedSolutionConstraint-ConstraintRelaxation) \nReference documentation and code samples for the Cloud Optimization V1 API class Google::Cloud::Optimization::V1::InjectedSolutionConstraint::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\nInherits\n--------\n\n- Object \n\nExtended By\n-----------\n\n- Google::Protobuf::MessageExts::ClassMethods \n\nIncludes\n--------\n\n- Google::Protobuf::MessageExts\n\nMethods\n-------\n\n### #relaxations\n\n def relaxations() -\u003e ::Array\u003c::Google::Cloud::Optimization::V1::InjectedSolutionConstraint::ConstraintRelaxation::Relaxation\u003e\n\n**Returns**\n\n- (::Array\\\u003c[::Google::Cloud::Optimization::V1::InjectedSolutionConstraint::ConstraintRelaxation::Relaxation](./Google-Cloud-Optimization-V1-InjectedSolutionConstraint-ConstraintRelaxation-Relaxation)\\\u003e) --- All the visit constraint relaxations that will apply to visits on routes with vehicles in `vehicle_indices`.\n\n### #relaxations=\n\n def relaxations=(value) -\u003e ::Array\u003c::Google::Cloud::Optimization::V1::InjectedSolutionConstraint::ConstraintRelaxation::Relaxation\u003e\n\n**Parameter**\n\n- **value** (::Array\\\u003c[::Google::Cloud::Optimization::V1::InjectedSolutionConstraint::ConstraintRelaxation::Relaxation](./Google-Cloud-Optimization-V1-InjectedSolutionConstraint-ConstraintRelaxation-Relaxation)\\\u003e) --- All the visit constraint relaxations that will apply to visits on routes with vehicles in `vehicle_indices`. \n**Returns**\n\n- (::Array\\\u003c[::Google::Cloud::Optimization::V1::InjectedSolutionConstraint::ConstraintRelaxation::Relaxation](./Google-Cloud-Optimization-V1-InjectedSolutionConstraint-ConstraintRelaxation-Relaxation)\\\u003e) --- All the visit constraint relaxations that will apply to visits on routes with vehicles in `vehicle_indices`.\n\n### #vehicle_indices\n\n def vehicle_indices() -\u003e ::Array\u003c::Integer\u003e\n\n**Returns**\n\n- (::Array\\\u003c::Integer\\\u003e) --- 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`.\n\n\n A vehicle index is mapped the same as\n [ShipmentRoute.vehicle_index](/ruby/docs/reference/google-cloud-optimization-v1/latest/Google-Cloud-Optimization-V1-ShipmentRoute#Google__Cloud__Optimization__V1__ShipmentRoute_vehicle_index_instance_ \"Google::Cloud::Optimization::V1::ShipmentRoute#vehicle_index (method)\"),\n if `interpret_injected_solutions_using_labels` is true (see `fields`\n comment).\n\n### #vehicle_indices=\n\n def vehicle_indices=(value) -\u003e ::Array\u003c::Integer\u003e\n\n**Parameter**\n\n- **value** (::Array\\\u003c::Integer\\\u003e) --- 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`.\n\n\n A vehicle index is mapped the same as\n [ShipmentRoute.vehicle_index](/ruby/docs/reference/google-cloud-optimization-v1/latest/Google-Cloud-Optimization-V1-ShipmentRoute#Google__Cloud__Optimization__V1__ShipmentRoute_vehicle_index_instance_ \"Google::Cloud::Optimization::V1::ShipmentRoute#vehicle_index (method)\"),\n if `interpret_injected_solutions_using_labels` is true (see `fields`\ncomment). \n**Returns**\n\n- (::Array\\\u003c::Integer\\\u003e) --- 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`.\n\n\n A vehicle index is mapped the same as\n [ShipmentRoute.vehicle_index](/ruby/docs/reference/google-cloud-optimization-v1/latest/Google-Cloud-Optimization-V1-ShipmentRoute#Google__Cloud__Optimization__V1__ShipmentRoute_vehicle_index_instance_ \"Google::Cloud::Optimization::V1::ShipmentRoute#vehicle_index (method)\"),\n if `interpret_injected_solutions_using_labels` is true (see `fields`\n comment)."]]