public abstract class FleetRoutingClient
Reference documentation and code samples for the Cloud Optimization v1 API class FleetRoutingClient.
FleetRouting client wrapper, for convenient use.
Derived Types
Namespace
Google.Cloud.Optimization.V1Assembly
Google.Cloud.Optimization.V1.dll
Remarks
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.
Properties
BatchOptimizeToursOperationsClient
public virtual OperationsClient BatchOptimizeToursOperationsClient { get; }
The long-running operations client for BatchOptimizeTours
.
Property Value | |
---|---|
Type | Description |
OperationsClient |
DefaultEndpoint
public static string DefaultEndpoint { get; }
The default endpoint for the FleetRouting service, which is a host of "cloudoptimization.googleapis.com" and a port of 443.
Property Value | |
---|---|
Type | Description |
string |
DefaultScopes
public static IReadOnlyList<string> DefaultScopes { get; }
The default FleetRouting scopes.
Property Value | |
---|---|
Type | Description |
IReadOnlyListstring |
The default FleetRouting scopes are:
GrpcClient
public virtual FleetRouting.FleetRoutingClient GrpcClient { get; }
The underlying gRPC FleetRouting client
Property Value | |
---|---|
Type | Description |
FleetRoutingFleetRoutingClient |
ServiceMetadata
public static ServiceMetadata ServiceMetadata { get; }
The service metadata associated with this client type.
Property Value | |
---|---|
Type | Description |
ServiceMetadata |
Methods
BatchOptimizeTours(BatchOptimizeToursRequest, CallSettings)
public virtual Operation<BatchOptimizeToursResponse, AsyncModelMetadata> BatchOptimizeTours(BatchOptimizeToursRequest request, CallSettings callSettings = null)
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 ShipmentRoute
s, which are a set of routes to be performed by
vehicles minimizing the overall cost.
Parameters | |
---|---|
Name | Description |
request | BatchOptimizeToursRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
OperationBatchOptimizeToursResponseAsyncModelMetadata | The RPC response. |
// Create client
FleetRoutingClient fleetRoutingClient = FleetRoutingClient.Create();
// Initialize request argument(s)
BatchOptimizeToursRequest request = new BatchOptimizeToursRequest
{
Parent = "",
ModelConfigs =
{
new BatchOptimizeToursRequest.Types.AsyncModelConfig(),
},
};
// Make the request
Operation<BatchOptimizeToursResponse, AsyncModelMetadata> response = fleetRoutingClient.BatchOptimizeTours(request);
// Poll until the returned long-running operation is complete
Operation<BatchOptimizeToursResponse, AsyncModelMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
BatchOptimizeToursResponse result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<BatchOptimizeToursResponse, AsyncModelMetadata> retrievedResponse = fleetRoutingClient.PollOnceBatchOptimizeTours(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
BatchOptimizeToursResponse retrievedResult = retrievedResponse.Result;
}
BatchOptimizeToursAsync(BatchOptimizeToursRequest, CallSettings)
public virtual Task<Operation<BatchOptimizeToursResponse, AsyncModelMetadata>> BatchOptimizeToursAsync(BatchOptimizeToursRequest request, CallSettings callSettings = null)
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 ShipmentRoute
s, which are a set of routes to be performed by
vehicles minimizing the overall cost.
Parameters | |
---|---|
Name | Description |
request | BatchOptimizeToursRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TaskOperationBatchOptimizeToursResponseAsyncModelMetadata | A Task containing the RPC response. |
// Create client
FleetRoutingClient fleetRoutingClient = await FleetRoutingClient.CreateAsync();
// Initialize request argument(s)
BatchOptimizeToursRequest request = new BatchOptimizeToursRequest
{
Parent = "",
ModelConfigs =
{
new BatchOptimizeToursRequest.Types.AsyncModelConfig(),
},
};
// Make the request
Operation<BatchOptimizeToursResponse, AsyncModelMetadata> response = await fleetRoutingClient.BatchOptimizeToursAsync(request);
// Poll until the returned long-running operation is complete
Operation<BatchOptimizeToursResponse, AsyncModelMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
BatchOptimizeToursResponse result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<BatchOptimizeToursResponse, AsyncModelMetadata> retrievedResponse = await fleetRoutingClient.PollOnceBatchOptimizeToursAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
BatchOptimizeToursResponse retrievedResult = retrievedResponse.Result;
}
BatchOptimizeToursAsync(BatchOptimizeToursRequest, CancellationToken)
public virtual Task<Operation<BatchOptimizeToursResponse, AsyncModelMetadata>> BatchOptimizeToursAsync(BatchOptimizeToursRequest request, CancellationToken cancellationToken)
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 ShipmentRoute
s, which are a set of routes to be performed by
vehicles minimizing the overall cost.
Parameters | |
---|---|
Name | Description |
request | BatchOptimizeToursRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskOperationBatchOptimizeToursResponseAsyncModelMetadata | A Task containing the RPC response. |
// Create client
FleetRoutingClient fleetRoutingClient = await FleetRoutingClient.CreateAsync();
// Initialize request argument(s)
BatchOptimizeToursRequest request = new BatchOptimizeToursRequest
{
Parent = "",
ModelConfigs =
{
new BatchOptimizeToursRequest.Types.AsyncModelConfig(),
},
};
// Make the request
Operation<BatchOptimizeToursResponse, AsyncModelMetadata> response = await fleetRoutingClient.BatchOptimizeToursAsync(request);
// Poll until the returned long-running operation is complete
Operation<BatchOptimizeToursResponse, AsyncModelMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
BatchOptimizeToursResponse result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<BatchOptimizeToursResponse, AsyncModelMetadata> retrievedResponse = await fleetRoutingClient.PollOnceBatchOptimizeToursAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
BatchOptimizeToursResponse retrievedResult = retrievedResponse.Result;
}
Create()
public static FleetRoutingClient Create()
Synchronously creates a FleetRoutingClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use FleetRoutingClientBuilder.
Returns | |
---|---|
Type | Description |
FleetRoutingClient | The created FleetRoutingClient. |
CreateAsync(CancellationToken)
public static Task<FleetRoutingClient> CreateAsync(CancellationToken cancellationToken = default)
Asynchronously creates a FleetRoutingClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use FleetRoutingClientBuilder.
Parameter | |
---|---|
Name | Description |
cancellationToken | CancellationToken The CancellationToken to use while creating the client. |
Returns | |
---|---|
Type | Description |
TaskFleetRoutingClient | The task representing the created FleetRoutingClient. |
OptimizeTours(OptimizeToursRequest, CallSettings)
public virtual OptimizeToursResponse OptimizeTours(OptimizeToursRequest request, CallSettings callSettings = null)
Sends an OptimizeToursRequest
containing a ShipmentModel
and returns an
OptimizeToursResponse
containing ShipmentRoute
s, which are a set of
routes to be performed by vehicles minimizing the overall cost.
A ShipmentModel
model consists mainly of Shipment
s that need to be
carried out and Vehicle
s that can be used to transport the Shipment
s.
The ShipmentRoute
s assign Shipment
s to Vehicle
s. More specifically,
they assign a series of Visit
s 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 ShipmentRoute
s to Vehicle
s that
minimizes the total cost where cost has many components defined in the
ShipmentModel
.
Parameters | |
---|---|
Name | Description |
request | OptimizeToursRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
OptimizeToursResponse | The RPC response. |
// Create client
FleetRoutingClient fleetRoutingClient = FleetRoutingClient.Create();
// Initialize request argument(s)
OptimizeToursRequest request = new OptimizeToursRequest
{
Parent = "",
Timeout = new Duration(),
Model = new ShipmentModel(),
SolvingMode = OptimizeToursRequest.Types.SolvingMode.DefaultSolve,
MaxValidationErrors = 0,
SearchMode = OptimizeToursRequest.Types.SearchMode.Unspecified,
InjectedFirstSolutionRoutes =
{
new ShipmentRoute(),
},
InjectedSolutionConstraint = new InjectedSolutionConstraint(),
RefreshDetailsRoutes =
{
new ShipmentRoute(),
},
InterpretInjectedSolutionsUsingLabels = false,
ConsiderRoadTraffic = false,
PopulatePolylines = false,
PopulateTransitionPolylines = false,
AllowLargeDeadlineDespiteInterruptionRisk = false,
UseGeodesicDistances = false,
GeodesicMetersPerSecond = 0,
Label = "",
};
// Make the request
OptimizeToursResponse response = fleetRoutingClient.OptimizeTours(request);
OptimizeToursAsync(OptimizeToursRequest, CallSettings)
public virtual Task<OptimizeToursResponse> OptimizeToursAsync(OptimizeToursRequest request, CallSettings callSettings = null)
Sends an OptimizeToursRequest
containing a ShipmentModel
and returns an
OptimizeToursResponse
containing ShipmentRoute
s, which are a set of
routes to be performed by vehicles minimizing the overall cost.
A ShipmentModel
model consists mainly of Shipment
s that need to be
carried out and Vehicle
s that can be used to transport the Shipment
s.
The ShipmentRoute
s assign Shipment
s to Vehicle
s. More specifically,
they assign a series of Visit
s 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 ShipmentRoute
s to Vehicle
s that
minimizes the total cost where cost has many components defined in the
ShipmentModel
.
Parameters | |
---|---|
Name | Description |
request | OptimizeToursRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TaskOptimizeToursResponse | A Task containing the RPC response. |
// Create client
FleetRoutingClient fleetRoutingClient = await FleetRoutingClient.CreateAsync();
// Initialize request argument(s)
OptimizeToursRequest request = new OptimizeToursRequest
{
Parent = "",
Timeout = new Duration(),
Model = new ShipmentModel(),
SolvingMode = OptimizeToursRequest.Types.SolvingMode.DefaultSolve,
MaxValidationErrors = 0,
SearchMode = OptimizeToursRequest.Types.SearchMode.Unspecified,
InjectedFirstSolutionRoutes =
{
new ShipmentRoute(),
},
InjectedSolutionConstraint = new InjectedSolutionConstraint(),
RefreshDetailsRoutes =
{
new ShipmentRoute(),
},
InterpretInjectedSolutionsUsingLabels = false,
ConsiderRoadTraffic = false,
PopulatePolylines = false,
PopulateTransitionPolylines = false,
AllowLargeDeadlineDespiteInterruptionRisk = false,
UseGeodesicDistances = false,
GeodesicMetersPerSecond = 0,
Label = "",
};
// Make the request
OptimizeToursResponse response = await fleetRoutingClient.OptimizeToursAsync(request);
OptimizeToursAsync(OptimizeToursRequest, CancellationToken)
public virtual Task<OptimizeToursResponse> OptimizeToursAsync(OptimizeToursRequest request, CancellationToken cancellationToken)
Sends an OptimizeToursRequest
containing a ShipmentModel
and returns an
OptimizeToursResponse
containing ShipmentRoute
s, which are a set of
routes to be performed by vehicles minimizing the overall cost.
A ShipmentModel
model consists mainly of Shipment
s that need to be
carried out and Vehicle
s that can be used to transport the Shipment
s.
The ShipmentRoute
s assign Shipment
s to Vehicle
s. More specifically,
they assign a series of Visit
s 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 ShipmentRoute
s to Vehicle
s that
minimizes the total cost where cost has many components defined in the
ShipmentModel
.
Parameters | |
---|---|
Name | Description |
request | OptimizeToursRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskOptimizeToursResponse | A Task containing the RPC response. |
// Create client
FleetRoutingClient fleetRoutingClient = await FleetRoutingClient.CreateAsync();
// Initialize request argument(s)
OptimizeToursRequest request = new OptimizeToursRequest
{
Parent = "",
Timeout = new Duration(),
Model = new ShipmentModel(),
SolvingMode = OptimizeToursRequest.Types.SolvingMode.DefaultSolve,
MaxValidationErrors = 0,
SearchMode = OptimizeToursRequest.Types.SearchMode.Unspecified,
InjectedFirstSolutionRoutes =
{
new ShipmentRoute(),
},
InjectedSolutionConstraint = new InjectedSolutionConstraint(),
RefreshDetailsRoutes =
{
new ShipmentRoute(),
},
InterpretInjectedSolutionsUsingLabels = false,
ConsiderRoadTraffic = false,
PopulatePolylines = false,
PopulateTransitionPolylines = false,
AllowLargeDeadlineDespiteInterruptionRisk = false,
UseGeodesicDistances = false,
GeodesicMetersPerSecond = 0,
Label = "",
};
// Make the request
OptimizeToursResponse response = await fleetRoutingClient.OptimizeToursAsync(request);
PollOnceBatchOptimizeTours(string, CallSettings)
public virtual Operation<BatchOptimizeToursResponse, AsyncModelMetadata> PollOnceBatchOptimizeTours(string operationName, CallSettings callSettings = null)
Poll an operation once, using an operationName
from a previous invocation of BatchOptimizeTours
.
Parameters | |
---|---|
Name | Description |
operationName | string The name of a previously invoked operation. Must not be |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
OperationBatchOptimizeToursResponseAsyncModelMetadata | The result of polling the operation. |
PollOnceBatchOptimizeToursAsync(string, CallSettings)
public virtual Task<Operation<BatchOptimizeToursResponse, AsyncModelMetadata>> PollOnceBatchOptimizeToursAsync(string operationName, CallSettings callSettings = null)
Asynchronously poll an operation once, using an operationName
from a previous invocation of
BatchOptimizeTours
.
Parameters | |
---|---|
Name | Description |
operationName | string The name of a previously invoked operation. Must not be |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TaskOperationBatchOptimizeToursResponseAsyncModelMetadata | A task representing the result of polling the operation. |
ShutdownDefaultChannelsAsync()
public static Task ShutdownDefaultChannelsAsync()
Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.
Returns | |
---|---|
Type | Description |
Task | A task representing the asynchronous shutdown operation. |
After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.