pub struct TopkRule { /* private fields */ }Expand description
Top-k search: at each node, a pass only branches on the k + 1
best-ranked features. Relaxing the rule raises k, following its
StepStrategy, up to limit.
Implementations§
Source§impl TopkRule
impl TopkRule
Sourcepub fn new(limit: usize, increment: Box<dyn StepStrategy>) -> Self
pub fn new(limit: usize, increment: Box<dyn StepStrategy>) -> Self
A rule whose k grows following increment, up to limit.
Sourcepub fn with_delay(self, delay: u8) -> Self
pub fn with_delay(self, delay: u8) -> Self
Sets the number of passes before the rule takes effect.
Sourcepub fn with_budget(self, budget: usize) -> Self
pub fn with_budget(self, budget: usize) -> Self
Sets k for the first pass.
Trait Implementations§
Source§impl Rule for TopkRule
impl Rule for TopkRule
Source§fn evaluate(&self, context: &RuleContext) -> RuleResult
fn evaluate(&self, context: &RuleContext) -> RuleResult
Decides whether the search continues below the node.
Source§fn description(&self) -> String
fn description(&self) -> String
A short human-readable name.
Source§fn deactivate(&mut self)
fn deactivate(&mut self)
Stops applying the rule.
Source§fn relax(&mut self)
fn relax(&mut self)
Widens the rule’s budget before the next pass, or deactivates it once
the budget is at its limit.
Source§fn is_relaxable(&self) -> bool
fn is_relaxable(&self) -> bool
Whether the rule restricts the search only temporarily. A search whose
pass was cut by a relaxable rule is not finished.
Source§fn as_any(&self) -> &dyn Any
fn as_any(&self) -> &dyn Any
Upcast used by
RuleManager::get_rule_mut.Source§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Mutable upcast used by
RuleManager::get_rule_mut.Auto Trait Implementations§
impl !RefUnwindSafe for TopkRule
impl !UnwindSafe for TopkRule
impl Freeze for TopkRule
impl Send for TopkRule
impl Sync for TopkRule
impl Unpin for TopkRule
impl UnsafeUnpin for TopkRule
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more