Class v1.FleetRoutingClient (2.1.1)

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. v1

Package

@google-cloud/optimization

Constructors

(constructor)(opts, gaxInstance)

constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);

Construct an instance of FleetRoutingClient.

Parameters
NameDescription
opts ClientOptions
gaxInstance typeof gax | typeof gax.fallback

: loaded instance of google-gax. Useful if you need to avoid loading the default gRPC version and want to use the fallback HTTP implementation. Load only fallback version and pass it to the constructor: ``` const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC const client = new FleetRoutingClient({fallback: 'rest'}, gax); ```

Properties

apiEndpoint

static get apiEndpoint(): string;

The DNS address for this API service - same as servicePath(), exists for compatibility reasons.

auth

auth: gax.GoogleAuth;

descriptors

descriptors: Descriptors;

fleetRoutingStub

fleetRoutingStub?: Promise<{
        [name: string]: Function;
    }>;

innerApiCalls

innerApiCalls: {
        [name: string]: Function;
    };

operationsClient

operationsClient: gax.OperationsClient;

port

static get port(): number;

The port for this API service.

scopes

static get scopes(): string[];

The scopes needed to make gRPC calls for every method defined in this service.

servicePath

static get servicePath(): string;

The DNS address for this API service.

warn

warn: (code: string, message: string, warnType?: string) => void;

Methods

batchOptimizeTours(request, options)

batchOptimizeTours(request?: protos.google.cloud.optimization.v1.IBatchOptimizeToursRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.optimization.v1.IBatchOptimizeToursResponse, protos.google.cloud.optimization.v1.IAsyncModelMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

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
NameDescription
request protos.google.cloud.optimization.v1.IBatchOptimizeToursRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.optimization.v1.IBatchOptimizeToursResponse, protos.google.cloud.optimization.v1.IAsyncModelMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Target project and location to make a call.
   *  Format: `projects/{project-id}/locations/{location-id}`.
   *  If no location is specified, a region will be chosen automatically.
   */
  // const parent = 'abc123'
  /**
   *  Required. Input/Output information each purchase model, such as file paths and data
   *  formats.
   */
  // const modelConfigs = 1234

  // Imports the Optimization library
  const {FleetRoutingClient} = require('@google-cloud/optimization').v1;

  // Instantiates a client
  const optimizationClient = new FleetRoutingClient();

  async function callBatchOptimizeTours() {
    // Construct request
    const request = {
      parent,
      timeout: {
        seconds: '1000',
      },
      model: {
        shipments: [
          {
            deliveries: [
              {
                arrivalLocation: {
                  latitude,
                  longitude,
                },
                duration: {
                  seconds: duration,
                },
                timeWindows: [
                  {
                    endTime: new Date(date),
                    startTime: new Date(date),
                  },
                ],
              },
            ],
            loadDemands: {
              weight: {
                amount,
              },
            },
            pickups: [
              {
                arrivalLocation: {
                  latitude,
                  longitude,
                },
                duration: {
                  seconds: duration,
                },
                timeWindows: [
                  {
                    endTime: new Date(date),
                    startTime: new Date(date),
                  },
                ],
              },
            ],
          },
          {
            deliveries: [
              {
                arrivalLocation: {
                  latitude,
                  longitude,
                },
                duration: {
                  seconds: duration,
                },
                timeWindows: [
                  {
                    endTime: new Date(date),
                    startTime: new Date(date),
                  },
                ],
              },
            ],
            loadDemands: {
              weight: {
                amount,
              },
            },
            pickups: [
              {
                arrivalLocation: {
                  latitude,
                  longitude,
                },
                duration: {
                  seconds: duration,
                },
                timeWindows: [
                  {
                    endTime: new Date(date),
                    startTime: new Date(date),
                  },
                ],
              },
            ],
          },
        ],
        vehicles: [
          {
            loadLimits: {
              weight: {
                maxLoad,
              },
            },
            endLocation: {
              latitude,
              longitude,
            },
            startLocation: {
              latitude,
              longitude,
            },
          },
          {
            loadLimits: {
              weight: {
                maxLoad,
              },
            },
            endLocation: {
              latitude,
              longitude,
            },
            startLocation: {
              latitude,
              longitude,
            },
          },
        ],
      },
    };

    // Run request
    const [operation] = await optimizationClient.optimizeTours(request);
    console.log(operation);
  }

  callBatchOptimizeTours();

batchOptimizeTours(request, options, callback)

batchOptimizeTours(request: protos.google.cloud.optimization.v1.IBatchOptimizeToursRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.optimization.v1.IBatchOptimizeToursResponse, protos.google.cloud.optimization.v1.IAsyncModelMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.optimization.v1.IBatchOptimizeToursRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.optimization.v1.IBatchOptimizeToursResponse, protos.google.cloud.optimization.v1.IAsyncModelMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

batchOptimizeTours(request, callback)

batchOptimizeTours(request: protos.google.cloud.optimization.v1.IBatchOptimizeToursRequest, callback: Callback<LROperation<protos.google.cloud.optimization.v1.IBatchOptimizeToursResponse, protos.google.cloud.optimization.v1.IAsyncModelMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.optimization.v1.IBatchOptimizeToursRequest
callback Callback<LROperation<protos.google.cloud.optimization.v1.IBatchOptimizeToursResponse, protos.google.cloud.optimization.v1.IAsyncModelMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

checkBatchOptimizeToursProgress(name)

checkBatchOptimizeToursProgress(name: string): Promise<LROperation<protos.google.cloud.optimization.v1.BatchOptimizeToursResponse, protos.google.cloud.optimization.v1.AsyncModelMetadata>>;

Check the status of the long running operation returned by batchOptimizeTours().

Parameter
NameDescription
name string

The operation name that will be passed.

Returns
TypeDescription
Promise<LROperation<protos.google.cloud.optimization.v1.BatchOptimizeToursResponse, protos.google.cloud.optimization.v1.AsyncModelMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Target project and location to make a call.
   *  Format: `projects/{project-id}/locations/{location-id}`.
   *  If no location is specified, a region will be chosen automatically.
   */
  // const parent = 'abc123'
  /**
   *  Required. Input/Output information each purchase model, such as file paths and data
   *  formats.
   */
  // const modelConfigs = 1234

  // Imports the Optimization library
  const {FleetRoutingClient} = require('@google-cloud/optimization').v1;

  // Instantiates a client
  const optimizationClient = new FleetRoutingClient();

  async function callBatchOptimizeTours() {
    // Construct request
    const request = {
      parent,
      timeout: {
        seconds: '1000',
      },
      model: {
        shipments: [
          {
            deliveries: [
              {
                arrivalLocation: {
                  latitude,
                  longitude,
                },
                duration: {
                  seconds: duration,
                },
                timeWindows: [
                  {
                    endTime: new Date(date),
                    startTime: new Date(date),
                  },
                ],
              },
            ],
            loadDemands: {
              weight: {
                amount,
              },
            },
            pickups: [
              {
                arrivalLocation: {
                  latitude,
                  longitude,
                },
                duration: {
                  seconds: duration,
                },
                timeWindows: [
                  {
                    endTime: new Date(date),
                    startTime: new Date(date),
                  },
                ],
              },
            ],
          },
          {
            deliveries: [
              {
                arrivalLocation: {
                  latitude,
                  longitude,
                },
                duration: {
                  seconds: duration,
                },
                timeWindows: [
                  {
                    endTime: new Date(date),
                    startTime: new Date(date),
                  },
                ],
              },
            ],
            loadDemands: {
              weight: {
                amount,
              },
            },
            pickups: [
              {
                arrivalLocation: {
                  latitude,
                  longitude,
                },
                duration: {
                  seconds: duration,
                },
                timeWindows: [
                  {
                    endTime: new Date(date),
                    startTime: new Date(date),
                  },
                ],
              },
            ],
          },
        ],
        vehicles: [
          {
            loadLimits: {
              weight: {
                maxLoad,
              },
            },
            endLocation: {
              latitude,
              longitude,
            },
            startLocation: {
              latitude,
              longitude,
            },
          },
          {
            loadLimits: {
              weight: {
                maxLoad,
              },
            },
            endLocation: {
              latitude,
              longitude,
            },
            startLocation: {
              latitude,
              longitude,
            },
          },
        ],
      },
    };

    // Run request
    const [operation] = await optimizationClient.optimizeTours(request);
    console.log(operation);
  }

  callBatchOptimizeTours();

close()

close(): Promise<void>;

Terminate the gRPC channel and close the client.

The client will no longer be usable and all future behavior is undefined.

Returns
TypeDescription
Promise<void>

{Promise} A promise that resolves when the client is closed.

getProjectId()

getProjectId(): Promise<string>;
Returns
TypeDescription
Promise<string>

getProjectId(callback)

getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter
NameDescription
callback Callback<string, undefined, undefined>
Returns
TypeDescription
void

initialize()

initialize(): Promise<{
        [name: string]: Function;
    }>;

Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.

You can await on this method if you want to make sure the client is initialized.

Returns
TypeDescription
Promise<{ [name: string]: Function; }>

{Promise} A promise that resolves to an authenticated service stub.

optimizeTours(request, options)

optimizeTours(request?: protos.google.cloud.optimization.v1.IOptimizeToursRequest, options?: CallOptions): Promise<[
        protos.google.cloud.optimization.v1.IOptimizeToursResponse,
        protos.google.cloud.optimization.v1.IOptimizeToursRequest | undefined,
        {} | undefined
    ]>;

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
NameDescription
request protos.google.cloud.optimization.v1.IOptimizeToursRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.optimization.v1.IOptimizeToursResponse, protos.google.cloud.optimization.v1.IOptimizeToursRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [OptimizeToursResponse]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Target project and location to make a call.
   *  Format: `projects/{project-id}/locations/{location-id}`.
   *  If no location is specified, a region will be chosen automatically.
   */
  // const parent = 'abc123'
  /**
   *  If this timeout is set, the server returns a response before the timeout
   *  period has elapsed or the server deadline for synchronous requests is
   *  reached, whichever is sooner.
   *  For asynchronous requests, the server will generate a solution (if
   *  possible) before the timeout has elapsed.
   */
  // const timeout = {}
  /**
   *  Shipment model to solve.
   */
  // const model = {}
  /**
   *  By default, the solving mode is `DEFAULT_SOLVE` (0).
   */
  // const solvingMode = {}
  /**
   *  Truncates the number of validation errors returned. Those errors are
   *  typically attached to an INVALID_ARGUMENT error payload as a BadRequest
   *  error detail (https://cloud.google.com/apis/design/errors#error_details),
   *  unless solving_mode=VALIDATE_ONLY: see the
   *  OptimizeToursResponse.validation_errors google.cloud.optimization.v1.OptimizeToursResponse.validation_errors 
   *  field.
   *  This defaults to 100 and is capped at 10,000.
   */
  // const maxValidationErrors = 1234
  /**
   *  Search mode used to solve the request.
   */
  // const searchMode = {}
  /**
   *  Guide the optimization algorithm in finding a first solution that is
   *  similar to a previous solution.
   *  The model is constrained when the first solution is built.
   *  Any shipments not performed on a route are implicitly skipped in the first
   *  solution, but they may be performed in successive solutions.
   *  The solution must satisfy some basic validity assumptions:
   *    * for all routes, `vehicle_index` must be in range and not be duplicated.
   *    * for all visits, `shipment_index` and `visit_request_index` must be
   *      in range.
   *    * a shipment may only be referenced on one route.
   *    * the pickup of a pickup-delivery shipment must be performed before
   *      the delivery.
   *    * no more than one pickup alternative or delivery alternative of
   *      a shipment may be performed.
   *    * for all routes, times are increasing (i.e., `vehicle_start_time
   *      <= visits0.start_time=""><= visits1.start_time="" ...="" *=""><= vehicle_end_time`).="" *="" *="" a="" shipment="" may="" only="" be="" performed="" on="" a="" vehicle="" that="" is="" allowed.="" a="" *="" vehicle="" is="" allowed="" if="" shipment.allowed_vehicle_indices="" google.cloud.optimization.v1.shipment.allowed_vehicle_indices="" is="" empty="" or="" *="" its="" `vehicle_index`="" is="" included="" in="" *="" shipment.allowed_vehicle_indices="" google.cloud.optimization.v1.shipment.allowed_vehicle_indices.="" *="" if="" the="" injected="" solution="" is="" not="" feasible,="" a="" validation="" error="" is="" not="" *="" necessarily="" returned="" and="" an="" error="" indicating="" infeasibility="" may="" be="" returned="" *="" instead.="" */="" const="" injectedfirstsolutionroutes="1234" *="" *="" constrain="" the="" optimization="" algorithm="" to="" find="" a="" final="" solution="" that="" is="" *="" similar="" to="" a="" previous="" solution.="" for="" example,="" this="" may="" be="" used="" to="" freeze="" *="" portions="" of="" routes="" which="" have="" already="" been="" completed="" or="" which="" are="" to="" be="" *="" completed="" but="" must="" not="" be="" modified.="" *="" if="" the="" injected="" solution="" is="" not="" feasible,="" a="" validation="" error="" is="" not="" *="" necessarily="" returned="" and="" an="" error="" indicating="" infeasibility="" may="" be="" returned="" *="" instead.="" */="" const="" injectedsolutionconstraint="{}" *="" *="" if="" non-empty,="" the="" given="" routes="" will="" be="" refreshed,="" without="" modifying="" their="" *="" underlying="" sequence="" of="" visits="" or="" travel="" times:="" only="" other="" details="" will="" be="" *="" updated.="" this="" does="" not="" solve="" the="" model.="" *="" as="" of="" 2020/11,="" this="" only="" populates="" the="" polylines="" of="" non-empty="" routes="" and="" *="" requires="" that="" `populate_polylines`="" is="" true.="" *="" the="" `route_polyline`="" fields="" of="" the="" passed-in="" routes="" may="" be="" inconsistent="" *="" with="" route="" `transitions`.="" *="" this="" field="" must="" not="" be="" used="" together="" with="" `injected_first_solution_routes`="" *="" or="" `injected_solution_constraint`.="" *="" `shipment.ignore`="" and="" `vehicle.ignore`="" have="" no="" effect="" on="" the="" behavior.="" *="" polylines="" are="" still="" populated="" between="" all="" visits="" in="" all="" non-empty="" routes="" *="" regardless="" of="" whether="" the="" related="" shipments="" or="" vehicles="" are="" ignored.="" */="" const="" refreshdetailsroutes="1234" *="" *="" if="" true:="" *="" *="" uses="" shipmentroute.vehicle_label="" google.cloud.optimization.v1.shipmentroute.vehicle_label="" instead="" of="" `vehicle_index`="" to="" *="" match="" routes="" in="" an="" injected="" solution="" with="" vehicles="" in="" the="" request;="" *="" reuses="" the="" mapping="" of="" original="" shipmentroute.vehicle_index="" google.cloud.optimization.v1.shipmentroute.vehicle_index="" to="" new="" *="" shipmentroute.vehicle_index="" google.cloud.optimization.v1.shipmentroute.vehicle_index="" to="" update="" *="" constraintrelaxation.vehicle_indices="" google.cloud.optimization.v1.injectedsolutionconstraint.constraintrelaxation.vehicle_indices="" *="" if="" non-empty,="" but="" the="" mapping="" must="" be="" unambiguous="" (i.e.,="" multiple="" *="" `shipmentroute`s="" must="" not="" share="" the="" same="" original="" `vehicle_index`).="" *="" *="" uses="" shipmentroute.visit.shipment_label="" google.cloud.optimization.v1.shipmentroute.visit.shipment_label="" instead="" of="" `shipment_index`="" *="" to="" match="" visits="" in="" an="" injected="" solution="" with="" shipments="" in="" the="" request;="" *="" *="" uses="" skippedshipment.label="" google.cloud.optimization.v1.skippedshipment.label="" instead="" of="" skippedshipment.index="" google.cloud.optimization.v1.skippedshipment.index="" to="" *="" match="" skipped="" shipments="" in="" the="" injected="" solution="" with="" request="" *="" shipments.="" *="" this="" interpretation="" applies="" to="" the="" `injected_first_solution_routes`,="" *="" `injected_solution_constraint`,="" and="" `refresh_details_routes`="" fields.="" *="" it="" can="" be="" used="" when="" shipment="" or="" vehicle="" indices="" in="" the="" request="" have="" *="" changed="" since="" the="" solution="" was="" created,="" perhaps="" because="" shipments="" or="" *="" vehicles="" have="" been="" removed="" from="" or="" added="" to="" the="" request.="" *="" if="" true,="" labels="" in="" the="" following="" categories="" must="" appear="" at="" most="" once="" in="" *="" their="" category:="" *="" *="" vehicle.label="" google.cloud.optimization.v1.vehicle.label="" in="" the="" request;="" *="" *="" shipment.label="" google.cloud.optimization.v1.shipment.label="" in="" the="" request;="" *="" *="" shipmentroute.vehicle_label="" google.cloud.optimization.v1.shipmentroute.vehicle_label="" in="" the="" injected="" solution;="" *="" *="" skippedshipment.label="" google.cloud.optimization.v1.skippedshipment.label="" and="" shipmentroute.visit.shipment_label="" google.cloud.optimization.v1.shipmentroute.visit.shipment_label="" in="" *="" the="" injected="" solution="" (except="" pickup/delivery="" visit="" pairs,="" whose="" *="" `shipment_label`="" must="" appear="" twice).="" *="" if="" a="" `vehicle_label`="" in="" the="" injected="" solution="" does="" not="" correspond="" to="" a="" *="" request="" vehicle,="" the="" corresponding="" route="" is="" removed="" from="" the="" solution="" *="" along="" with="" its="" visits.="" if="" a="" `shipment_label`="" in="" the="" injected="" solution="" does="" *="" not="" correspond="" to="" a="" request="" shipment,="" the="" corresponding="" visit="" is="" removed="" *="" from="" the="" solution.="" if="" a="" skippedshipment.label="" google.cloud.optimization.v1.skippedshipment.label="" in="" the="" injected="" solution="" *="" does="" not="" correspond="" to="" a="" request="" shipment,="" the="" `skippedshipment`="" is="" removed="" *="" from="" the="" solution.="" *="" removing="" route="" visits="" or="" entire="" routes="" from="" an="" injected="" solution="" may="" *="" have="" an="" effect="" on="" the="" implied="" constraints,="" which="" may="" lead="" to="" change="" in="" *="" solution,="" validation="" errors,="" or="" infeasibility.="" *="" note:="" the="" caller="" must="" ensure="" that="" each="" vehicle.label="" google.cloud.optimization.v1.vehicle.label="" *="" (resp.="" shipment.label="" google.cloud.optimization.v1.shipment.label)="" uniquely="" identifies="" a="" vehicle="" (resp.="" shipment)="" *="" entity="" used="" across="" the="" two="" relevant="" requests:="" the="" past="" request="" that="" *="" produced="" the="" `optimizetoursresponse`="" used="" in="" the="" injected="" solution="" and="" the="" *="" current="" request="" that="" includes="" the="" injected="" solution.="" the="" uniqueness="" checks="" *="" described="" above="" are="" not="" enough="" to="" guarantee="" this="" requirement.="" */="" const="" interpretinjectedsolutionsusinglabels="true" *="" *="" consider="" traffic="" estimation="" in="" calculating="" `shipmentroute`="" fields="" *="" transition.travel_duration="" google.cloud.optimization.v1.shipmentroute.transition.travel_duration,="" *="" visit.start_time="" google.cloud.optimization.v1.shipmentroute.visit.start_time,="" *="" and="" `vehicle_end_time`;="" in="" setting="" the="" *="" shipmentroute.has_traffic_infeasibilities="" google.cloud.optimization.v1.shipmentroute.has_traffic_infeasibilities="" field,="" and="" in="" calculating="" the="" *="" optimizetoursresponse.total_cost="" google.cloud.optimization.v1.optimizetoursresponse.total_cost="" field.="" */="" const="" considerroadtraffic="true" *="" *="" if="" true,="" polylines="" will="" be="" populated="" in="" response="" `shipmentroute`s.="" */="" const="" populatepolylines="true" *="" *="" if="" true,="" polylines="" will="" be="" populated="" in="" response="" *="" shipmentroute.transitions="" google.cloud.optimization.v1.shipmentroute.transitions.="" *="" note="" that="" in="" this="" case,="" the="" polylines="" will="" also="" be="" populated="" in="" the="" *="" deprecated="" `travel_steps`.="" */="" const="" populatetransitionpolylines="true" *="" *="" if="" this="" is="" set,="" then="" the="" request="" can="" have="" a="" deadline="" *="" (see="" https://grpc.io/blog/deadlines)="" of="" up="" to="" 60="" minutes.="" *="" otherwise,="" the="" maximum="" deadline="" is="" only="" 30="" minutes.="" *="" note="" that="" long-lived="" requests="" have="" a="" significantly="" larger="" (but="" still="" small)="" *="" risk="" of="" interruption.="" */="" const="" allowlargedeadlinedespiteinterruptionrisk="true" *="" *="" if="" true,="" travel="" distances="" will="" be="" computed="" using="" geodesic="" distances="" instead="" *="" of="" google="" maps="" distances,="" and="" travel="" times="" will="" be="" computed="" using="" geodesic="" *="" distances="" with="" a="" speed="" defined="" by="" `geodesic_meters_per_second`.="" */="" const="" usegeodesicdistances="true" *="" *="" when="" `use_geodesic_distances`="" is="" true,="" this="" field="" must="" be="" set="" and="" defines="" *="" the="" speed="" applied="" to="" compute="" travel="" times.="" its="" value="" must="" be="" at="" least="" 1.0="" *="" meters/seconds.="" */="" const="" geodesicmeterspersecond="1234" *="" *="" label="" that="" may="" be="" used="" to="" identify="" this="" request,="" reported="" back="" in="" the="" *="" optimizetoursresponse.request_label="" google.cloud.optimization.v1.optimizetoursresponse.request_label.="" */="" const="" label='abc123' imports="" the="" optimization="" library="" const="" {fleetroutingclient}="require('@google-cloud/optimization').v1;" instantiates="" a="" client="" const="" optimizationclient="new" fleetroutingclient();="" async="" function="" calloptimizetours()="" {="" construct="" request="" const="" request="{" parent,="" };="" run="" request="" const="" response="await" optimizationclient.optimizetours(request);="" console.log(response);="" }="" calloptimizetours();="">

optimizeTours(request, options, callback)

optimizeTours(request: protos.google.cloud.optimization.v1.IOptimizeToursRequest, options: CallOptions, callback: Callback<protos.google.cloud.optimization.v1.IOptimizeToursResponse, protos.google.cloud.optimization.v1.IOptimizeToursRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.optimization.v1.IOptimizeToursRequest
options CallOptions
callback Callback<protos.google.cloud.optimization.v1.IOptimizeToursResponse, protos.google.cloud.optimization.v1.IOptimizeToursRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

optimizeTours(request, callback)

optimizeTours(request: protos.google.cloud.optimization.v1.IOptimizeToursRequest, callback: Callback<protos.google.cloud.optimization.v1.IOptimizeToursResponse, protos.google.cloud.optimization.v1.IOptimizeToursRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.optimization.v1.IOptimizeToursRequest
callback Callback<protos.google.cloud.optimization.v1.IOptimizeToursResponse, protos.google.cloud.optimization.v1.IOptimizeToursRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void