Shipment

Struct Shipment 

Source
#[non_exhaustive]
pub struct Shipment {
Show 14 fields pub pickups: Vec<VisitRequest>, pub deliveries: Vec<VisitRequest>, pub load_demands: HashMap<String, Load>, pub penalty_cost: Option<f64>, pub allowed_vehicle_indices: Vec<i32>, pub costs_per_vehicle: Vec<f64>, pub costs_per_vehicle_indices: Vec<i32>, pub pickup_to_delivery_relative_detour_limit: Option<f64>, pub pickup_to_delivery_absolute_detour_limit: Option<Duration>, pub pickup_to_delivery_time_limit: Option<Duration>, pub shipment_type: String, pub label: String, pub ignore: bool, pub demands: Vec<CapacityQuantity>, /* private fields */
}
Expand description

The shipment of a single item, from one of its pickups to one of its deliveries. For the shipment to be considered as performed, a unique vehicle must visit one of its pickup locations (and decrease its spare capacities accordingly), then visit one of its delivery locations later on (and therefore re-increase its spare capacities accordingly).

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.
§pickups: Vec<VisitRequest>

Set of pickup alternatives associated to the shipment. If not specified, the vehicle only needs to visit a location corresponding to the deliveries.

§deliveries: Vec<VisitRequest>

Set of delivery alternatives associated to the shipment. If not specified, the vehicle only needs to visit a location corresponding to the pickups.

§load_demands: HashMap<String, Load>

Load demands of the shipment (for example weight, volume, number of pallets etc). The keys in the map should be identifiers describing the type of the corresponding load, ideally also including the units. For example: “weight_kg”, “volume_gallons”, “pallet_count”, etc. If a given key does not appear in the map, the corresponding load is considered as null.

§penalty_cost: Option<f64>

If the shipment is not completed, this penalty is added to the overall cost of the routes. A shipment is considered completed if one of its pickup and delivery alternatives is visited. The cost may be expressed in the same unit used for all other cost-related fields in the model and must be positive.

IMPORTANT: If this penalty is not specified, it is considered infinite, i.e. the shipment must be completed.

§allowed_vehicle_indices: Vec<i32>

The set of vehicles that may perform this shipment. If empty, all vehicles may perform it. Vehicles are given by their index in the ShipmentModel’s vehicles list.

§costs_per_vehicle: Vec<f64>

Specifies the cost that is incurred when this shipment is delivered by each vehicle. If specified, it must have EITHER:

  • the same number of elements as costs_per_vehicle_indices. costs_per_vehicle[i] corresponds to vehicle costs_per_vehicle_indices[i] of the model.
  • the same number of elements as there are vehicles in the model. The i-th element corresponds to vehicle #i of the model.

These costs must be in the same unit as penalty_cost and must not be negative. Leave this field empty, if there are no such costs.

§costs_per_vehicle_indices: Vec<i32>

Indices of the vehicles to which costs_per_vehicle applies. If non-empty, it must have the same number of elements as costs_per_vehicle. A vehicle index may not be specified more than once. If a vehicle is excluded from costs_per_vehicle_indices, its cost is zero.

§pickup_to_delivery_relative_detour_limit: Option<f64>

Specifies the maximum relative detour time compared to the shortest path from pickup to delivery. If specified, it must be nonnegative, and the shipment must contain at least a pickup and a delivery.

For example, let t be the shortest time taken to go from the selected pickup alternative directly to the selected delivery alternative. Then setting pickup_to_delivery_relative_detour_limit enforces:

start_time(delivery) - start_time(pickup) <=
std::ceil(t * (1.0 + pickup_to_delivery_relative_detour_limit))

If both relative and absolute limits are specified on the same shipment, the more constraining limit is used for each possible pickup/delivery pair. As of 2017/10, detours are only supported when travel durations do not depend on vehicles.

§pickup_to_delivery_absolute_detour_limit: Option<Duration>

Specifies the maximum absolute detour time compared to the shortest path from pickup to delivery. If specified, it must be nonnegative, and the shipment must contain at least a pickup and a delivery.

For example, let t be the shortest time taken to go from the selected pickup alternative directly to the selected delivery alternative. Then setting pickup_to_delivery_absolute_detour_limit enforces:

start_time(delivery) - start_time(pickup) <=
t + pickup_to_delivery_absolute_detour_limit

If both relative and absolute limits are specified on the same shipment, the more constraining limit is used for each possible pickup/delivery pair. As of 2017/10, detours are only supported when travel durations do not depend on vehicles.

§pickup_to_delivery_time_limit: Option<Duration>

Specifies the maximum duration from start of pickup to start of delivery of a shipment. If specified, it must be nonnegative, and the shipment must contain at least a pickup and a delivery. This does not depend on which alternatives are selected for pickup and delivery, nor on vehicle speed. This can be specified alongside maximum detour constraints: the solution will respect both specifications.

§shipment_type: String

Non-empty string specifying a “type” for this shipment. This feature can be used to define incompatibilities or requirements between shipment_types (see shipment_type_incompatibilities and shipment_type_requirements in ShipmentModel).

Differs from visit_types which is specified for a single visit: All pickup/deliveries belonging to the same shipment share the same shipment_type.

§label: String

Specifies a label for this shipment. This label is reported in the response in the shipment_label of the corresponding ShipmentRoute.Visit.

§ignore: bool

If true, skip this shipment, but don’t apply a penalty_cost.

Ignoring a shipment results in a validation error when there are any shipment_type_requirements in the model.

Ignoring a shipment that is performed in injected_first_solution_routes or injected_solution_constraint is permitted; the solver removes the related pickup/delivery visits from the performing route. precedence_rules that reference ignored shipments will also be ignored.

§demands: Vec<CapacityQuantity>
👎Deprecated

Deprecated: Use Shipment.load_demands instead.

Implementations§

Source§

impl Shipment

Source

pub fn new() -> Self

Source

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

Sets the value of pickups.

Source

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

Sets the value of deliveries.

Source

pub fn set_load_demands<T, K, V>(self, v: T) -> Self
where T: IntoIterator<Item = (K, V)>, K: Into<String>, V: Into<Load>,

Sets the value of load_demands.

Source

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

Sets the value of penalty_cost.

Source

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

Sets or clears the value of penalty_cost.

Source

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

Sets the value of allowed_vehicle_indices.

Source

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

Sets the value of costs_per_vehicle.

Source

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

Sets the value of costs_per_vehicle_indices.

Source

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

Source

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

Sets or clears the value of pickup_to_delivery_relative_detour_limit.

Source

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

Source

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

Sets or clears the value of pickup_to_delivery_absolute_detour_limit.

Source

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

Sets the value of pickup_to_delivery_time_limit.

Source

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

Sets or clears the value of pickup_to_delivery_time_limit.

Source

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

Sets the value of shipment_type.

Source

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

Sets the value of label.

Source

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

Sets the value of ignore.

Source

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

👎Deprecated

Sets the value of demands.

Trait Implementations§

Source§

impl Clone for Shipment

Source§

fn clone(&self) -> Shipment

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 Shipment

Source§

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

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

impl Default for Shipment

Source§

fn default() -> Shipment

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

impl Message for Shipment

Source§

fn typename() -> &'static str

The typename of this message.
Source§

impl PartialEq for Shipment

Source§

fn eq(&self, other: &Shipment) -> 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 Shipment

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>,