# Google Cloud Optimization V1 Client - Class ConstraintRelaxation (1.1.3)

1.1.3 (latest) 1.1.2 1.0.5 0.7.0 0.6.5 0.5.1 0.4.0 0.3.4 0.2.0 0.1.9 Reference documentation and code samples for the Google Cloud 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.cloud.optimization.v1.InjectedSolutionConstraint.ConstraintRelaxation`

## Namespace

Google \\ Cloud \\ Optimization \\ 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/cloud-optimization/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/cloud-optimization/latest/V1.ShipmentRoute#_Google_Cloud_Optimization_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/cloud-optimization/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/cloud-optimization/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/cloud-optimization/latest/V1.ShipmentRoute#_Google_Cloud_Optimization_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/cloud-optimization/latest/V1.ShipmentRoute#_Google_Cloud_Optimization_V1_ShipmentRoute__getVehicleIndex__),
if `interpret_injected_solutions_using_labels` is true (see `fields`
comment).

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

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