# Google Maps Route Optimization V1 Client - Class ConstraintRelaxation (0.6.2)

0.6.2 (latest) 0.6.1 0.5.1 0.4.1 0.3.3 0.2.0 0.1.0 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

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ relaxations` | `array<https://docs.cloud.google.com/php/docs/reference/maps-routeoptimization/latest/V1.InjectedSolutionConstraint.ConstraintRelaxation.Relaxation>` All the visit constraint relaxations that will apply to visits on routes with vehicles in `vehicle_indices`. |
| `↳ vehicle_indices` | `int[]` 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](https://docs.cloud.google.com/php/docs/reference/maps-routeoptimization/latest/V1.ShipmentRoute#_Google_Maps_RouteOptimization_V1_ShipmentRoute__getVehicleIndex__), 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`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/maps-routeoptimization/latest/V1.InjectedSolutionConstraint.ConstraintRelaxation.Relaxation>` |   |

### setRelaxations

All the visit constraint relaxations that will apply to visits on
routes with vehicles in `vehicle_indices`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/maps-routeoptimization/latest/V1.InjectedSolutionConstraint.ConstraintRelaxation.Relaxation>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getVehicleIndices

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](https://docs.cloud.google.com/php/docs/reference/maps-routeoptimization/latest/V1.ShipmentRoute#_Google_Maps_RouteOptimization_V1_ShipmentRoute__getVehicleIndex__),
if `interpret_injected_solutions_using_labels` is true (see `fields`
comment).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<int>` |   |

### setVehicleIndices

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](https://docs.cloud.google.com/php/docs/reference/maps-routeoptimization/latest/V1.ShipmentRoute#_Google_Maps_RouteOptimization_V1_ShipmentRoute__getVehicleIndex__),
if `interpret_injected_solutions_using_labels` is true (see `fields`
comment).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int[]` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |