# Google Maps Route Optimization V1 Client - Class Metrics (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 Metrics.

Overall metrics, aggregated over all routes.

Generated from protobuf message `google.maps.routeoptimization.v1.OptimizeToursResponse.Metrics`

## Namespace

Google \\ Maps \\ RouteOptimization \\ V1 \\ OptimizeToursResponse

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ aggregated_route_metrics` | `https://docs.cloud.google.com/php/docs/reference/maps-routeoptimization/latest/V1.AggregatedMetrics` Aggregated over the routes. Each metric is the sum (or max, for loads) over all [ShipmentRoute.metrics](https://docs.cloud.google.com/php/docs/reference/maps-routeoptimization/latest/V1.ShipmentRoute#_Google_Maps_RouteOptimization_V1_ShipmentRoute__getMetrics__) fields of the same name. |
| `↳ skipped_mandatory_shipment_count` | `int` Number of mandatory shipments skipped. |
| `↳ used_vehicle_count` | `int` Number of vehicles used. Note: if a vehicle route is empty and [Vehicle.used_if_route_is_empty](https://docs.cloud.google.com/php/docs/reference/maps-routeoptimization/latest/V1.Vehicle#_Google_Maps_RouteOptimization_V1_Vehicle__getUsedIfRouteIsEmpty__) is true, the vehicle is considered used. |
| `↳ earliest_vehicle_start_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` The earliest start time for a used vehicle, computed as the minimum over all used vehicles of [ShipmentRoute.vehicle_start_time](https://docs.cloud.google.com/php/docs/reference/maps-routeoptimization/latest/V1.ShipmentRoute#_Google_Maps_RouteOptimization_V1_ShipmentRoute__getVehicleStartTime__). |
| `↳ latest_vehicle_end_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` The latest end time for a used vehicle, computed as the maximum over all used vehicles of [ShipmentRoute.vehicle_end_time](https://docs.cloud.google.com/php/docs/reference/maps-routeoptimization/latest/V1.ShipmentRoute#_Google_Maps_RouteOptimization_V1_ShipmentRoute__getVehicleEndTime__). |
| `↳ costs` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` Cost of the solution, broken down by cost-related request fields. The keys are proto paths, relative to the input OptimizeToursRequest, e.g. "model.shipments.pickups.cost", and the values are the total cost generated by the corresponding cost field, aggregated over the whole solution. In other words, costs\["model.shipments.pickups.cost"\] is the sum of all pickup costs over the solution. All costs defined in the model are reported in detail here with the exception of costs related to TransitionAttributes that are only reported in an aggregated way as of 2022/01. |
| `↳ total_cost` | `float` Total cost of the solution. The sum of all values in the costs map. |

### getAggregatedRouteMetrics

Aggregated over the routes. Each metric is the sum (or max, for loads)
over all
[ShipmentRoute.metrics](https://docs.cloud.google.com/php/docs/reference/maps-routeoptimization/latest/V1.ShipmentRoute#_Google_Maps_RouteOptimization_V1_ShipmentRoute__getMetrics__)
fields of the same name.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/maps-routeoptimization/latest/V1.AggregatedMetrics|null` |   |

### hasAggregatedRouteMetrics

### clearAggregatedRouteMetrics

### setAggregatedRouteMetrics

Aggregated over the routes. Each metric is the sum (or max, for loads)
over all
[ShipmentRoute.metrics](https://docs.cloud.google.com/php/docs/reference/maps-routeoptimization/latest/V1.ShipmentRoute#_Google_Maps_RouteOptimization_V1_ShipmentRoute__getMetrics__)
fields of the same name.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/maps-routeoptimization/latest/V1.AggregatedMetrics` |

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

### getSkippedMandatoryShipmentCount

Number of mandatory shipments skipped.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### setSkippedMandatoryShipmentCount

Number of mandatory shipments skipped.

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

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

### getUsedVehicleCount

Number of vehicles used. Note: if a vehicle route is empty and
[Vehicle.used_if_route_is_empty](https://docs.cloud.google.com/php/docs/reference/maps-routeoptimization/latest/V1.Vehicle#_Google_Maps_RouteOptimization_V1_Vehicle__getUsedIfRouteIsEmpty__)
is true, the vehicle is considered used.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### setUsedVehicleCount

Number of vehicles used. Note: if a vehicle route is empty and
[Vehicle.used_if_route_is_empty](https://docs.cloud.google.com/php/docs/reference/maps-routeoptimization/latest/V1.Vehicle#_Google_Maps_RouteOptimization_V1_Vehicle__getUsedIfRouteIsEmpty__)
is true, the vehicle is considered used.

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

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

### getEarliestVehicleStartTime

The earliest start time for a used vehicle, computed as the minimum over
all used vehicles of
[ShipmentRoute.vehicle_start_time](https://docs.cloud.google.com/php/docs/reference/maps-routeoptimization/latest/V1.ShipmentRoute#_Google_Maps_RouteOptimization_V1_ShipmentRoute__getVehicleStartTime__).

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

### hasEarliestVehicleStartTime

### clearEarliestVehicleStartTime

### setEarliestVehicleStartTime

The earliest start time for a used vehicle, computed as the minimum over
all used vehicles of
[ShipmentRoute.vehicle_start_time](https://docs.cloud.google.com/php/docs/reference/maps-routeoptimization/latest/V1.ShipmentRoute#_Google_Maps_RouteOptimization_V1_ShipmentRoute__getVehicleStartTime__).

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

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

### getLatestVehicleEndTime

The latest end time for a used vehicle, computed as the maximum over all
used vehicles of
[ShipmentRoute.vehicle_end_time](https://docs.cloud.google.com/php/docs/reference/maps-routeoptimization/latest/V1.ShipmentRoute#_Google_Maps_RouteOptimization_V1_ShipmentRoute__getVehicleEndTime__).

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

### hasLatestVehicleEndTime

### clearLatestVehicleEndTime

### setLatestVehicleEndTime

The latest end time for a used vehicle, computed as the maximum over all
used vehicles of
[ShipmentRoute.vehicle_end_time](https://docs.cloud.google.com/php/docs/reference/maps-routeoptimization/latest/V1.ShipmentRoute#_Google_Maps_RouteOptimization_V1_ShipmentRoute__getVehicleEndTime__).

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

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

### getCosts

Cost of the solution, broken down by cost-related request fields.

The keys are proto paths, relative to the input OptimizeToursRequest,
e.g. "model.shipments.pickups.cost", and the values are the total cost
generated by the corresponding cost field, aggregated over the whole
solution. In other words, costs\["model.shipments.pickups.cost"\] is the
sum of all pickup costs over the solution. All costs defined in the model
are reported in detail here with the exception of costs related to
TransitionAttributes that are only reported in an aggregated way as of
2022/01.

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

### setCosts

Cost of the solution, broken down by cost-related request fields.

The keys are proto paths, relative to the input OptimizeToursRequest,
e.g. "model.shipments.pickups.cost", and the values are the total cost
generated by the corresponding cost field, aggregated over the whole
solution. In other words, costs\["model.shipments.pickups.cost"\] is the
sum of all pickup costs over the solution. All costs defined in the model
are reported in detail here with the exception of costs related to
TransitionAttributes that are only reported in an aggregated way as of
2022/01.

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

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

### getTotalCost

Total cost of the solution. The sum of all values in the costs map.

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

### setTotalCost

Total cost of the solution. The sum of all values in the costs map.

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

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