pub struct Online<P> {
pub p: P,
pub w: i32,
}
Expand description
Online instance of a problem.
Fields
p: P
Problem.
w: i32
Finite, non-negative prediction window.
This prediction window is included in the time bound of the problem instance, i.e. at time $t$ $t_end$ should be set to $t + w$.
Implementations
sourceimpl<'a, P> Online<P> where
P: DiscretizableProblem,
impl<'a, P> Online<P> where
P: DiscretizableProblem,
sourceimpl<'a, P> Online<P> where
P: RelaxableProblem,
impl<'a, P> Online<P> where
P: RelaxableProblem,
sourceimpl<'a, T> Online<SmoothedLoadOptimization<T>> where
T: Value<'a>,
impl<'a, T> Online<SmoothedLoadOptimization<T>> where
T: Value<'a>,
pub fn into_sblo(self) -> Online<SmoothedBalancedLoadOptimization<'a, T>>
sourceimpl<'a, T> Online<SmoothedBalancedLoadOptimization<'a, T>> where
T: Value<'a>,
impl<'a, T> Online<SmoothedBalancedLoadOptimization<'a, T>> where
T: Value<'a>,
pub fn into_ssco(
self
) -> Online<SimplifiedSmoothedConvexOptimization<'a, T, DataCenterModelOutputSuccess, DataCenterModelOutputFailure>>
sourceimpl<'a, T, C, D> Online<SimplifiedSmoothedConvexOptimization<'a, T, C, D>> where
T: Value<'a>,
C: ModelOutputSuccess + 'a,
D: ModelOutputFailure + 'a,
impl<'a, T, C, D> Online<SimplifiedSmoothedConvexOptimization<'a, T, C, D>> where
T: Value<'a>,
C: ModelOutputSuccess + 'a,
D: ModelOutputFailure + 'a,
pub fn into_sco(self) -> Online<SmoothedConvexOptimization<'a, T, C, D>>
sourceimpl<'a, P> Online<P>
impl<'a, P> Online<P>
sourcepub fn stream<T, M, O, C, D>(
&mut self,
alg: &impl OnlineAlgorithm<'a, T, P, M, O, C, D>,
update: impl Fn(&mut Online<P>, &Schedule<T>) -> bool,
options: O
) -> Result<(Schedule<T>, Option<M>)> where
T: Value<'a>,
P: Problem<T, C, D> + 'a,
M: Memory<'a, T, P, C, D>,
O: Options<T, P, C, D>,
C: ModelOutputSuccess,
D: ModelOutputFailure,
pub fn stream<T, M, O, C, D>(
&mut self,
alg: &impl OnlineAlgorithm<'a, T, P, M, O, C, D>,
update: impl Fn(&mut Online<P>, &Schedule<T>) -> bool,
options: O
) -> Result<(Schedule<T>, Option<M>)> where
T: Value<'a>,
P: Problem<T, C, D> + 'a,
M: Memory<'a, T, P, C, D>,
O: Options<T, P, C, D>,
C: ModelOutputSuccess,
D: ModelOutputFailure,
Utility to stream an online algorithm from $T = 1$.
Returns resulting schedule, final memory of the algorithm.
alg
- Online algorithm to stream.update
- Callback that in each iteration updates the problem instance. Returntrue
to continue stream,false
to end stream.options
- Algorithm options.
sourcepub fn stream_from<T, M, O, C, D>(
&mut self,
alg: &impl OnlineAlgorithm<'a, T, P, M, O, C, D>,
update: impl Fn(&mut Online<P>, &Schedule<T>) -> bool,
options: O,
xs: &mut Schedule<T>,
prev_m: Option<M>
) -> Result<Option<M>> where
T: Value<'a>,
P: Problem<T, C, D> + 'a,
M: Memory<'a, T, P, C, D>,
O: Options<T, P, C, D>,
C: ModelOutputSuccess,
D: ModelOutputFailure,
pub fn stream_from<T, M, O, C, D>(
&mut self,
alg: &impl OnlineAlgorithm<'a, T, P, M, O, C, D>,
update: impl Fn(&mut Online<P>, &Schedule<T>) -> bool,
options: O,
xs: &mut Schedule<T>,
prev_m: Option<M>
) -> Result<Option<M>> where
T: Value<'a>,
P: Problem<T, C, D> + 'a,
M: Memory<'a, T, P, C, D>,
O: Options<T, P, C, D>,
C: ModelOutputSuccess,
D: ModelOutputFailure,
Stream an online algorithm from an arbitrary initial time, given the previous schedule and memory.
Returns final memory of the algorithm.
alg
- Online algorithm to stream.update
- Callback that in each iteration updates the problem instance. Returntrue
to continue stream,false
to end stream.options
- Algorithm options.xs
- Schedule.prev_m
- Memory of last iteration.
sourcepub fn next<T, M, O, C, D>(
&self,
alg: &impl OnlineAlgorithm<'a, T, P, M, O, C, D>,
options: O,
xs: &mut Schedule<T>,
prev_m: Option<M>
) -> Result<(Config<T>, Option<M>)> where
T: Value<'a>,
P: Problem<T, C, D> + 'a,
M: Memory<'a, T, P, C, D>,
O: Options<T, P, C, D>,
C: ModelOutputSuccess,
D: ModelOutputFailure,
pub fn next<T, M, O, C, D>(
&self,
alg: &impl OnlineAlgorithm<'a, T, P, M, O, C, D>,
options: O,
xs: &mut Schedule<T>,
prev_m: Option<M>
) -> Result<(Config<T>, Option<M>)> where
T: Value<'a>,
P: Problem<T, C, D> + 'a,
M: Memory<'a, T, P, C, D>,
O: Options<T, P, C, D>,
C: ModelOutputSuccess,
D: ModelOutputFailure,
Executes one step of an online algorithm.
alg
- Online algorithm to stream.options
- Algorithm options.xs
- Schedule.prev_m
- Memory of last iteration.
sourcepub fn offline_stream<T, M, O, C, D>(
&mut self,
alg: &impl OnlineAlgorithm<'a, T, P, M, O, C, D>,
t_end: i32,
options: O
) -> Result<(Schedule<T>, Option<M>)> where
T: Value<'a>,
P: Problem<T, C, D> + 'a,
M: Memory<'a, T, P, C, D>,
O: Options<T, P, C, D>,
C: ModelOutputSuccess,
D: ModelOutputFailure,
pub fn offline_stream<T, M, O, C, D>(
&mut self,
alg: &impl OnlineAlgorithm<'a, T, P, M, O, C, D>,
t_end: i32,
options: O
) -> Result<(Schedule<T>, Option<M>)> where
T: Value<'a>,
P: Problem<T, C, D> + 'a,
M: Memory<'a, T, P, C, D>,
O: Options<T, P, C, D>,
C: ModelOutputSuccess,
D: ModelOutputFailure,
Utility to stream an online algorithm with a constant cost function from $T = 1$.
Returns resulting schedule, final memory of the algorithm.
alg
- Online algorithm to stream.t_end
- Finite time horizon. $t_end \geq 1$.
sourcepub fn offline_stream_from<T, M, O, C, D>(
&'a mut self,
alg: &impl OnlineAlgorithm<'a, T, P, M, O, C, D>,
t_end: i32,
options: O,
xs: &mut Schedule<T>,
prev_m: Option<M>
) -> Result<Option<M>> where
T: Value<'a>,
P: Problem<T, C, D>,
M: Memory<'a, T, P, C, D>,
O: Options<T, P, C, D>,
C: ModelOutputSuccess,
D: ModelOutputFailure,
pub fn offline_stream_from<T, M, O, C, D>(
&'a mut self,
alg: &impl OnlineAlgorithm<'a, T, P, M, O, C, D>,
t_end: i32,
options: O,
xs: &mut Schedule<T>,
prev_m: Option<M>
) -> Result<Option<M>> where
T: Value<'a>,
P: Problem<T, C, D>,
M: Memory<'a, T, P, C, D>,
O: Options<T, P, C, D>,
C: ModelOutputSuccess,
D: ModelOutputFailure,
Utility to stream an online algorithm with a constant cost function from an arbitrary initial time, given the previous schedule and memory.
Returns final memory of the algorithm.
alg
- Online algorithm to stream.t_end
- Finite time horizon. Must be greater or equals to the current time slot.xs
- Schedule.prev_m
- Memory of last iteration.
Trait Implementations
Auto Trait Implementations
impl<P> RefUnwindSafe for Online<P> where
P: RefUnwindSafe,
impl<P> Send for Online<P> where
P: Send,
impl<P> Sync for Online<P> where
P: Sync,
impl<P> Unpin for Online<P> where
P: Unpin,
impl<P> UnwindSafe for Online<P> where
P: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more