estimateTotalCost abstract method

  1. @override
double estimateTotalCost(
  1. Pos node
)
override

Estimates the minimum total cost of reaching the goal from node.

Given h(n), the heuristic, and g(n), the (unknown) actual cost:

Heuristic Optimality Guarantee Performance
h(n) == 0 Yes ^1 Potentially slower
h(n) <= g(n) Yes Varies (slower with lower h(n))
h(n) == g(n) Yes Fastest possible
h(n) > g(n) No Faster
h(n) > g(n), always No ^2 Very fast

^1: A* becomes Dijsktra's algorithm.

^2: A* becomes Greedy Best-First Search.

Implementation

@override
double estimateTotalCost(Pos node);