Skip to content

Commit

Permalink
Merge pull request #579 from evenfurther/smallestcostholder-explanation
Browse files Browse the repository at this point in the history
docs(astar): add documentation for SmallestCostHolder
  • Loading branch information
samueltardieu authored Aug 24, 2024
2 parents 3c3f05f + ad95f6e commit 0e8fa53
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/directed/astar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,12 @@ where
.map(|(solutions, cost)| (solutions.collect(), cost))
}

/// This structure is used to implement Rust's max-heap as a min-heap
/// version for A*. The smallest `estimated_cost` (which is the sum of
/// the `cost` and the heuristic) is preferred. For the same
/// `estimated_cost`, the highest `cost` will be favored, as it may
/// indicate that the goal is nearer, thereby requiring fewer
/// exploration steps.
struct SmallestCostHolder<K> {
estimated_cost: K,
cost: K,
Expand Down

0 comments on commit 0e8fa53

Please sign in to comment.