OptimizeToursRequest

Struct OptimizeToursRequest 

Source
#[non_exhaustive]
pub struct OptimizeToursRequest {
Show 18 fields pub parent: String, pub timeout: Option<Duration>, pub model: Option<ShipmentModel>, pub solving_mode: SolvingMode, pub search_mode: SearchMode, pub injected_first_solution_routes: Vec<ShipmentRoute>, pub injected_solution_constraint: Option<InjectedSolutionConstraint>, pub refresh_details_routes: Vec<ShipmentRoute>, pub interpret_injected_solutions_using_labels: bool, pub consider_road_traffic: bool, pub populate_polylines: bool, pub populate_transition_polylines: bool, pub allow_large_deadline_despite_interruption_risk: bool, pub use_geodesic_distances: bool, pub geodesic_meters_per_second: Option<f64>, pub max_validation_errors: Option<i32>, pub label: String, pub populate_travel_step_polylines: bool, /* private fields */
}
Expand description

Request to be given to a tour optimization solver which defines the shipment model to solve as well as optimization parameters.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§parent: String

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.

§timeout: Option<Duration>

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.

§model: Option<ShipmentModel>

Shipment model to solve.

§solving_mode: SolvingMode

By default, the solving mode is DEFAULT_SOLVE (0).

§search_mode: SearchMode

Search mode used to solve the request.

§injected_first_solution_routes: Vec<ShipmentRoute>

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 <= visits[0].start_time <= visits[1].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 is empty or its vehicle_index is included in 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.

§injected_solution_constraint: Option<InjectedSolutionConstraint>

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.

§refresh_details_routes: Vec<ShipmentRoute>

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.

§interpret_injected_solutions_using_labels: bool

If true:

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:

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 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 (resp. 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.

§consider_road_traffic: bool

Consider traffic estimation in calculating ShipmentRoute fields Transition.travel_duration, Visit.start_time, and vehicle_end_time; in setting the ShipmentRoute.has_traffic_infeasibilities field, and in calculating the OptimizeToursResponse.total_cost field.

§populate_polylines: bool

If true, polylines will be populated in response ShipmentRoutes.

§populate_transition_polylines: bool

If true, polylines will be populated in response ShipmentRoute.transitions. Note that in this case, the polylines will also be populated in the deprecated travel_steps.

§allow_large_deadline_despite_interruption_risk: bool

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.

§use_geodesic_distances: bool

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.

§geodesic_meters_per_second: Option<f64>

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.

§max_validation_errors: Option<i32>

Truncates the number of validation errors returned. These 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 field. This defaults to 100 and is capped at 10,000.

§label: String

Label that may be used to identify this request, reported back in the OptimizeToursResponse.request_label.

§populate_travel_step_polylines: bool
👎Deprecated

Deprecated: Use OptimizeToursRequest.populate_transition_polylines instead. If true, polylines will be populated in response ShipmentRoute.transitions. Note that in this case, the polylines will also be populated in the deprecated travel_steps.

Implementations§

Source§

impl OptimizeToursRequest

Source

pub fn new() -> Self

Source

pub fn set_parent<T: Into<String>>(self, v: T) -> Self

Sets the value of parent.

Source

pub fn set_timeout<T>(self, v: T) -> Self
where T: Into<Duration>,

Sets the value of timeout.

Source

pub fn set_or_clear_timeout<T>(self, v: Option<T>) -> Self
where T: Into<Duration>,

Sets or clears the value of timeout.

Source

pub fn set_model<T>(self, v: T) -> Self
where T: Into<ShipmentModel>,

Sets the value of model.

Source

pub fn set_or_clear_model<T>(self, v: Option<T>) -> Self
where T: Into<ShipmentModel>,

Sets or clears the value of model.

Source

pub fn set_solving_mode<T: Into<SolvingMode>>(self, v: T) -> Self

Sets the value of solving_mode.

Source

pub fn set_search_mode<T: Into<SearchMode>>(self, v: T) -> Self

Sets the value of search_mode.

Source

pub fn set_injected_first_solution_routes<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<ShipmentRoute>,

Sets the value of injected_first_solution_routes.

Source

pub fn set_injected_solution_constraint<T>(self, v: T) -> Self

Sets the value of injected_solution_constraint.

Source

pub fn set_or_clear_injected_solution_constraint<T>(self, v: Option<T>) -> Self

Sets or clears the value of injected_solution_constraint.

Source

pub fn set_refresh_details_routes<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<ShipmentRoute>,

Sets the value of refresh_details_routes.

Source

pub fn set_interpret_injected_solutions_using_labels<T: Into<bool>>( self, v: T, ) -> Self

Source

pub fn set_consider_road_traffic<T: Into<bool>>(self, v: T) -> Self

Sets the value of consider_road_traffic.

Source

pub fn set_populate_polylines<T: Into<bool>>(self, v: T) -> Self

Sets the value of populate_polylines.

Source

pub fn set_populate_transition_polylines<T: Into<bool>>(self, v: T) -> Self

Sets the value of populate_transition_polylines.

Source

pub fn set_allow_large_deadline_despite_interruption_risk<T: Into<bool>>( self, v: T, ) -> Self

Source

pub fn set_use_geodesic_distances<T: Into<bool>>(self, v: T) -> Self

Sets the value of use_geodesic_distances.

Source

pub fn set_geodesic_meters_per_second<T>(self, v: T) -> Self
where T: Into<f64>,

Sets the value of geodesic_meters_per_second.

Source

pub fn set_or_clear_geodesic_meters_per_second<T>(self, v: Option<T>) -> Self
where T: Into<f64>,

Sets or clears the value of geodesic_meters_per_second.

Source

pub fn set_max_validation_errors<T>(self, v: T) -> Self
where T: Into<i32>,

Sets the value of max_validation_errors.

Source

pub fn set_or_clear_max_validation_errors<T>(self, v: Option<T>) -> Self
where T: Into<i32>,

Sets or clears the value of max_validation_errors.

Source

pub fn set_label<T: Into<String>>(self, v: T) -> Self

Sets the value of label.

Source

pub fn set_populate_travel_step_polylines<T: Into<bool>>(self, v: T) -> Self

👎Deprecated

Sets the value of populate_travel_step_polylines.

Trait Implementations§

Source§

impl Clone for OptimizeToursRequest

Source§

fn clone(&self) -> OptimizeToursRequest

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for OptimizeToursRequest

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for OptimizeToursRequest

Source§

fn default() -> OptimizeToursRequest

Returns the “default value” for a type. Read more
Source§

impl Message for OptimizeToursRequest

Source§

fn typename() -> &'static str

The typename of this message.
Source§

impl PartialEq for OptimizeToursRequest

Source§

fn eq(&self, other: &OptimizeToursRequest) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for OptimizeToursRequest

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,