Skip to main content

CbsHeuristic

Enum CbsHeuristic 

Source
pub enum CbsHeuristic {
    None,
    Cg,
    Dg,
    Wdg,
}
Expand description

An admissible estimate of how much the sum of costs of a constraint-tree node must still rise (CbsConfig::heuristic).

Each one needs the MDDs of the node’s conflicting agents. A stronger heuristic means fewer expansions; WDG pays for that with a small search per dependent pair.

§Examples

use mapf_search::{Agent, CbsConfig, CbsHeuristic, Grid, Instance, Limits, Objective, cbs_with};

let grid = Grid::parse(&["@.@", "...", ".@."]);
let agents = vec![
    Agent { start: 1, goal: 3 },
    Agent { start: 6, goal: 5 },
    Agent { start: 4, goal: 1 },
];
let instance = Instance::new(grid, agents)?;
let run = |heuristic| {
    let config = CbsConfig { heuristic, ..CbsConfig::improved(Objective::SumOfCosts) };
    cbs_with(&instance, config, Limits::expansions(100_000))
};

let (cg, wdg) = (run(CbsHeuristic::Cg), run(CbsHeuristic::Wdg));
assert_eq!(cg.solution().map(|s| s.sum_of_costs), Some(19));
assert_eq!(wdg.solution().map(|s| s.sum_of_costs), Some(19));
assert!(wdg.stats.expanded < cg.stats.expanded);

Variants§

§

None

No heuristic: nodes are ordered by their sum of costs.

§

Cg

CG (Felner et al. 2018): a lower bound on the minimum vertex cover of the graph of agents with cardinal conflicts.

§

Dg

DG (Li et al. 2019): the same over the graph of dependent agents, whose MDDs have no conflict-free combination. At least CG.

§

Wdg

WDG (Li et al. 2019): the DG graph with each edge weighted by how much the pair’s sum of costs must rise, found by a small CBS over the pair (capped at 64 expansions, then a lower bound), and an edge-weighted vertex cover. At least DG.

Trait Implementations§

Source§

impl Clone for CbsHeuristic

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for CbsHeuristic

Source§

impl Debug for CbsHeuristic

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CbsHeuristic

Source§

fn default() -> Self

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

impl Eq for CbsHeuristic

Source§

impl Hash for CbsHeuristic

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for CbsHeuristic

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for CbsHeuristic

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.