Struct egg::BackoffScheduler
source · [−]pub struct BackoffScheduler { /* private fields */ }
Expand description
A RewriteScheduler
that implements exponentional rule backoff.
For each rewrite, there exists a configurable initial match limit. If a rewrite search yield more than this limit, then we ban this rule for number of iterations, double its limit, and double the time it will be banned next time.
This seems effective at preventing explosive rules like associativity from taking an unfair amount of resources.
BackoffScheduler
is configurable in the builder-pattern style.
Implementations
sourceimpl BackoffScheduler
impl BackoffScheduler
sourcepub fn with_initial_match_limit(self, limit: usize) -> Self
pub fn with_initial_match_limit(self, limit: usize) -> Self
Set the initial match limit after which a rule will be banned. Default: 1,000
sourcepub fn with_ban_length(self, ban_length: usize) -> Self
pub fn with_ban_length(self, ban_length: usize) -> Self
Set the initial ban length. Default: 5 iterations
sourcepub fn do_not_ban(self, name: impl Into<Symbol>) -> Self
pub fn do_not_ban(self, name: impl Into<Symbol>) -> Self
Never ban a particular rule.
sourcepub fn rule_match_limit(self, name: impl Into<Symbol>, limit: usize) -> Self
pub fn rule_match_limit(self, name: impl Into<Symbol>, limit: usize) -> Self
Set the initial match limit for a rule.
sourcepub fn rule_ban_length(self, name: impl Into<Symbol>, length: usize) -> Self
pub fn rule_ban_length(self, name: impl Into<Symbol>, length: usize) -> Self
Set the initial ban length for a rule.
Trait Implementations
sourceimpl Debug for BackoffScheduler
impl Debug for BackoffScheduler
sourceimpl Default for BackoffScheduler
impl Default for BackoffScheduler
sourceimpl<L, N> RewriteScheduler<L, N> for BackoffScheduler where
L: Language,
N: Analysis<L>,
impl<L, N> RewriteScheduler<L, N> for BackoffScheduler where
L: Language,
N: Analysis<L>,
sourcefn search_rewrite<'a>(
&mut self,
iteration: usize,
egraph: &EGraph<L, N>,
rewrite: &'a Rewrite<L, N>
) -> Vec<SearchMatches<'a, L>>
fn search_rewrite<'a>(
&mut self,
iteration: usize,
egraph: &EGraph<L, N>,
rewrite: &'a Rewrite<L, N>
) -> Vec<SearchMatches<'a, L>>
A hook allowing you to customize rewrite searching behavior. Useful to implement rule management. Read more
sourcefn apply_rewrite(
&mut self,
iteration: usize,
egraph: &mut EGraph<L, N>,
rewrite: &Rewrite<L, N>,
matches: Vec<SearchMatches<'_, L>>
) -> usize
fn apply_rewrite(
&mut self,
iteration: usize,
egraph: &mut EGraph<L, N>,
rewrite: &Rewrite<L, N>,
matches: Vec<SearchMatches<'_, L>>
) -> usize
A hook allowing you to customize rewrite application behavior. Useful to implement rule management. Read more
Auto Trait Implementations
impl RefUnwindSafe for BackoffScheduler
impl Send for BackoffScheduler
impl Sync for BackoffScheduler
impl Unpin for BackoffScheduler
impl UnwindSafe for BackoffScheduler
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more