Skip to content

Commit

Permalink
Fix A* node ordering (#249)
Browse files Browse the repository at this point in the history
  • Loading branch information
EliasLF authored Feb 26, 2023
1 parent 699d294 commit e30f48e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions include/heuristic/HeuristicMapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,10 @@ inline bool operator<(const HeuristicMapper::Node& x,

inline bool operator>(const HeuristicMapper::Node& x,
const HeuristicMapper::Node& y) {
const auto xcost = static_cast<double>(x.costFixed) + x.lookaheadPenalty;
const auto ycost = static_cast<double>(y.costFixed) + y.lookaheadPenalty;
const auto xcost =
static_cast<double>(x.costFixed) + x.lookaheadPenalty + x.costHeur;
const auto ycost =
static_cast<double>(y.costFixed) + y.lookaheadPenalty + y.costHeur;
if (std::abs(xcost - ycost) > 1e-6) {
return xcost > ycost;
}
Expand Down

0 comments on commit e30f48e

Please sign in to comment.