GridHeuristic.manhattan constructor

const GridHeuristic.manhattan(
  1. Pos goal, {
  2. double ratio,
})

Uses distanceManhattan to estimate the total cost.

The ratio parameter can be used to scale the heuristic, making it more or less aggressive, where the default value is 1.0; a higher value makes the heuristic tend to overestimate the cost, which makes algorithms like A* run faster, while a lower value makes it tend to underestimate the cost which makes the algorithm run slower but may find a more optimal path.

Implementation

const factory GridHeuristic.manhattan(
  Pos goal, {
  double ratio,
}) = _ManhattanHeuristic;