Curve

Struct Curve 

Source
pub struct Curve { /* private fields */ }
Expand description

An arrival curve (also commonly called an “upper event arrival curve” η+) that can describe arbitrarily bursty sporadic arrival processes.

As is common, the arrival curve is defined by a finite delta-min vector that describes the minimum interval length in which a certain number of jobs may arrive.

Implementations§

Source§

impl Curve

Source

pub fn new(delta_min_prefix: Vec<Duration>) -> Curve

Construct a new arrival curve.

The delta_min_prefix is the delta-min prefix describing the arrival curve. Each element of the vector gives the minimum interval length in which a corresponding number of jobs may arrive. Convention: we do not store the mininum distance for 0 and 1 jobs. So the min_distance vector at offset 0 contains the minimum separation of two jobs, the min_distance vector at offset 1 contains the length of the shortest interval in which three jobs arrive, and so on.

Source

pub fn from_arrival_bound_until<T: ArrivalBound>( ab: &T, horizon: Duration, ) -> Curve

Obtain an arrival curve by inferring a delta-min vector from any given arrival process T.

The delta-min vector is chosen such that it covers all arrivals until the given horizon.

Source

pub fn from_arrival_bound<T: ArrivalBound>(ab: &T, up_to_njobs: usize) -> Curve

Obtain an arrival curve by inferring a delta-min vector from any given arrival process T.

The delta-min vector is chosen such that it covers at least up_to_njobs job arrivals.

Source

pub fn from_trace( arrival_times: impl Iterator<Item = Offset>, prefix_jobs: usize, ) -> Curve

Obtain an arrival curve by inferring a delta-min prefix from a given trace of arrival events, expressed as the offset of the event from a reference time zero.

The resultant delta-min vector will consist of prefix_jobs entries (if there are a sufficient number of arrivals in the trace).

Source

pub fn extrapolate(&mut self, horizon: Duration)

Extend the underlying delta-min prefix by exploiting the subadditivity of proper arrival curves until the delta-min prefix covers intervals of length horizon.

Source

pub fn extrapolate_steps(&mut self, n: usize)

Extend the underlying delta-min prefix by exploiting the subadditivity of proper arrival curves by n elements.

Source

pub fn extrapolate_with_bound(&mut self, bound: (Duration, usize))

Extend the underlying delta-min prefix by one element while exploiting both the subadditivity of proper arrival curves and the provided bound on the next step. The bound is a tuple (delta, njobs), where njobs must be the element that the underlying delta-min vector is extrapolated to.

Source

pub fn min_distance(&self, n: usize) -> Duration

Return a lower bound on the length of an interval in which n arrival events occur.

Note: does not extrapolate, so extremely pessimistic if n exceeds the length of the internal minimum-distance prefix.

Trait Implementations§

Source§

impl ArrivalBound for Curve

Source§

fn number_arrivals(&self, delta: Duration) -> usize

Bound the number of jobs released in any interval of length delta.
Source§

fn steps_iter<'a>(&'a self) -> Box<dyn Iterator<Item = Duration> + 'a>

Yield the sequence of interval lengths (i.e., values of delta in ArrivalBound::number_arrivals) for which the arrival bound “steps”, i.e., where it shows an increase in the number of released jobs. Read more
Source§

fn clone_with_jitter(&self, jitter: Duration) -> Box<dyn ArrivalBound>

Clone the arrival model while accounting for added release jitter. Returns a boxed dyn object because the underlying type may change.
Source§

fn brute_force_steps_iter<'a>( &'a self, ) -> Box<dyn Iterator<Item = Duration> + 'a>

Same semantics as ArrivalBound::steps_iter, but provided by a default implementation in the most naive way possible. Avoid if performance is at all important.
Source§

impl Clone for Curve

Source§

fn clone(&self) -> Curve

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 Curve

Source§

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

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

impl From<&ArrivalCurvePrefix> for Curve

Source§

fn from(ac: &ArrivalCurvePrefix) -> Self

Converts to this type from the input type.
Source§

impl From<ArrivalCurvePrefix> for Curve

Source§

fn from(ac: ArrivalCurvePrefix) -> Self

Converts to this type from the input type.
Source§

impl From<Periodic> for Curve

Source§

fn from(p: Periodic) -> Self

Converts to this type from the input type.
Source§

impl From<Sporadic> for Curve

Source§

fn from(s: Sporadic) -> Self

Converts to this type from the input type.
Source§

impl FromIterator<Duration> for Curve

Source§

fn from_iter<I: IntoIterator<Item = Duration>>(iter: I) -> Curve

Creates a value from an iterator. Read more

Auto Trait Implementations§

§

impl Freeze for Curve

§

impl RefUnwindSafe for Curve

§

impl Send for Curve

§

impl Sync for Curve

§

impl Unpin for Curve

§

impl UnwindSafe for Curve

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, 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. 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.