Class FleetRoutingClient (2.32.0)

A service for optimizing vehicle tours.

Validity of certain types of fields:

  • google.protobuf.Timestamp
    • Times are in Unix time: seconds since 1970-01-01T00:00:00+00:00.
    • seconds must be in [0, 253402300799], i.e. in [1970-01-01T00:00:00+00:00, 9999-12-31T23:59:59+00:00].
    • nanos must be unset or set to 0.
  • google.protobuf.Duration
    • seconds must be in [0, 253402300799], i.e. in [1970-01-01T00:00:00+00:00, 9999-12-31T23:59:59+00:00].
    • nanos must be unset or set to 0.
  • google.type.LatLng
    • latitude must be in [-90.0, 90.0].
    • longitude must be in [-180.0, 180.0].
    • at least one of latitude and longitude must be non-zero.
Equality

Instances of this class created via copy-construction or copy-assignment always compare equal. Instances created with equal std::shared_ptr<*Connection> objects compare equal. Objects that compare equal share the same underlying resources.

Performance

Creating a new instance of this class is a relatively expensive operation, new objects establish new connections to the service. In contrast, copy-construction, move-construction, and the corresponding assignment operations are relatively efficient as the copies share all underlying resources.

Thread Safety

Concurrent access to different instances of this class, even if they compare equal, is guaranteed to work. Two or more threads operating on the same instance of this class is not guaranteed to work. Since copy-construction and move-construction is a relatively efficient operation, consider using such a copy when using this class from multiple threads.

Constructors

FleetRoutingClient(FleetRoutingClient const &)

Copy and move support

Parameter
Name Description
FleetRoutingClient const &

FleetRoutingClient(FleetRoutingClient &&)

Copy and move support

Parameter
Name Description
FleetRoutingClient &&

FleetRoutingClient(std::shared_ptr< FleetRoutingConnection >, Options)

Parameters
Name Description
connection std::shared_ptr< FleetRoutingConnection >
opts Options

Operators

operator=(FleetRoutingClient const &)

Copy and move support

Parameter
Name Description
FleetRoutingClient const &
Returns
Type Description
FleetRoutingClient &

operator=(FleetRoutingClient &&)

Copy and move support

Parameter
Name Description
FleetRoutingClient &&
Returns
Type Description
FleetRoutingClient &

Functions

OptimizeTours(google::cloud::optimization::v1::OptimizeToursRequest const &, Options)

Sends an OptimizeToursRequest containing a ShipmentModel and returns an OptimizeToursResponse containing ShipmentRoutes, which are a set of routes to be performed by vehicles minimizing the overall cost.

A ShipmentModel model consists mainly of Shipments that need to be carried out and Vehicles that can be used to transport the Shipments. The ShipmentRoutes assign Shipments to Vehicles. More specifically, they assign a series of Visits to each vehicle, where a Visit corresponds to a VisitRequest, which is a pickup or delivery for a Shipment.

The goal is to provide an assignment of ShipmentRoutes to Vehicles that minimizes the total cost where cost has many components defined in the ShipmentModel.

Parameters
Name Description
request google::cloud::optimization::v1::OptimizeToursRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.optimization.v1.OptimizeToursRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::optimization::v1::OptimizeToursResponse >

the result of the RPC. The response message type (google.cloud.optimization.v1.OptimizeToursResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

BatchOptimizeTours(google::cloud::optimization::v1::BatchOptimizeToursRequest const &, Options)

Optimizes vehicle tours for one or more OptimizeToursRequest messages as a batch.

This method is a Long Running Operation (LRO). The inputs for optimization (OptimizeToursRequest messages) and outputs (OptimizeToursResponse messages) are read/written from/to Cloud Storage in user-specified format. Like the OptimizeTours method, each OptimizeToursRequest contains a ShipmentModel and returns an OptimizeToursResponse containing ShipmentRoutes, which are a set of routes to be performed by vehicles minimizing the overall cost.

Parameters
Name Description
request google::cloud::optimization::v1::BatchOptimizeToursRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.optimization.v1.BatchOptimizeToursRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
future< StatusOr< google::cloud::optimization::v1::BatchOptimizeToursResponse > >

A future that becomes satisfied when the LRO (Long Running Operation) completes or the polling policy in effect for this call is exhausted. The future is satisfied with an error if the LRO completes with an error or the polling policy is exhausted. In this case the StatusOr returned by the future contains the error. If the LRO completes successfully the value of the future contains the LRO's result. For this RPC the result is a google.cloud.optimization.v1.BatchOptimizeToursResponse proto message. The C++ class representing this message is created by Protobuf, using the Protobuf mapping rules.

BatchOptimizeTours(NoAwaitTag, google::cloud::optimization::v1::BatchOptimizeToursRequest const &, Options)

Optimizes vehicle tours for one or more OptimizeToursRequest messages as a batch.

Specifying the NoAwaitTag immediately returns the [google::longrunning::Operation] that corresponds to the Long Running Operation that has been started. No polling for operation status occurs.

Parameters
Name Description
NoAwaitTag
request google::cloud::optimization::v1::BatchOptimizeToursRequest const &
opts Options
Returns
Type Description
StatusOr< google::longrunning::Operation >

BatchOptimizeTours(google::longrunning::Operation const &, Options)

Optimizes vehicle tours for one or more OptimizeToursRequest messages as a batch.

This method accepts a google::longrunning::Operation that corresponds to a previously started Long Running Operation (LRO) and polls the status of the LRO in the background.

Parameters
Name Description
operation google::longrunning::Operation const &
opts Options
Returns
Type Description
future< StatusOr< google::cloud::optimization::v1::BatchOptimizeToursResponse > >

GetOperation(std::string const &, Options)

Gets the latest state of a long-running operation.

Clients can use this method to poll the operation result at intervals as recommended by the API service.

Parameters
Name Description
name std::string const &

The name of the operation resource.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::longrunning::Operation >

the result of the RPC. The response message type (google.longrunning.Operation) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

GetOperation(google::longrunning::GetOperationRequest const &, Options)

Gets the latest state of a long-running operation.

Clients can use this method to poll the operation result at intervals as recommended by the API service.

Parameters
Name Description
request google::longrunning::GetOperationRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.longrunning.GetOperationRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::longrunning::Operation >

the result of the RPC. The response message type (google.longrunning.Operation) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.