[−][src]Struct ddo::core::implementation::heuristics::MaxUB
This is the default heuristic to set the order in which nodes are popped from the fringe So far, this is not only the default heuristic, but it is also your only choice (this was configurable in the past and could possibly change back in the future).
This ordering optimistically selects the most promising nodes first. That is, it ranks nodes based on the upper bound reachable passing through them (larger is ranked higher) and then on the length of their longest path (again, longer is better).
Note
This ordering considers the worst nodes as being the least elements of the order.
Example
let a = Node {state: 'a', info: NodeInfo{lp_len: 42, lp_arc: None, ub: 300, 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: 150, is_exact: true, is_relaxed: false}}; let d = Node {state: 'd', info: NodeInfo{lp_len: 13, lp_arc: None, ub: 60, is_exact: true, is_relaxed: false}}; let e = Node {state: 'e', info: NodeInfo{lp_len: 65, lp_arc: None, ub: 700, 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 nodes = vec![a.clone(), b.clone(), c.clone(), d.clone(), e.clone(), f.clone()]; let mut priority_q = BinaryHeap::from_vec_cmp(nodes, MaxUB); assert_eq!(e, priority_q.pop().unwrap()); // because 700 is the highest upper bound assert_eq!(a, priority_q.pop().unwrap()); // because 300 is the next highest assert_eq!(c, priority_q.pop().unwrap()); // idem, because of ub = 150 assert_eq!(f, priority_q.pop().unwrap()); // because ub = 100 but lp_len = 19 assert_eq!(b, priority_q.pop().unwrap()); // because ub = 100 but lp_len = 2 assert_eq!(d, priority_q.pop().unwrap()); // because ub = 13 which is the worst
Trait Implementations
impl Clone for MaxUB
[src]
impl<T> Compare<Node<T>, Node<T>> for MaxUB
[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 MaxUB
[src]
impl Default for MaxUB
[src]
Auto Trait Implementations
impl RefUnwindSafe for MaxUB
impl Send for MaxUB
impl Sync for MaxUB
impl Unpin for MaxUB
impl UnwindSafe for MaxUB
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>,