Skip to main content

DecreasingTopkRule

Struct DecreasingTopkRule 

Source
pub struct DecreasingTopkRule { /* private fields */ }
Expand description

Like TopkRule, but the number of features allowed halves at each level: k / 2^depth, and at least one.

Implementations§

Source§

impl DecreasingTopkRule

Source

pub fn new(limit: usize, increment: Box<dyn StepStrategy>) -> Self

A rule whose root k grows following increment, up to limit.

Source

pub fn with_delay(self, delay: u8) -> Self

Sets the number of passes before the rule takes effect.

Source

pub fn with_budget(self, budget: usize) -> Self

Sets k for the first pass.

Trait Implementations§

Source§

impl Rule for DecreasingTopkRule

Source§

fn evaluate(&self, context: &RuleContext) -> RuleResult

Decides whether the search continues below the node.
Source§

fn priority(&self) -> u8

Rules with a higher priority are evaluated first.
Source§

fn description(&self) -> String

A short human-readable name.
Source§

fn state(&self) -> RuleState

The current state of the rule.
Source§

fn is_active(&self) -> bool

Whether the rule is applied.
Source§

fn activate(&mut self)

Starts applying the rule; called before the first pass.
Source§

fn deactivate(&mut self)

Stops applying the rule.
Source§

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

Whether the rule restricts the search only temporarily. A search whose pass was cut by a relaxable rule is not finished.
Source§

fn delay(&self) -> u8

Number of passes to wait before the rule takes effect.
Source§

fn as_any(&self) -> &dyn Any

Source§

fn as_any_mut(&mut self) -> &mut dyn Any

Mutable upcast used by RuleManager::get_rule_mut.
Source§

fn reset(&mut self)

Resets any internal state, such as a timer.

Auto Trait Implementations§

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> 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, 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.