# Google Cloud Optimization V1 Client - Class TimeWindow (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 TimeWindow.

Time windows constrain the time of an event, such as the arrival time at a
visit, or the start and end time of a vehicle.

Hard time window bounds, `start_time` and `end_time`, enforce the earliest
and latest time of the event, such that `start_time <= event_time <=
end_time`. The soft time window lower bound, `soft_start_time`, expresses a
preference for the event to happen at or after `soft_start_time` by incurring
a cost proportional to how long before soft_start_time the event occurs. The
soft time window upper bound, `soft_end_time`, expresses a preference for the
event to happen at or before `soft_end_time` by incurring a cost proportional
to how long after `soft_end_time` the event occurs. `start_time`, `end_time`,
`soft_start_time` and `soft_end_time` should be within the global time limits
(see
[ShipmentModel.global_start_time](https://docs.cloud.google.com/php/docs/reference/cloud-optimization/latest/V1.ShipmentModel#_Google_Cloud_Optimization_V1_ShipmentModel__getGlobalStartTime__)
and
[ShipmentModel.global_end_time](https://docs.cloud.google.com/php/docs/reference/cloud-optimization/latest/V1.ShipmentModel#_Google_Cloud_Optimization_V1_ShipmentModel__getGlobalEndTime__))
and should respect:

      0 <= `start_time` <= `soft_start_time` <= `end_time` and
      0 <= `start_time` <= `soft_end_time` <= `end_time`.

Generated from protobuf message `google.cloud.optimization.v1.TimeWindow`

## Namespace

Google \\ Cloud \\ Optimization \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ start_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` The hard time window start time. If unspecified it will be set to `ShipmentModel.global_start_time`. |
| `↳ end_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` The hard time window end time. If unspecified it will be set to `ShipmentModel.global_end_time`. |
| `↳ soft_start_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` The soft start time of the time window. |
| `↳ soft_end_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` The soft end time of the time window. |
| `↳ cost_per_hour_before_soft_start_time` | `float` A cost per hour added to other costs in the model if the event occurs before soft_start_time, computed as: `max(0, soft_start_time - t.seconds) * * cost_per_hour_before_soft_start_time / 3600, t being the time of the event.` This cost must be positive, and the field can only be set if soft_start_time has been set. |
| `↳ cost_per_hour_after_soft_end_time` | `float` A cost per hour added to other costs in the model if the event occurs after `soft_end_time`, computed as: `max(0, t.seconds - soft_end_time.seconds) * * cost_per_hour_after_soft_end_time / 3600, t being the time of the event.` This cost must be positive, and the field can only be set if `soft_end_time` has been set. |

### getStartTime

The hard time window start time. If unspecified it will be set to
`ShipmentModel.global_start_time`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp|null` |   |

### hasStartTime

### clearStartTime

### setStartTime

The hard time window start time. If unspecified it will be set to
`ShipmentModel.global_start_time`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` |

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

### getEndTime

The hard time window end time. If unspecified it will be set to
`ShipmentModel.global_end_time`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp|null` |   |

### hasEndTime

### clearEndTime

### setEndTime

The hard time window end time. If unspecified it will be set to
`ShipmentModel.global_end_time`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` |

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

### getSoftStartTime

The soft start time of the time window.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp|null` |   |

### hasSoftStartTime

### clearSoftStartTime

### setSoftStartTime

The soft start time of the time window.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` |

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

### getSoftEndTime

The soft end time of the time window.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp|null` |   |

### hasSoftEndTime

### clearSoftEndTime

### setSoftEndTime

The soft end time of the time window.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` |

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

### getCostPerHourBeforeSoftStartTime

A cost per hour added to other costs in the model if the event occurs
before soft_start_time, computed as:

       max(0, soft_start_time - t.seconds)
                              * cost_per_hour_before_soft_start_time / 3600,
    t being the time of the event.

This cost must be positive, and the field can only be set if
soft_start_time has been set.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `float` |   |

### hasCostPerHourBeforeSoftStartTime

### clearCostPerHourBeforeSoftStartTime

### setCostPerHourBeforeSoftStartTime

A cost per hour added to other costs in the model if the event occurs
before soft_start_time, computed as:

       max(0, soft_start_time - t.seconds)
                              * cost_per_hour_before_soft_start_time / 3600,
    t being the time of the event.

This cost must be positive, and the field can only be set if
soft_start_time has been set.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `float` |

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

### getCostPerHourAfterSoftEndTime

A cost per hour added to other costs in the model if the event occurs after
`soft_end_time`, computed as:

       max(0, t.seconds - soft_end_time.seconds)
                        * cost_per_hour_after_soft_end_time / 3600,
    t being the time of the event.

This cost must be positive, and the field can only be set if
`soft_end_time` has been set.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `float` |   |

### hasCostPerHourAfterSoftEndTime

### clearCostPerHourAfterSoftEndTime

### setCostPerHourAfterSoftEndTime

A cost per hour added to other costs in the model if the event occurs after
`soft_end_time`, computed as:

       max(0, t.seconds - soft_end_time.seconds)
                        * cost_per_hour_after_soft_end_time / 3600,
    t being the time of the event.

This cost must be positive, and the field can only be set if
`soft_end_time` has been set.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `float` |

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