[−][src]Struct ddo::core::implementation::heuristics::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]
fn compare(&self, a: &Node<T>, b: &Node<T>) -> Ordering
[src]
fn compares_lt(&self, l: &L, r: &R) -> bool
[src]
fn compares_le(&self, l: &L, r: &R) -> bool
[src]
fn compares_ge(&self, l: &L, r: &R) -> bool
[src]
fn compares_gt(&self, l: &L, r: &R) -> bool
[src]
fn compares_eq(&self, l: &L, r: &R) -> bool
[src]
fn compares_ne(&self, l: &L, r: &R) -> bool
[src]
fn borrowing(self) -> Borrowing<Self, L, R>
[src]
fn rev(self) -> Rev<Self>
[src]
fn swap(self) -> Swap<Self>
[src]
fn then<D>(self, then: D) -> Then<Self, D> where
D: Compare<L, R>,
[src]
D: Compare<L, R>,
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<F, L, R> Compare<L, R> for F where
F: Fn(&L, &R) -> Ordering + ?Sized,
L: ?Sized,
R: ?Sized,
[src]
F: Fn(&L, &R) -> Ordering + ?Sized,
L: ?Sized,
R: ?Sized,
fn compare(&self, l: &L, r: &R) -> Ordering
[src]
fn compares_lt(&self, l: &L, r: &R) -> bool
[src]
fn compares_le(&self, l: &L, r: &R) -> bool
[src]
fn compares_ge(&self, l: &L, r: &R) -> bool
[src]
fn compares_gt(&self, l: &L, r: &R) -> bool
[src]
fn compares_eq(&self, l: &L, r: &R) -> bool
[src]
fn compares_ne(&self, l: &L, r: &R) -> bool
[src]
fn borrowing(self) -> Borrowing<Self, L, R>
[src]
fn rev(self) -> Rev<Self>
[src]
fn swap(self) -> Swap<Self>
[src]
fn then<D>(self, then: D) -> Then<Self, D> where
D: Compare<L, R>,
[src]
D: Compare<L, R>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,