Struct snowcap::optimizers::TreeOptimizer [−][src]
Tree Optimizer
Optimizer that builds a tree of possible modifiers (based on the hard hard_policy), and traverses it by minimizing the soft policies in each step. To achieve this, this optimizer will, at each step of the tree traversal, compute the cost of all possible next choices (modifiers), and take the one with the lowest cost associated with it. During this, we immediately discard modifiers which would lead to an invalid state, with respect to the given hard hard_policy.
This optimizer is very similar to the TreeStrategy
.
Hence, this algorithm also works very well with problems consisting only of dependency groups
with an immediate effect. In this case, this algorithm is extremely fast. However, when the
problems have no immedaite effect, this algorithm will have problems if the number of modidfiers
is too large.
Implementations
impl<P> TreeOptimizer<P> where
P: SoftPolicy + Clone,
[src]
P: SoftPolicy + Clone,
pub fn set_max_backtrack(&mut self, max_backtrack: usize)
[src]
Set the maximum backtrack level. If this level is reached, then the strategy will return
Err(ReachedMaxBacktrack)
. The backtrack level will always be reset if we enter a new
leaf. As an example, if we set the backtrack level to 3, and we need to backtrack twice,
but find another branch to enter, then it will be reset back to 0.
Trait Implementations
impl<P: Debug> Debug for TreeOptimizer<P> where
P: SoftPolicy + Clone,
[src]
P: SoftPolicy + Clone,
impl<P> Optimizer<P> for TreeOptimizer<P> where
P: SoftPolicy + Clone,
[src]
P: SoftPolicy + Clone,
fn new(
net: Network,
modifiers: Vec<ConfigModifier>,
hard_policy: HardPolicy,
soft_policy: P,
time_budget: Option<Duration>
) -> Result<Box<Self>, Error>
[src]
net: Network,
modifiers: Vec<ConfigModifier>,
hard_policy: HardPolicy,
soft_policy: P,
time_budget: Option<Duration>
) -> Result<Box<Self>, Error>
fn work(&mut self, abort: Stopper) -> Result<(Vec<ConfigModifier>, f64), Error>
[src]
fn num_states(&self) -> usize
[src]
fn synthesize(
net: Network,
end_config: Config,
hard_policy: HardPolicy,
soft_policy: P,
time_budget: Option<Duration>,
abort: Stopper
) -> Result<(Vec<ConfigModifier>, f64), Error>
[src]
net: Network,
end_config: Config,
hard_policy: HardPolicy,
soft_policy: P,
time_budget: Option<Duration>,
abort: Stopper
) -> Result<(Vec<ConfigModifier>, f64), Error>
Auto Trait Implementations
impl<P> RefUnwindSafe for TreeOptimizer<P> where
P: RefUnwindSafe,
[src]
P: RefUnwindSafe,
impl<P> Send for TreeOptimizer<P> where
P: Send,
[src]
P: Send,
impl<P> !Sync for TreeOptimizer<P>
[src]
impl<P> Unpin for TreeOptimizer<P> where
P: Unpin,
[src]
P: Unpin,
impl<P> UnwindSafe for TreeOptimizer<P> where
P: UnwindSafe,
[src]
P: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,