Skip to main content

Dominance

Trait Dominance 

Source
pub trait Dominance {
    type State;
    type Key;

    // Required methods
    fn get_key(&self, state: Arc<Self::State>) -> Option<Self::Key>;
    fn nb_dimensions(&self, state: &Self::State) -> usize;
    fn get_coordinate(&self, state: &Self::State, i: usize) -> isize;

    // Provided methods
    fn use_value(&self) -> bool { ... }
    fn partial_cmp(
        &self,
        a: &Self::State,
        val_a: isize,
        b: &Self::State,
        val_b: isize,
    ) -> Option<DominanceCmpResult> { ... }
    fn cmp(
        &self,
        a: &Self::State,
        val_a: isize,
        b: &Self::State,
        val_b: isize,
    ) -> Ordering { ... }
}
Expand description

This trait abstracts gives the possibility to model dominance relations between the states of a specific problem. The dominance relation is evaluated only for pairs of states that are mapped to the same key. A dominance relation exists if the coordinates of a state are greater or equal than those of another state for all given dimensions. The value obtained by the solver for each state can optionally be used as a coordinate in the comparison.

Required Associated Types§

Required Methods§

Source

fn get_key(&self, state: Arc<Self::State>) -> Option<Self::Key>

Takes a state and returns a key that maps it to comparable states

Source

fn nb_dimensions(&self, state: &Self::State) -> usize

Returns the number of dimensions to include in the comparison

Source

fn get_coordinate(&self, state: &Self::State, i: usize) -> isize

Returns the i-th coordinate associated with the given state Greater is better for the dominance check

Provided Methods§

Source

fn use_value(&self) -> bool

Whether to include the value as a coordinate in the dominance check

Source

fn partial_cmp( &self, a: &Self::State, val_a: isize, b: &Self::State, val_b: isize, ) -> Option<DominanceCmpResult>

Checks whether there is a dominance relation between the two states, given the coordinates provided by the function get_coordinate evaluated for all i in 0..self.nb_dimensions() Note: the states are assumed to have the same key, otherwise they are not comparable for dominance

Source

fn cmp( &self, a: &Self::State, val_a: isize, b: &Self::State, val_b: isize, ) -> Ordering

Comparator to order states by increasing value, regardless of their key

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§