Already a member? Log in

Sign up with your...

or

Sign Up with your email address

Add Tags

Duplicate Tags

Rename Tags

Share This URL With Others!

Save Link

Sign in

Sign Up with your email address

Sign up

By clicking the button, you agree to the Terms & Conditions.

Forgot Password?

Please enter your username below and press the send button.
A password reset link will be sent to you.

If you are unable to access the email address originally associated with your Delicious account, we recommend creating a new account.

URL: http://theory.stanford.edu/~amitp/GameProgramming/Heuristics.html

Heuristics

tells A* an estimate of the minimum cost from any vertex

n

to the goal. It’s important to choose a good heuristic function.

The heuristic can be used to control A*’s behavior.

At one extreme, if

h(n)

is 0, then only

g(n)

plays a role, and A* turns into Dijkstra’s algorithm, which is guaranteed to find a shortest path.

If

h(n)

is always lower than (or equal to) the cost of moving from to the goal, then A* is guaranteed to find a shortest path. The lower

h(n)

is, the more node A* expands, making it slower.

If

h(n)

is exactly equal to the cost of moving from to the goal, then A* will only follow the best path and never expand anything else, making it very fast. Although you can’t make this happen in all cases, you can make it exact in some special cases. It’s nice to know that given perfect information, A* will behave perfectly.

If

h(n)

is sometimes greater than the cost of moving from to the goal, then A* is not guaranteed to find a shortest path, but it can run faster.

At the other extreme, if

h(n)

is very high relative to

g(n)

, then only

h(n)

plays a role, and A* turns into Best-First-Search.

Note:

Technically, the A* algorithm should be called simply A if the heuristic is an underestimate of the actual cost. However, I will continue to call it A* because the implementation is the same and the game programming community does not distinguish A from A*.

So we have an interesting situation in that we can decide what we want to get out of A*. At exactly the right point, we’ll get shortest paths really quickly. If we’re too low, then we’ll continue to get shortest paths, but it’ll slow down. If we’re too high, then we give up shortest paths, but A* will run faster.

In a game, this property of A* can be very useful.

Share It With Others!

Comments

http://theory.stanford.edu/~amitp/GameProgramming/Heuristics.html

The heuristic function h(n) tells A* an estimate of the minimum cost from any vertex n to the goal. It’s important to choose a good heuristic function.

A*’s Use of the Heuristic

A discussion about various A* heuristics.

qosys

programming, networking, devops and other stuff