Struct Schedule

Source
pub struct Schedule<T>(/* private fields */);
Expand description

Includes all configurations from time $1$ to time $t_end$.

Implementations§

Source§

impl<'a, T> Schedule<T>
where T: Value<'a>,

Source

pub fn new(x: Vec<Config<T>>) -> Schedule<T>

Converts a vector of configurations to a schedule.

Source

pub fn empty() -> Schedule<T>

Builds an empty schedule.

Source

pub fn repeat(x: Config<T>, t: i32) -> Schedule<T>

Source

pub fn is_empty(&self) -> bool

Returns true if the schedule is empty (i.e. does not include any config).

Source

pub fn t_end(&self) -> i32

Returns the time of the latest time step.

Source

pub fn now(&self) -> Config<T>

Returns the config of the latest time step.

Source

pub fn now_with_default(&self, default: Config<T>) -> Config<T>

Returns the config of the latest time step.

Source

pub fn get(&self, t: i32) -> Option<&Config<T>>

Returns the config at time $t$ if present.

Source

pub fn shift(&mut self, x: Config<T>)

Extends schedule with a new initial config.

Source

pub fn push(&mut self, x: Config<T>)

Extends schedule with a new final config.

Source

pub fn extend(&self, x: Config<T>) -> Schedule<T>

Immutably Extends schedule with a new final config.

Source

pub fn skip(&self, delta: i32) -> Self

Skips first $delta$ configurations.

Source

pub fn to_vec(&self) -> Vec<Vec<T>>

Converts schedule to a vector of vectors.

Source

pub fn from_raw(d: i32, w: i32, raw_xs: &[T]) -> Schedule<T>

Builds a schedule from a raw (flat) encoding $raw_xs$ (used for convex optimization). $d$ is the number of dimensions, $w$ is the length of the time window. The length of $raw_xs$ must therefore be $d \cdot w$.

Source

pub fn build_raw(w: i32, x: &Config<T>) -> Vec<T>

Builds a raw (flat) encoding of a schedule (used for convex optimization) by stretching a config across the time window $w$.

Source

pub fn raw_encoding_len(d: i32, w: i32) -> i32

Returns the length of the raw encoding of $d$ dimensions across time window $w$.

Source§

impl<'a, T> Schedule<T>
where T: Value<'a>,

Source

pub fn verify(&self, t_end: i32, bounds: &Vec<T>) -> Result<()>

Trait Implementations§

Source§

impl<'a, T, U> CastableSchedule<T> for Schedule<U>
where T: Value<'a>, U: Value<'a>,

Source§

fn to(&self) -> Schedule<T>

Source§

impl<T: Clone> Clone for Schedule<T>

Source§

fn clone(&self) -> Schedule<T>

Returns a copy 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<T: Debug> Debug for Schedule<T>

Source§

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

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

impl<'de, T> Deserialize<'de> for Schedule<T>
where T: Deserialize<'de>,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<'a, T> DiscretizableSchedule for Schedule<T>
where T: Value<'a>,

Source§

fn to_i(&self) -> IntegralSchedule

Discretize a schedule.
Source§

impl<'a, T> FromIterator<Config<T>> for Schedule<T>
where T: Value<'a>,

Source§

fn from_iter<I>(iter: I) -> Self
where I: IntoIterator<Item = Config<T>>,

Creates a value from an iterator. Read more
Source§

impl<'a, T> FromParallelIterator<Config<T>> for Schedule<T>
where T: Value<'a>,

Source§

fn from_par_iter<I>(iter: I) -> Self
where I: IntoParallelIterator<Item = Config<T>>,

Creates an instance of the collection from the parallel iterator par_iter. Read more
Source§

impl<T: Hash> Hash for Schedule<T>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<'a, T> Index<usize> for Schedule<T>
where T: Value<'a>,

Source§

type Output = Config<T>

The returned type after indexing.
Source§

fn index(&self, t: usize) -> &Config<T>

Performs the indexing (container[index]) operation. Read more
Source§

impl<'a, 'b, T> IntoParallelIterator for &'a Schedule<T>
where T: Value<'b>,

Source§

type Item = &'a Config<T>

The type of item that the parallel iterator will produce.
Source§

type Iter = Iter<'a, Config<T>>

The parallel iterator type that will be created.
Source§

fn into_par_iter(self) -> Self::Iter

Converts self into a parallel iterator. Read more
Source§

impl<'a, T> IntoParallelIterator for Schedule<T>
where T: Value<'a>,

Source§

type Item = Config<T>

The type of item that the parallel iterator will produce.
Source§

type Iter = IntoIter<Config<T>>

The parallel iterator type that will be created.
Source§

fn into_par_iter(self) -> Self::Iter

Converts self into a parallel iterator. Read more
Source§

impl<T: PartialEq> PartialEq for Schedule<T>

Source§

fn eq(&self, other: &Schedule<T>) -> 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<'a, T> Resettable<'a> for Schedule<T>
where T: Value<'a>,

Source§

fn reset(&'a self, t_start: i32) -> Schedule<T>

Shift object to some new initial time $t_start$. Here, $t_start$ is the time before first time slot (e.g., $t_start = 0$ is a no-op).
Source§

impl<T> Serialize for Schedule<T>
where T: Serialize,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'a, T> VecWrapper for Schedule<T>
where T: Value<'a>,

Source§

type Item = Config<T>

Source§

fn to_vec(&self) -> &Vec<Self::Item>

Source§

fn iter(&self) -> Iter<'_, Self::Item>

Source§

impl<T: Eq> Eq for Schedule<T>

Source§

impl<T> StructuralPartialEq for Schedule<T>

Auto Trait Implementations§

§

impl<T> Freeze for Schedule<T>

§

impl<T> RefUnwindSafe for Schedule<T>
where T: RefUnwindSafe,

§

impl<T> Send for Schedule<T>
where T: Send,

§

impl<T> Sync for Schedule<T>
where T: Sync,

§

impl<T> Unpin for Schedule<T>
where T: Unpin,

§

impl<T> UnwindSafe for Schedule<T>
where T: UnwindSafe,

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, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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<'data, I> IntoParallelRefIterator<'data> for I
where I: 'data + ?Sized, &'data I: IntoParallelIterator,

Source§

type Iter = <&'data I as IntoParallelIterator>::Iter

The type of the parallel iterator that will be returned.
Source§

type Item = <&'data I as IntoParallelIterator>::Item

The type of item that the parallel iterator will produce. This will typically be an &'data T reference type.
Source§

fn par_iter(&'data self) -> <I as IntoParallelRefIterator<'data>>::Iter

Converts self into a parallel iterator. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,