#[non_exhaustive]pub struct DurationLimit {
pub max_duration: Option<Duration>,
pub soft_max_duration: Option<Duration>,
pub cost_per_hour_after_soft_max: Option<f64>,
pub quadratic_soft_max_duration: Option<Duration>,
pub cost_per_square_hour_after_quadratic_soft_max: Option<f64>,
}Expand description
A limit defining a maximum duration of the route of a vehicle. It can be either hard or soft.
When a soft limit field is defined, both the soft max threshold and its associated cost must be defined together.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.max_duration: Option<Duration>A hard limit constraining the duration to be at most max_duration.
soft_max_duration: Option<Duration>A soft limit not enforcing a maximum duration limit, but when violated makes the route incur a cost. This cost adds up to other costs defined in the model, with the same unit.
If defined, soft_max_duration must be nonnegative. If max_duration is
also defined, soft_max_duration must be less than max_duration.
cost_per_hour_after_soft_max: Option<f64>Cost per hour incurred if the soft_max_duration threshold is violated.
The additional cost is 0 if the duration is under the threshold,
otherwise the cost depends on the duration as follows:
cost_per_hour_after_soft_max * (duration - soft_max_duration)The cost must be nonnegative.
quadratic_soft_max_duration: Option<Duration>A soft limit not enforcing a maximum duration limit, but when violated makes the route incur a cost, quadratic in the duration. This cost adds up to other costs defined in the model, with the same unit.
If defined, quadratic_soft_max_duration must be nonnegative. If
max_duration is also defined, quadratic_soft_max_duration must be
less than max_duration, and the difference must be no larger than one
day:
max_duration - quadratic_soft_max_duration <= 86400 seconds
cost_per_square_hour_after_quadratic_soft_max: Option<f64>Cost per square hour incurred if the
quadratic_soft_max_duration threshold is violated.
The additional cost is 0 if the duration is under the threshold, otherwise the cost depends on the duration as follows:
cost_per_square_hour_after_quadratic_soft_max *
(duration - quadratic_soft_max_duration)^2The cost must be nonnegative.
Implementations§
Source§impl DurationLimit
impl DurationLimit
pub fn new() -> Self
Sourcepub fn set_max_duration<T: Into<Option<Duration>>>(self, v: T) -> Self
pub fn set_max_duration<T: Into<Option<Duration>>>(self, v: T) -> Self
Sets the value of max_duration.
Sourcepub fn set_soft_max_duration<T: Into<Option<Duration>>>(self, v: T) -> Self
pub fn set_soft_max_duration<T: Into<Option<Duration>>>(self, v: T) -> Self
Sets the value of soft_max_duration.
Sourcepub fn set_cost_per_hour_after_soft_max<T: Into<Option<f64>>>(
self,
v: T,
) -> Self
pub fn set_cost_per_hour_after_soft_max<T: Into<Option<f64>>>( self, v: T, ) -> Self
Sets the value of cost_per_hour_after_soft_max.
Sourcepub fn set_quadratic_soft_max_duration<T: Into<Option<Duration>>>(
self,
v: T,
) -> Self
pub fn set_quadratic_soft_max_duration<T: Into<Option<Duration>>>( self, v: T, ) -> Self
Sets the value of quadratic_soft_max_duration.
Sourcepub fn set_cost_per_square_hour_after_quadratic_soft_max<T: Into<Option<f64>>>(
self,
v: T,
) -> Self
pub fn set_cost_per_square_hour_after_quadratic_soft_max<T: Into<Option<f64>>>( self, v: T, ) -> Self
Sets the value of cost_per_square_hour_after_quadratic_soft_max.
Trait Implementations§
Source§impl Clone for DurationLimit
impl Clone for DurationLimit
Source§fn clone(&self) -> DurationLimit
fn clone(&self) -> DurationLimit
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more