Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ compact-genome = "12.5.0"
traitsequence = "8.1.2"
log = "0.4.27"
num-traits = "0.2.19"
rustc-hash = "2.1.1"
binary-heap-plus = "0.5.0"

[profile.release]
debug = true
4 changes: 2 additions & 2 deletions generic_a_star/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ repository.workspace = true
serde = ["dep:serde"]

[dependencies]
binary-heap-plus = "0.5.0"
binary-heap-plus.workspace = true
num-traits.workspace = true
serde = { workspace = true, features = ["derive"], optional = true }
extend_map = "0.14.4"
compare = "0.1.0"
rustc-hash = "2.1.1"
rustc-hash.workspace = true
29 changes: 29 additions & 0 deletions generic_a_star/src/closed_lists.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
use rustc_hash::{FxHashMapSeed, FxSeededState};

use crate::{AStarClosedList, AStarIdentifier, AStarNode, reset::Reset};

impl<Identifier: AStarIdentifier, Node: AStarNode> AStarClosedList<Identifier, Node>
for FxHashMapSeed<Identifier, Node>
{
fn new() -> Self {
FxHashMapSeed::with_hasher(FxSeededState::with_seed(0))
}

fn len(&self) -> usize {
Self::len(self)
}

fn insert(&mut self, identifier: Identifier, node: Node) -> Option<Node> {
Self::insert(self, identifier, node)
}

fn get(&self, identifier: &Identifier) -> Option<&Node> {
Self::get(self, identifier)
}
}

impl<Identifier, Node> Reset for FxHashMapSeed<Identifier, Node> {
fn reset(&mut self) {
self.clear();
}
}
4 changes: 3 additions & 1 deletion generic_a_star/src/comparator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ mod tests {

use compare::Compare;

use crate::{AStarNode, cost::U64Cost};
use crate::{AStarIdentifier, AStarNode, cost::U64Cost};

use super::AStarNodeComparator;

Expand Down Expand Up @@ -101,6 +101,8 @@ mod tests {
}
}

impl AStarIdentifier for () {}

#[test]
fn compare() {
// Heap is a max heap, hence smaller nodes need to be bigger.
Expand Down
Loading