Class RouteOptimizationClient
RouteOptimization client wrapper, for convenient use.
Namespace: Google.Maps.RouteOptimization.V1
Assembly: Google.Maps.RouteOptimization.V1.dll
Syntax
public abstract class RouteOptimizationClient
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
The long-running operations client for BatchOptimizeTours.
Declaration
public virtual OperationsClient BatchOptimizeToursOperationsClient { get; }
Property Value
| Type | Description |
|---|---|
| OperationsClient |
DefaultEndpoint
The default endpoint for the RouteOptimization service, which is a host of "routeoptimization.googleapis.com" and a port of 443.
Declaration
public static string DefaultEndpoint { get; }
Property Value
| Type | Description |
|---|---|
| string |
DefaultScopes
The default RouteOptimization scopes.
Declaration
public static IReadOnlyList<string> DefaultScopes { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<string> |
Remarks
The default RouteOptimization scopes are:
- https://www.googleapis.com/auth/cloud-platform
GrpcClient
The underlying gRPC RouteOptimization client
Declaration
public virtual RouteOptimization.RouteOptimizationClient GrpcClient { get; }
Property Value
| Type | Description |
|---|---|
| RouteOptimization.RouteOptimizationClient |
OptimizeToursLongRunningOperationsClient
The long-running operations client for OptimizeToursLongRunning.
Declaration
public virtual OperationsClient OptimizeToursLongRunningOperationsClient { get; }
Property Value
| Type | Description |
|---|---|
| OperationsClient |
OptimizeToursUriOperationsClient
The long-running operations client for OptimizeToursUri.
Declaration
public virtual OperationsClient OptimizeToursUriOperationsClient { get; }
Property Value
| Type | Description |
|---|---|
| OperationsClient |
ServiceMetadata
The service metadata associated with this client type.
Declaration
public static ServiceMetadata ServiceMetadata { get; }
Property Value
| Type | Description |
|---|---|
| ServiceMetadata |
Methods
BatchOptimizeTours(BatchOptimizeToursRequest, CallSettings)
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 from and written to Cloud Storage in user-specified
format. Like the OptimizeTours method, each OptimizeToursRequest
contains a ShipmentModel and returns an OptimizeToursResponse
containing ShipmentRoute fields, which are a set of routes to be
performed by vehicles minimizing the overall cost.
The user can poll operations.get to check the status of the LRO:
If the LRO done field is false, then at least one request is still
being processed. Other requests may have completed successfully and their
results are available in Cloud Storage.
If the LRO's done field is true, then all requests have been processed.
Any successfully processed requests will have their results available in
Cloud Storage. Any requests that failed will not have their results
available in Cloud Storage. If the LRO's error field is set, then it
contains the error from one of the failed requests.
Declaration
public virtual Operation<BatchOptimizeToursResponse, BatchOptimizeToursMetadata> BatchOptimizeTours(BatchOptimizeToursRequest request, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| BatchOptimizeToursRequest | request | 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 |
|---|---|
| Operation<BatchOptimizeToursResponse, BatchOptimizeToursMetadata> | The RPC response. |
Sample code
// Create client
RouteOptimizationClient routeOptimizationClient = RouteOptimizationClient.Create();
// Initialize request argument(s)
BatchOptimizeToursRequest request = new BatchOptimizeToursRequest
{
Parent = "",
ModelConfigs =
{
new BatchOptimizeToursRequest.Types.AsyncModelConfig(),
},
};
// Make the request
Operation<BatchOptimizeToursResponse, BatchOptimizeToursMetadata> response = routeOptimizationClient.BatchOptimizeTours(request);
// Poll until the returned long-running operation is complete
Operation<BatchOptimizeToursResponse, BatchOptimizeToursMetadata> 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, BatchOptimizeToursMetadata> retrievedResponse = routeOptimizationClient.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)
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 from and written to Cloud Storage in user-specified
format. Like the OptimizeTours method, each OptimizeToursRequest
contains a ShipmentModel and returns an OptimizeToursResponse
containing ShipmentRoute fields, which are a set of routes to be
performed by vehicles minimizing the overall cost.
The user can poll operations.get to check the status of the LRO:
If the LRO done field is false, then at least one request is still
being processed. Other requests may have completed successfully and their
results are available in Cloud Storage.
If the LRO's done field is true, then all requests have been processed.
Any successfully processed requests will have their results available in
Cloud Storage. Any requests that failed will not have their results
available in Cloud Storage. If the LRO's error field is set, then it
contains the error from one of the failed requests.
Declaration
public virtual Task<Operation<BatchOptimizeToursResponse, BatchOptimizeToursMetadata>> BatchOptimizeToursAsync(BatchOptimizeToursRequest request, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| BatchOptimizeToursRequest | request | 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 |
|---|---|
| Task<Operation<BatchOptimizeToursResponse, BatchOptimizeToursMetadata>> | A Task containing the RPC response. |
Sample code
// Create client
RouteOptimizationClient routeOptimizationClient = await RouteOptimizationClient.CreateAsync();
// Initialize request argument(s)
BatchOptimizeToursRequest request = new BatchOptimizeToursRequest
{
Parent = "",
ModelConfigs =
{
new BatchOptimizeToursRequest.Types.AsyncModelConfig(),
},
};
// Make the request
Operation<BatchOptimizeToursResponse, BatchOptimizeToursMetadata> response = await routeOptimizationClient.BatchOptimizeToursAsync(request);
// Poll until the returned long-running operation is complete
Operation<BatchOptimizeToursResponse, BatchOptimizeToursMetadata> 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, BatchOptimizeToursMetadata> retrievedResponse = await routeOptimizationClient.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)
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 from and written to Cloud Storage in user-specified
format. Like the OptimizeTours method, each OptimizeToursRequest
contains a ShipmentModel and returns an OptimizeToursResponse
containing ShipmentRoute fields, which are a set of routes to be
performed by vehicles minimizing the overall cost.
The user can poll operations.get to check the status of the LRO:
If the LRO done field is false, then at least one request is still
being processed. Other requests may have completed successfully and their
results are available in Cloud Storage.
If the LRO's done field is true, then all requests have been processed.
Any successfully processed requests will have their results available in
Cloud Storage. Any requests that failed will not have their results
available in Cloud Storage. If the LRO's error field is set, then it
contains the error from one of the failed requests.
Declaration
public virtual Task<Operation<BatchOptimizeToursResponse, BatchOptimizeToursMetadata>> BatchOptimizeToursAsync(BatchOptimizeToursRequest request, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| BatchOptimizeToursRequest | request | The request object containing all of the parameters for the API call. |
| CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
| Type | Description |
|---|---|
| Task<Operation<BatchOptimizeToursResponse, BatchOptimizeToursMetadata>> | A Task containing the RPC response. |
Sample code
// Create client
RouteOptimizationClient routeOptimizationClient = await RouteOptimizationClient.CreateAsync();
// Initialize request argument(s)
BatchOptimizeToursRequest request = new BatchOptimizeToursRequest
{
Parent = "",
ModelConfigs =
{
new BatchOptimizeToursRequest.Types.AsyncModelConfig(),
},
};
// Make the request
Operation<BatchOptimizeToursResponse, BatchOptimizeToursMetadata> response = await routeOptimizationClient.BatchOptimizeToursAsync(request);
// Poll until the returned long-running operation is complete
Operation<BatchOptimizeToursResponse, BatchOptimizeToursMetadata> 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, BatchOptimizeToursMetadata> retrievedResponse = await routeOptimizationClient.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()
Synchronously creates a RouteOptimizationClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use RouteOptimizationClientBuilder.
Declaration
public static RouteOptimizationClient Create()
Returns
| Type | Description |
|---|---|
| RouteOptimizationClient | The created RouteOptimizationClient. |
CreateAsync(CancellationToken)
Asynchronously creates a RouteOptimizationClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use RouteOptimizationClientBuilder.
Declaration
public static Task<RouteOptimizationClient> CreateAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | The CancellationToken to use while creating the client. |
Returns
| Type | Description |
|---|---|
| Task<RouteOptimizationClient> | The task representing the created RouteOptimizationClient. |
OptimizeTours(OptimizeToursRequest, CallSettings)
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.
Declaration
public virtual OptimizeToursResponse OptimizeTours(OptimizeToursRequest request, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| OptimizeToursRequest | request | 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. |
Sample code
// Create client
RouteOptimizationClient routeOptimizationClient = RouteOptimizationClient.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 = routeOptimizationClient.OptimizeTours(request);
OptimizeToursAsync(OptimizeToursRequest, CallSettings)
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.
Declaration
public virtual Task<OptimizeToursResponse> OptimizeToursAsync(OptimizeToursRequest request, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| OptimizeToursRequest | request | 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 |
|---|---|
| Task<OptimizeToursResponse> | A Task containing the RPC response. |
Sample code
// Create client
RouteOptimizationClient routeOptimizationClient = await RouteOptimizationClient.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 routeOptimizationClient.OptimizeToursAsync(request);
OptimizeToursAsync(OptimizeToursRequest, CancellationToken)
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.
Declaration
public virtual Task<OptimizeToursResponse> OptimizeToursAsync(OptimizeToursRequest request, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| OptimizeToursRequest | request | The request object containing all of the parameters for the API call. |
| CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
| Type | Description |
|---|---|
| Task<OptimizeToursResponse> | A Task containing the RPC response. |
Sample code
// Create client
RouteOptimizationClient routeOptimizationClient = await RouteOptimizationClient.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 routeOptimizationClient.OptimizeToursAsync(request);
OptimizeToursLongRunning(OptimizeToursRequest, CallSettings)
This is a variant of the
[OptimizeTours][google.maps.routeoptimization.v1.RouteOptimization.OptimizeTours]
method designed for
optimizations with large timeout values. It should be preferred over the
OptimizeTours method for optimizations that take longer than
a few minutes.
The returned [long-running operation][google.longrunning.Operation] (LRO)
will have a name of the format
<parent>/operations/<operation_id> and can be used to track
progress of the computation. The
[metadata][google.longrunning.Operation.metadata] field type is
[OptimizeToursLongRunningMetadata][google.maps.routeoptimization.v1.OptimizeToursLongRunningMetadata].
The [response][google.longrunning.Operation.response] field type is
[OptimizeToursResponse][google.maps.routeoptimization.v1.OptimizeToursResponse],
if successful.
Experimental: See https://developers.google.com/maps/tt/route-optimization/experimental/otlr/make-request for more details.
Declaration
public virtual Operation<OptimizeToursResponse, OptimizeToursLongRunningMetadata> OptimizeToursLongRunning(OptimizeToursRequest request, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| OptimizeToursRequest | request | 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 |
|---|---|
| Operation<OptimizeToursResponse, OptimizeToursLongRunningMetadata> | The RPC response. |
Sample code
// Create client
RouteOptimizationClient routeOptimizationClient = RouteOptimizationClient.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
Operation<OptimizeToursResponse, OptimizeToursLongRunningMetadata> response = routeOptimizationClient.OptimizeToursLongRunning(request);
// Poll until the returned long-running operation is complete
Operation<OptimizeToursResponse, OptimizeToursLongRunningMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
OptimizeToursResponse 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<OptimizeToursResponse, OptimizeToursLongRunningMetadata> retrievedResponse = routeOptimizationClient.PollOnceOptimizeToursLongRunning(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
OptimizeToursResponse retrievedResult = retrievedResponse.Result;
}
OptimizeToursLongRunningAsync(OptimizeToursRequest, CallSettings)
This is a variant of the
[OptimizeTours][google.maps.routeoptimization.v1.RouteOptimization.OptimizeTours]
method designed for
optimizations with large timeout values. It should be preferred over the
OptimizeTours method for optimizations that take longer than
a few minutes.
The returned [long-running operation][google.longrunning.Operation] (LRO)
will have a name of the format
<parent>/operations/<operation_id> and can be used to track
progress of the computation. The
[metadata][google.longrunning.Operation.metadata] field type is
[OptimizeToursLongRunningMetadata][google.maps.routeoptimization.v1.OptimizeToursLongRunningMetadata].
The [response][google.longrunning.Operation.response] field type is
[OptimizeToursResponse][google.maps.routeoptimization.v1.OptimizeToursResponse],
if successful.
Experimental: See https://developers.google.com/maps/tt/route-optimization/experimental/otlr/make-request for more details.
Declaration
public virtual Task<Operation<OptimizeToursResponse, OptimizeToursLongRunningMetadata>> OptimizeToursLongRunningAsync(OptimizeToursRequest request, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| OptimizeToursRequest | request | 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 |
|---|---|
| Task<Operation<OptimizeToursResponse, OptimizeToursLongRunningMetadata>> | A Task containing the RPC response. |
Sample code
// Create client
RouteOptimizationClient routeOptimizationClient = await RouteOptimizationClient.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
Operation<OptimizeToursResponse, OptimizeToursLongRunningMetadata> response = await routeOptimizationClient.OptimizeToursLongRunningAsync(request);
// Poll until the returned long-running operation is complete
Operation<OptimizeToursResponse, OptimizeToursLongRunningMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
OptimizeToursResponse 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<OptimizeToursResponse, OptimizeToursLongRunningMetadata> retrievedResponse = await routeOptimizationClient.PollOnceOptimizeToursLongRunningAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
OptimizeToursResponse retrievedResult = retrievedResponse.Result;
}
OptimizeToursLongRunningAsync(OptimizeToursRequest, CancellationToken)
This is a variant of the
[OptimizeTours][google.maps.routeoptimization.v1.RouteOptimization.OptimizeTours]
method designed for
optimizations with large timeout values. It should be preferred over the
OptimizeTours method for optimizations that take longer than
a few minutes.
The returned [long-running operation][google.longrunning.Operation] (LRO)
will have a name of the format
<parent>/operations/<operation_id> and can be used to track
progress of the computation. The
[metadata][google.longrunning.Operation.metadata] field type is
[OptimizeToursLongRunningMetadata][google.maps.routeoptimization.v1.OptimizeToursLongRunningMetadata].
The [response][google.longrunning.Operation.response] field type is
[OptimizeToursResponse][google.maps.routeoptimization.v1.OptimizeToursResponse],
if successful.
Experimental: See https://developers.google.com/maps/tt/route-optimization/experimental/otlr/make-request for more details.
Declaration
public virtual Task<Operation<OptimizeToursResponse, OptimizeToursLongRunningMetadata>> OptimizeToursLongRunningAsync(OptimizeToursRequest request, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| OptimizeToursRequest | request | The request object containing all of the parameters for the API call. |
| CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
| Type | Description |
|---|---|
| Task<Operation<OptimizeToursResponse, OptimizeToursLongRunningMetadata>> | A Task containing the RPC response. |
Sample code
// Create client
RouteOptimizationClient routeOptimizationClient = await RouteOptimizationClient.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
Operation<OptimizeToursResponse, OptimizeToursLongRunningMetadata> response = await routeOptimizationClient.OptimizeToursLongRunningAsync(request);
// Poll until the returned long-running operation is complete
Operation<OptimizeToursResponse, OptimizeToursLongRunningMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
OptimizeToursResponse 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<OptimizeToursResponse, OptimizeToursLongRunningMetadata> retrievedResponse = await routeOptimizationClient.PollOnceOptimizeToursLongRunningAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
OptimizeToursResponse retrievedResult = retrievedResponse.Result;
}
OptimizeToursUri(OptimizeToursUriRequest, CallSettings)
This is a variant of the [OptimizeToursLongRunning][google.maps.routeoptimization.v1.RouteOptimization.OptimizeToursLongRunning] method designed for optimizations with large timeout values and large input/output sizes.
The client specifies the URI of the OptimizeToursRequest stored
in Google Cloud Storage and the server writes the OptimizeToursResponse
to a client-specified Google Cloud Storage URI.
This method should be preferred over the OptimizeTours method for
optimizations that take longer than a few minutes and input/output sizes
that are larger than 8MB, though it can be used for shorter and smaller
optimizations as well.
The returned [long-running operation][google.longrunning.Operation] (LRO)
will have a name of the format
<parent>/operations/<operation_id> and can be used to track
progress of the computation. The
[metadata][google.longrunning.Operation.metadata] field type is
[OptimizeToursLongRunningMetadata][google.maps.routeoptimization.v1.OptimizeToursUriMetadata].
The [response][google.longrunning.Operation.response] field type is
[OptimizeToursUriResponse][google.maps.routeoptimization.v1.OptimizeToursUriResponse],
if successful.
Experimental: See https://developers.google.com/maps/tt/route-optimization/experimental/otlr/make-request for more details.
Declaration
public virtual Operation<OptimizeToursUriResponse, OptimizeToursUriMetadata> OptimizeToursUri(OptimizeToursUriRequest request, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| OptimizeToursUriRequest | request | 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 |
|---|---|
| Operation<OptimizeToursUriResponse, OptimizeToursUriMetadata> | The RPC response. |
Sample code
// Create client
RouteOptimizationClient routeOptimizationClient = RouteOptimizationClient.Create();
// Initialize request argument(s)
OptimizeToursUriRequest request = new OptimizeToursUriRequest
{
Parent = "",
Input = new Uri(),
Output = new Uri(),
};
// Make the request
Operation<OptimizeToursUriResponse, OptimizeToursUriMetadata> response = routeOptimizationClient.OptimizeToursUri(request);
// Poll until the returned long-running operation is complete
Operation<OptimizeToursUriResponse, OptimizeToursUriMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
OptimizeToursUriResponse 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<OptimizeToursUriResponse, OptimizeToursUriMetadata> retrievedResponse = routeOptimizationClient.PollOnceOptimizeToursUri(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
OptimizeToursUriResponse retrievedResult = retrievedResponse.Result;
}
OptimizeToursUriAsync(OptimizeToursUriRequest, CallSettings)
This is a variant of the [OptimizeToursLongRunning][google.maps.routeoptimization.v1.RouteOptimization.OptimizeToursLongRunning] method designed for optimizations with large timeout values and large input/output sizes.
The client specifies the URI of the OptimizeToursRequest stored
in Google Cloud Storage and the server writes the OptimizeToursResponse
to a client-specified Google Cloud Storage URI.
This method should be preferred over the OptimizeTours method for
optimizations that take longer than a few minutes and input/output sizes
that are larger than 8MB, though it can be used for shorter and smaller
optimizations as well.
The returned [long-running operation][google.longrunning.Operation] (LRO)
will have a name of the format
<parent>/operations/<operation_id> and can be used to track
progress of the computation. The
[metadata][google.longrunning.Operation.metadata] field type is
[OptimizeToursLongRunningMetadata][google.maps.routeoptimization.v1.OptimizeToursUriMetadata].
The [response][google.longrunning.Operation.response] field type is
[OptimizeToursUriResponse][google.maps.routeoptimization.v1.OptimizeToursUriResponse],
if successful.
Experimental: See https://developers.google.com/maps/tt/route-optimization/experimental/otlr/make-request for more details.
Declaration
public virtual Task<Operation<OptimizeToursUriResponse, OptimizeToursUriMetadata>> OptimizeToursUriAsync(OptimizeToursUriRequest request, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| OptimizeToursUriRequest | request | 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 |
|---|---|
| Task<Operation<OptimizeToursUriResponse, OptimizeToursUriMetadata>> | A Task containing the RPC response. |
Sample code
// Create client
RouteOptimizationClient routeOptimizationClient = await RouteOptimizationClient.CreateAsync();
// Initialize request argument(s)
OptimizeToursUriRequest request = new OptimizeToursUriRequest
{
Parent = "",
Input = new Uri(),
Output = new Uri(),
};
// Make the request
Operation<OptimizeToursUriResponse, OptimizeToursUriMetadata> response = await routeOptimizationClient.OptimizeToursUriAsync(request);
// Poll until the returned long-running operation is complete
Operation<OptimizeToursUriResponse, OptimizeToursUriMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
OptimizeToursUriResponse 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<OptimizeToursUriResponse, OptimizeToursUriMetadata> retrievedResponse = await routeOptimizationClient.PollOnceOptimizeToursUriAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
OptimizeToursUriResponse retrievedResult = retrievedResponse.Result;
}
OptimizeToursUriAsync(OptimizeToursUriRequest, CancellationToken)
This is a variant of the [OptimizeToursLongRunning][google.maps.routeoptimization.v1.RouteOptimization.OptimizeToursLongRunning] method designed for optimizations with large timeout values and large input/output sizes.
The client specifies the URI of the OptimizeToursRequest stored
in Google Cloud Storage and the server writes the OptimizeToursResponse
to a client-specified Google Cloud Storage URI.
This method should be preferred over the OptimizeTours method for
optimizations that take longer than a few minutes and input/output sizes
that are larger than 8MB, though it can be used for shorter and smaller
optimizations as well.
The returned [long-running operation][google.longrunning.Operation] (LRO)
will have a name of the format
<parent>/operations/<operation_id> and can be used to track
progress of the computation. The
[metadata][google.longrunning.Operation.metadata] field type is
[OptimizeToursLongRunningMetadata][google.maps.routeoptimization.v1.OptimizeToursUriMetadata].
The [response][google.longrunning.Operation.response] field type is
[OptimizeToursUriResponse][google.maps.routeoptimization.v1.OptimizeToursUriResponse],
if successful.
Experimental: See https://developers.google.com/maps/tt/route-optimization/experimental/otlr/make-request for more details.
Declaration
public virtual Task<Operation<OptimizeToursUriResponse, OptimizeToursUriMetadata>> OptimizeToursUriAsync(OptimizeToursUriRequest request, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| OptimizeToursUriRequest | request | The request object containing all of the parameters for the API call. |
| CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
| Type | Description |
|---|---|
| Task<Operation<OptimizeToursUriResponse, OptimizeToursUriMetadata>> | A Task containing the RPC response. |
Sample code
// Create client
RouteOptimizationClient routeOptimizationClient = await RouteOptimizationClient.CreateAsync();
// Initialize request argument(s)
OptimizeToursUriRequest request = new OptimizeToursUriRequest
{
Parent = "",
Input = new Uri(),
Output = new Uri(),
};
// Make the request
Operation<OptimizeToursUriResponse, OptimizeToursUriMetadata> response = await routeOptimizationClient.OptimizeToursUriAsync(request);
// Poll until the returned long-running operation is complete
Operation<OptimizeToursUriResponse, OptimizeToursUriMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
OptimizeToursUriResponse 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<OptimizeToursUriResponse, OptimizeToursUriMetadata> retrievedResponse = await routeOptimizationClient.PollOnceOptimizeToursUriAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
OptimizeToursUriResponse retrievedResult = retrievedResponse.Result;
}
PollOnceBatchOptimizeTours(string, CallSettings)
Poll an operation once, using an operationName from a previous invocation of BatchOptimizeTours
.
Declaration
public virtual Operation<BatchOptimizeToursResponse, BatchOptimizeToursMetadata> PollOnceBatchOptimizeTours(string operationName, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | operationName | The name of a previously invoked operation. Must not be |
| CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
| Type | Description |
|---|---|
| Operation<BatchOptimizeToursResponse, BatchOptimizeToursMetadata> | The result of polling the operation. |
PollOnceBatchOptimizeToursAsync(string, CallSettings)
Asynchronously poll an operation once, using an operationName from a previous invocation of
BatchOptimizeTours.
Declaration
public virtual Task<Operation<BatchOptimizeToursResponse, BatchOptimizeToursMetadata>> PollOnceBatchOptimizeToursAsync(string operationName, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | operationName | The name of a previously invoked operation. Must not be |
| CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
| Type | Description |
|---|---|
| Task<Operation<BatchOptimizeToursResponse, BatchOptimizeToursMetadata>> | A task representing the result of polling the operation. |
PollOnceOptimizeToursLongRunning(string, CallSettings)
Poll an operation once, using an operationName from a previous invocation of
OptimizeToursLongRunning.
Declaration
public virtual Operation<OptimizeToursResponse, OptimizeToursLongRunningMetadata> PollOnceOptimizeToursLongRunning(string operationName, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | operationName | The name of a previously invoked operation. Must not be |
| CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
| Type | Description |
|---|---|
| Operation<OptimizeToursResponse, OptimizeToursLongRunningMetadata> | The result of polling the operation. |
PollOnceOptimizeToursLongRunningAsync(string, CallSettings)
Asynchronously poll an operation once, using an operationName from a previous invocation of
OptimizeToursLongRunning.
Declaration
public virtual Task<Operation<OptimizeToursResponse, OptimizeToursLongRunningMetadata>> PollOnceOptimizeToursLongRunningAsync(string operationName, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | operationName | The name of a previously invoked operation. Must not be |
| CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
| Type | Description |
|---|---|
| Task<Operation<OptimizeToursResponse, OptimizeToursLongRunningMetadata>> | A task representing the result of polling the operation. |
PollOnceOptimizeToursUri(string, CallSettings)
Poll an operation once, using an operationName from a previous invocation of OptimizeToursUri.
Declaration
public virtual Operation<OptimizeToursUriResponse, OptimizeToursUriMetadata> PollOnceOptimizeToursUri(string operationName, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | operationName | The name of a previously invoked operation. Must not be |
| CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
| Type | Description |
|---|---|
| Operation<OptimizeToursUriResponse, OptimizeToursUriMetadata> | The result of polling the operation. |
PollOnceOptimizeToursUriAsync(string, CallSettings)
Asynchronously poll an operation once, using an operationName from a previous invocation of
OptimizeToursUri.
Declaration
public virtual Task<Operation<OptimizeToursUriResponse, OptimizeToursUriMetadata>> PollOnceOptimizeToursUriAsync(string operationName, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | operationName | The name of a previously invoked operation. Must not be |
| CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
| Type | Description |
|---|---|
| Task<Operation<OptimizeToursUriResponse, OptimizeToursUriMetadata>> | A task representing the result of polling the operation. |
ShutdownDefaultChannelsAsync()
Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.
Declaration
public static Task ShutdownDefaultChannelsAsync()
Returns
| Type | Description |
|---|---|
| Task | A task representing the asynchronous shutdown operation. |
Remarks
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.