#[non_exhaustive]pub struct TimeWindow {
pub start_time: Option<Timestamp>,
pub end_time: Option<Timestamp>,
pub soft_start_time: Option<Timestamp>,
pub soft_end_time: Option<Timestamp>,
pub cost_per_hour_before_soft_start_time: Option<f64>,
pub cost_per_hour_after_soft_end_time: Option<f64>,
/* private fields */
}Expand description
Time windows constrain the time of an event, such as the arrival time at a visit, or the start and end time of a vehicle.
Hard time window bounds, start_time and end_time, enforce the earliest
and latest time of the event, such that start_time <= event_time <= end_time. The soft time window lower bound, soft_start_time, expresses a
preference for the event to happen at or after soft_start_time by incurring
a cost proportional to how long before soft_start_time the event occurs. The
soft time window upper bound, soft_end_time, expresses a preference for the
event to happen at or before soft_end_time by incurring a cost proportional
to how long after soft_end_time the event occurs. start_time, end_time,
soft_start_time and soft_end_time should be within the global time limits
(see
ShipmentModel.global_start_time
and
ShipmentModel.global_end_time)
and should respect:
0 <= `start_time` <= `soft_start_time` <= `end_time` and
0 <= `start_time` <= `soft_end_time` <= `end_time`.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.start_time: Option<Timestamp>The hard time window start time. If unspecified it will be set to
ShipmentModel.global_start_time.
end_time: Option<Timestamp>The hard time window end time. If unspecified it will be set to
ShipmentModel.global_end_time.
soft_start_time: Option<Timestamp>The soft start time of the time window.
soft_end_time: Option<Timestamp>The soft end time of the time window.
cost_per_hour_before_soft_start_time: Option<f64>A cost per hour added to other costs in the model if the event occurs before soft_start_time, computed as:
max(0, soft_start_time - t.seconds)
* cost_per_hour_before_soft_start_time / 3600,
t being the time of the event.This cost must be positive, and the field can only be set if soft_start_time has been set.
cost_per_hour_after_soft_end_time: Option<f64>A cost per hour added to other costs in the model if the event occurs after
soft_end_time, computed as:
max(0, t.seconds - soft_end_time.seconds)
* cost_per_hour_after_soft_end_time / 3600,
t being the time of the event.This cost must be positive, and the field can only be set if
soft_end_time has been set.
Implementations§
Source§impl TimeWindow
impl TimeWindow
Sourcepub fn set_start_time<T>(self, v: T) -> Self
pub fn set_start_time<T>(self, v: T) -> Self
Sets the value of start_time.
§Example
use wkt::Timestamp;
let x = TimeWindow::new().set_start_time(Timestamp::default()/* use setters */);Sourcepub fn set_or_clear_start_time<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_start_time<T>(self, v: Option<T>) -> Self
Sets or clears the value of start_time.
§Example
use wkt::Timestamp;
let x = TimeWindow::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
let x = TimeWindow::new().set_or_clear_start_time(None::<Timestamp>);Sourcepub fn set_end_time<T>(self, v: T) -> Self
pub fn set_end_time<T>(self, v: T) -> Self
Sourcepub fn set_or_clear_end_time<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_end_time<T>(self, v: Option<T>) -> Self
Sourcepub fn set_soft_start_time<T>(self, v: T) -> Self
pub fn set_soft_start_time<T>(self, v: T) -> Self
Sets the value of soft_start_time.
§Example
use wkt::Timestamp;
let x = TimeWindow::new().set_soft_start_time(Timestamp::default()/* use setters */);Sourcepub fn set_or_clear_soft_start_time<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_soft_start_time<T>(self, v: Option<T>) -> Self
Sets or clears the value of soft_start_time.
§Example
use wkt::Timestamp;
let x = TimeWindow::new().set_or_clear_soft_start_time(Some(Timestamp::default()/* use setters */));
let x = TimeWindow::new().set_or_clear_soft_start_time(None::<Timestamp>);Sourcepub fn set_soft_end_time<T>(self, v: T) -> Self
pub fn set_soft_end_time<T>(self, v: T) -> Self
Sets the value of soft_end_time.
§Example
use wkt::Timestamp;
let x = TimeWindow::new().set_soft_end_time(Timestamp::default()/* use setters */);Sourcepub fn set_or_clear_soft_end_time<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_soft_end_time<T>(self, v: Option<T>) -> Self
Sets or clears the value of soft_end_time.
§Example
use wkt::Timestamp;
let x = TimeWindow::new().set_or_clear_soft_end_time(Some(Timestamp::default()/* use setters */));
let x = TimeWindow::new().set_or_clear_soft_end_time(None::<Timestamp>);Sourcepub fn set_cost_per_hour_before_soft_start_time<T>(self, v: T) -> Self
pub fn set_cost_per_hour_before_soft_start_time<T>(self, v: T) -> Self
Sets the value of cost_per_hour_before_soft_start_time.
§Example
let x = TimeWindow::new().set_cost_per_hour_before_soft_start_time(42.0);Sourcepub fn set_or_clear_cost_per_hour_before_soft_start_time<T>(
self,
v: Option<T>,
) -> Self
pub fn set_or_clear_cost_per_hour_before_soft_start_time<T>( self, v: Option<T>, ) -> Self
Sets or clears the value of cost_per_hour_before_soft_start_time.
§Example
let x = TimeWindow::new().set_or_clear_cost_per_hour_before_soft_start_time(Some(42.0));
let x = TimeWindow::new().set_or_clear_cost_per_hour_before_soft_start_time(None::<f32>);Sourcepub fn set_cost_per_hour_after_soft_end_time<T>(self, v: T) -> Self
pub fn set_cost_per_hour_after_soft_end_time<T>(self, v: T) -> Self
Sets the value of cost_per_hour_after_soft_end_time.
§Example
let x = TimeWindow::new().set_cost_per_hour_after_soft_end_time(42.0);Sourcepub fn set_or_clear_cost_per_hour_after_soft_end_time<T>(
self,
v: Option<T>,
) -> Self
pub fn set_or_clear_cost_per_hour_after_soft_end_time<T>( self, v: Option<T>, ) -> Self
Sets or clears the value of cost_per_hour_after_soft_end_time.
§Example
let x = TimeWindow::new().set_or_clear_cost_per_hour_after_soft_end_time(Some(42.0));
let x = TimeWindow::new().set_or_clear_cost_per_hour_after_soft_end_time(None::<f32>);Trait Implementations§
Source§impl Clone for TimeWindow
impl Clone for TimeWindow
Source§fn clone(&self) -> TimeWindow
fn clone(&self) -> TimeWindow
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TimeWindow
impl Debug for TimeWindow
Source§impl Default for TimeWindow
impl Default for TimeWindow
Source§fn default() -> TimeWindow
fn default() -> TimeWindow
Source§impl PartialEq for TimeWindow
impl PartialEq for TimeWindow
impl StructuralPartialEq for TimeWindow
Auto Trait Implementations§
impl Freeze for TimeWindow
impl RefUnwindSafe for TimeWindow
impl Send for TimeWindow
impl Sync for TimeWindow
impl Unpin for TimeWindow
impl UnsafeUnpin for TimeWindow
impl UnwindSafe for TimeWindow
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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