Skip to main content

DiscrepancyRule

Struct DiscrepancyRule 

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

Limited discrepancy search (LDS-DL8.5).

Features are ranked by the heuristic at each node, and taking the feature of rank i costs a discrepancy of i. A pass explores only the paths whose total discrepancy is within the budget; relaxing the rule raises the budget, following its StepStrategy, until it covers the whole space.

Kiossou, Schaus, Nijssen and Houndji, Time Constrained DL8.5 Using Limited Discrepancy Search (ECML PKDD 2022).

Implementations§

Source§

impl DiscrepancyRule

Source

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

A rule whose budget grows following increment, up to limit.

Source

pub fn with_priority(self, priority: u8) -> Self

Sets the evaluation priority.

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 the budget of the first pass.

Source

pub fn update_to_true_limit( &mut self, nb_candidates: usize, remaining_depth: usize, )

Lowers the limit to the largest discrepancy a tree of remaining_depth levels over nb_candidates features can have.

Trait Implementations§

Source§

impl Default for DiscrepancyRule

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Rule for DiscrepancyRule

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 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 is_active(&self) -> bool

Whether the rule is applied.
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.