pub struct Shipment {Show 14 fields
pub display_name: String,
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,
}
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§
§display_name: String
The user-defined display name of the shipment. It can be up to 63 characters long and may use UTF-8 characters.
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 vehiclecosts_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][google.maps.routeoptimization.v1.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.
Implementations§
Source§impl Shipment
impl Shipment
Sourcepub fn penalty_cost(&self) -> f64
pub fn penalty_cost(&self) -> f64
Returns the value of penalty_cost
, or the default value if penalty_cost
is unset.
Sourcepub fn pickup_to_delivery_relative_detour_limit(&self) -> f64
pub fn pickup_to_delivery_relative_detour_limit(&self) -> f64
Returns the value of pickup_to_delivery_relative_detour_limit
, or the default value if pickup_to_delivery_relative_detour_limit
is unset.
Trait Implementations§
Source§impl Message for Shipment
impl Message for Shipment
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_to_vec(&self) -> Vec<u8>where
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8>where
Self: Sized,
Source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8>where
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8>where
Self: Sized,
Source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self
. Read moreSource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self
.impl StructuralPartialEq for Shipment
Auto Trait Implementations§
impl Freeze for Shipment
impl RefUnwindSafe for Shipment
impl Send for Shipment
impl Sync for Shipment
impl Unpin for Shipment
impl UnwindSafe for Shipment
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request