[][src]Struct ddo::core::implementation::heuristics::MinLP

pub struct MinLP;

This is the default node selection heuristic This heuristic orders the nodes from best to worst by considering the nodes having a minimal longest path as being the wost.

MinLP considers the worst nodes as the ones being the least according to this ordering. This means that in order to sort a vector of nodes from best to worst (ie. to implement restriction), the ordering should be reversed.

Example


let a = Node {state: 'a', info: NodeInfo{lp_len: 42, lp_arc: None, ub: 100, is_exact: true, is_relaxed: false}};
let b = Node {state: 'b', info: NodeInfo{lp_len:  2, lp_arc: None, ub: 100, is_exact: true, is_relaxed: false}};
let c = Node {state: 'c', info: NodeInfo{lp_len: 24, lp_arc: None, ub: 100, is_exact: true, is_relaxed: false}};
let d = Node {state: 'd', info: NodeInfo{lp_len: 13, lp_arc: None, ub: 100, is_exact: true, is_relaxed: false}};
let e = Node {state: 'e', info: NodeInfo{lp_len: 65, lp_arc: None, ub: 100, is_exact: true, is_relaxed: false}};
let f = Node {state: 'f', info: NodeInfo{lp_len: 19, lp_arc: None, ub: 100, is_exact: true, is_relaxed: false}};

let mut nodes = vec![&a, &b, &c, &d, &e, &f];
nodes.sort_by(|x, y| MinLP.compare(x, y).reverse());
assert_eq!(vec![&e, &a, &c, &f, &d, &b], nodes);

Trait Implementations

impl Clone for MinLP[src]

impl<T> Compare<Node<T>, Node<T>> for MinLP[src]

impl Debug for MinLP[src]

impl Default for MinLP[src]

Auto Trait Implementations

impl RefUnwindSafe for MinLP

impl Send for MinLP

impl Sync for MinLP

impl Unpin for MinLP

impl UnwindSafe for MinLP

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<F, L, R> Compare<L, R> for F where
    F: Fn(&L, &R) -> Ordering + ?Sized,
    L: ?Sized,
    R: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.