[][src]Struct hierarchical_pathfinding::PathCacheConfig

pub struct PathCacheConfig {
    pub chunk_size: usize,
    pub cache_paths: bool,
    pub keep_insertions: bool,
    pub a_star_fallback: bool,
    pub perfect_paths: bool,
}

Options for configuring the PathCache

Default options:

assert_eq!(
    PathCacheConfig {
        chunk_size: 8,
        cache_paths: true,
        keep_insertions: true,
        a_star_fallback: true,
        perfect_paths: false,
    },
    Default::default()
);

Fields

chunk_size: usize

The size of the individual Chunks (defaults to 8)

cache_paths: bool

true (default): store the Paths inside each Chunk.

false: only store the Cost of the Path.

If set to false, calculating the full Path between two Points takes significantly more time. See AbstractPath for more details.

keep_insertions: bool

true (default): any Points inserted when calling find_path or find_paths are left in the Graph.

false: the Points are deleted at the end of those functions.

Keeping Points slightly increases future search times and memory usage, but makes searches to or from those same Points a lot faster.

a_star_fallback: bool

true (default): When a Path is short (roughly Length < 2 * chunk_size), a regular A* search is performed on the Grid after HPA* calculated a Path to confirm the existence and length.

false: The Paths are left as they are.

Setting this option to false will improve performance a bit, but the Paths will take seemingly random detours that makes them longer than they should be.

perfect_paths: bool

true: Nodes are placed on every open entrance of a Chunk. This means that the resulting Paths are always the most optimal ones, but both Memory Usage and Performance are worse.

false (default): Nodes are placed on only some chunk entrances.

The exact effect depends greatly on the Grid and how the Chunks and their entrances align.

Methods

impl PathCacheConfig[src]

pub const LOW_MEM: PathCacheConfig[src]

an example PathCacheConfig with options set to reduce Memory Usage

Values:

assert_eq!(
    PathCacheConfig {
        chunk_size: 16,
        cache_paths: false,
        keep_insertions: false,
        a_star_fallback: true,
        perfect_paths: false,
    },
    PathCacheConfig::LOW_MEM
);

pub const HIGH_PERFORMANCE: PathCacheConfig[src]

an example PathCacheConfig with options set to improve Performance

Values:

assert_eq!(
    PathCacheConfig {
        chunk_size: 8,
        cache_paths: true,
        keep_insertions: true,
        a_star_fallback: false,
        perfect_paths: false,
    },
    PathCacheConfig::HIGH_PERFORMANCE
);

Trait Implementations

impl Copy for PathCacheConfig[src]

impl PartialEq<PathCacheConfig> for PathCacheConfig[src]

impl Default for PathCacheConfig[src]

impl Clone for PathCacheConfig[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for PathCacheConfig[src]

Auto Trait Implementations

Blanket Implementations

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

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

type Owned = T

impl<T> From for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

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

The type returned in the event of a conversion error.

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