<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2.1" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Don&#8217;t follow the shortest path!</title>
	<link>http://realtimecollisiondetection.net/blog/?p=56</link>
	<description>Coding wisdom and rants of Christer Ericson</description>
	<pubDate>Wed, 19 Jun 2013 10:52:14 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.1</generator>

	<item>
		<title>By: christer</title>
		<link>http://realtimecollisiondetection.net/blog/?p=56#comment-3355</link>
		<author>christer</author>
		<pubDate>Mon, 08 Nov 2010 04:59:23 +0000</pubDate>
		<guid>http://realtimecollisiondetection.net/blog/?p=56#comment-3355</guid>
		<description>Also, for some more criticism of A* and pathfinding, see Niklas Frykholm's blog post &lt;a href="http://bitsquid.blogspot.com/2010/10/is-overrated.html" rel="nofollow"&gt;A* is overrated&lt;/a&gt;.</description>
		<content:encoded><![CDATA[<p>Also, for some more criticism of A* and pathfinding, see Niklas Frykholm&#8217;s blog post <a href="http://bitsquid.blogspot.com/2010/10/is-overrated.html" rel="nofollow">A* is overrated</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: alexkring</title>
		<link>http://realtimecollisiondetection.net/blog/?p=56#comment-3308</link>
		<author>alexkring</author>
		<pubDate>Wed, 28 Jul 2010 01:56:55 +0000</pubDate>
		<guid>http://realtimecollisiondetection.net/blog/?p=56#comment-3308</guid>
		<description>Good article! Too bad I'm 2 years late on reading it. I was surprised to see that in your game development experience, the AI programmers were focused on the admissibility of A*. Having a good understanding of the A* heuristic is useful, as you describe. I think that the manner in which you ought to apply domain specific knowledge to your A* heuristic, is largely dependent upon the  the terrain representation. For grids, using inadmissible heuristics is quite useful, since the greatest performance gains are realized on grids, where there are typically many more nodes than other representations like a nav mesh, and thus there is more room to explore unnecessary areas. In practice, I think the performance gains would be negligible for most games that use nav meshes. I can't really speak for waypoints, since I've never worked with them. But for nav meshes, I'd rather just use a simple euclidean distance heuristic, and avoid any additional confusion. A* hasn't been a performance problem when I've used nav meshes. Though, I do prefer grids :] 

BTW, Amit's A* page provides a a few clear examples where inadmissible heuristics are useful on grids: http://theory.stanford.edu/~amitp/GameProgramming/Heuristics.html#S7</description>
		<content:encoded><![CDATA[<p>Good article! Too bad I&#8217;m 2 years late on reading it. I was surprised to see that in your game development experience, the AI programmers were focused on the admissibility of A*. Having a good understanding of the A* heuristic is useful, as you describe. I think that the manner in which you ought to apply domain specific knowledge to your A* heuristic, is largely dependent upon the  the terrain representation. For grids, using inadmissible heuristics is quite useful, since the greatest performance gains are realized on grids, where there are typically many more nodes than other representations like a nav mesh, and thus there is more room to explore unnecessary areas. In practice, I think the performance gains would be negligible for most games that use nav meshes. I can&#8217;t really speak for waypoints, since I&#8217;ve never worked with them. But for nav meshes, I&#8217;d rather just use a simple euclidean distance heuristic, and avoid any additional confusion. A* hasn&#8217;t been a performance problem when I&#8217;ve used nav meshes. Though, I do prefer grids :] </p>
<p>BTW, Amit&#8217;s A* page provides a a few clear examples where inadmissible heuristics are useful on grids: <a href="http://theory.stanford.edu/~amitp/GameProgramming/Heuristics.html#S7" rel="nofollow">http://theory.stanford.edu/~amitp/GameProgramming/Heuristics.html#S7</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: realtimecollisiondetection.net - the blog &#187; Catching up (part 2)</title>
		<link>http://realtimecollisiondetection.net/blog/?p=56#comment-2779</link>
		<author>realtimecollisiondetection.net - the blog &#187; Catching up (part 2)</author>
		<pubDate>Mon, 08 Jun 2009 08:51:21 +0000</pubDate>
		<guid>http://realtimecollisiondetection.net/blog/?p=56#comment-2779</guid>
		<description>[...] to hill-climbing, which is a local and not global search method). Using potential fields to bias a (non-admissible) A* search to reduce search effort is fine [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] to hill-climbing, which is a local and not global search method). Using potential fields to bias a (non-admissible) A* search to reduce search effort is fine [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: thumphreys</title>
		<link>http://realtimecollisiondetection.net/blog/?p=56#comment-2370</link>
		<author>thumphreys</author>
		<pubDate>Wed, 24 Sep 2008 01:48:11 +0000</pubDate>
		<guid>http://realtimecollisiondetection.net/blog/?p=56#comment-2370</guid>
		<description>An example of domain-knowledge could be this(correct me if I'm wrong Christer):  Say we have a domain where we observe that most of the paths generated travel through the center of the level.  Knowing this we could create a heuristic  to score path nodes closer to the center better than those further away.  This would help a* find a path quicker.

Now in practice I don't see you really wanting all your paths to go through the center, or having different heuristics per level.   But I think this shows the point in an arbitrary graph.

To the point of not needed the best path, I agree 100%.  Taking a less direct path doesn't make the ai look dumb in most cases.  I do think more time should be taken in making the paths more life like (whether that involves smoothing the path or not).

Interesting set of articles :)

Troy</description>
		<content:encoded><![CDATA[<p>An example of domain-knowledge could be this(correct me if I&#8217;m wrong Christer):  Say we have a domain where we observe that most of the paths generated travel through the center of the level.  Knowing this we could create a heuristic  to score path nodes closer to the center better than those further away.  This would help a* find a path quicker.</p>
<p>Now in practice I don&#8217;t see you really wanting all your paths to go through the center, or having different heuristics per level.   But I think this shows the point in an arbitrary graph.</p>
<p>To the point of not needed the best path, I agree 100%.  Taking a less direct path doesn&#8217;t make the ai look dumb in most cases.  I do think more time should be taken in making the paths more life like (whether that involves smoothing the path or not).</p>
<p>Interesting set of articles :)</p>
<p>Troy</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: realtimecollisiondetection.net - the blog &#187; Memory-efficient pathfinding</title>
		<link>http://realtimecollisiondetection.net/blog/?p=56#comment-2344</link>
		<author>realtimecollisiondetection.net - the blog &#187; Memory-efficient pathfinding</author>
		<pubDate>Sun, 21 Sep 2008 07:59:30 +0000</pubDate>
		<guid>http://realtimecollisiondetection.net/blog/?p=56#comment-2344</guid>
		<description>[...] time&#8217;s a charm they say, and as I&#8217;ve talked about pathfinding twice before (in Don’t follow the shortest path! and Aiding pathfinding with cellular automata) I thought I&#8217;d charm everyone with a third [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] time&#8217;s a charm they say, and as I&#8217;ve talked about pathfinding twice before (in Don’t follow the shortest path! and Aiding pathfinding with cellular automata) I thought I&#8217;d charm everyone with a third [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Which is the Yellow Brick Path: Shortest or Best? &#8212; AiGameDev.com</title>
		<link>http://realtimecollisiondetection.net/blog/?p=56#comment-2236</link>
		<author>Which is the Yellow Brick Path: Shortest or Best? &#8212; AiGameDev.com</author>
		<pubDate>Wed, 06 Aug 2008 15:19:52 +0000</pubDate>
		<guid>http://realtimecollisiondetection.net/blog/?p=56#comment-2236</guid>
		<description>[...] pathfinding in the subjective sense. Christer Ericson of RealtimeCollisionDetection.net recently touched on this problem in a blog post where he suggested that the extra clock cycles we burn to find the exact shortest [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] pathfinding in the subjective sense. Christer Ericson of RealtimeCollisionDetection.net recently touched on this problem in a blog post where he suggested that the extra clock cycles we burn to find the exact shortest [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: realtimecollisiondetection.net - the blog &#187; Aiding pathfinding with cellular automata</title>
		<link>http://realtimecollisiondetection.net/blog/?p=56#comment-1944</link>
		<author>realtimecollisiondetection.net - the blog &#187; Aiding pathfinding with cellular automata</author>
		<pubDate>Tue, 01 Jul 2008 06:02:49 +0000</pubDate>
		<guid>http://realtimecollisiondetection.net/blog/?p=56#comment-1944</guid>
		<description>[...] BTW, there are other rules than the one I gave above, which prune even more of the search space, but will take away free cells that would be needed for a shortest path. But, than again, we don&#8217;t always care about a shortest path, do we now. [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] BTW, there are other rules than the one I gave above, which prune even more of the search space, but will take away free cells that would be needed for a shortest path. But, than again, we don&#8217;t always care about a shortest path, do we now. [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kenpex</title>
		<link>http://realtimecollisiondetection.net/blog/?p=56#comment-1256</link>
		<author>kenpex</author>
		<pubDate>Tue, 10 Jun 2008 04:56:50 +0000</pubDate>
		<guid>http://realtimecollisiondetection.net/blog/?p=56#comment-1256</guid>
		<description>Sorry for the spam Christer, but I don't have any other mean to contact you and I was interested in knowing what do you think about this post:

http://c0de517e.blogspot.com/2008/06/c-is-premature-optimization.html

well, if you have any time to read it.</description>
		<content:encoded><![CDATA[<p>Sorry for the spam Christer, but I don&#8217;t have any other mean to contact you and I was interested in knowing what do you think about this post:</p>
<p><a href="http://c0de517e.blogspot.com/2008/06/c-is-premature-optimization.html" rel="nofollow">http://c0de517e.blogspot.com/2008/06/c-is-premature-optimization.html</a></p>
<p>well, if you have any time to read it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: christer</title>
		<link>http://realtimecollisiondetection.net/blog/?p=56#comment-1070</link>
		<author>christer</author>
		<pubDate>Thu, 05 Jun 2008 07:41:05 +0000</pubDate>
		<guid>http://realtimecollisiondetection.net/blog/?p=56#comment-1070</guid>
		<description>Alex, as you know A* works on an arbitrary graph, so what I'm talking about is not restricted in any way, but works fine with waypoint graphs, navmeshes, or what-have-you. Furthermore, what I'm talking about is nothing new. It's been known for 40 years that using a heuristic function where you give up admissibility and instead embed &lt;b&gt;domain-specific knowledge&lt;/b&gt;, (greatly) benefits A* in terms of performing a much more focused search.

That's exactly what the Euclidean vs. Manhattan heuristic on a 4-connected grid does: we know we're restricted to 4-way movement so Manhattan distance encodes this domain-specific knowledge whereas Euclidean distance does not. But using nonadmissible heuristics is in no way limited to the domain of that particular example: they apply to &lt;b&gt;anything&lt;/b&gt;.

Tagging on a multiplier on the heuristic is not adding domain-specific knowledge. So, yes, you can do much more than that. (Though, if we do not understand the problem enough to have domain-specific knowledge to apply, the only course of action is to first gain such knowledge.) Scaling the heuristic is pretty much equivalent to admitting you don't really understand the domain, so you've resorted to random twiddling by doing that. It's okay to do random twiddling, of course, so I'm not belittling doing so, but it's not a substitute for using knowledge, when knowledge is available.

Anyway, to put it more strongly than before: the statement above that "we can reduce search effort, sometimes drastically, by forfeiting the guarantee of an optimal shortest-path using nonadmissible heuristics" is not my opinion or anything like that; it is a fact.

For those who do not see this, I thoroughly recommend reading the original paper on A* ([Hart68] as linked above). Pages 64-71 of [Barr82] is also a recommended read (pages 67-71 are entirely devoted to relaxing the optimality restriction for A*).</description>
		<content:encoded><![CDATA[<p>Alex, as you know A* works on an arbitrary graph, so what I&#8217;m talking about is not restricted in any way, but works fine with waypoint graphs, navmeshes, or what-have-you. Furthermore, what I&#8217;m talking about is nothing new. It&#8217;s been known for 40 years that using a heuristic function where you give up admissibility and instead embed <b>domain-specific knowledge</b>, (greatly) benefits A* in terms of performing a much more focused search.</p>
<p>That&#8217;s exactly what the Euclidean vs. Manhattan heuristic on a 4-connected grid does: we know we&#8217;re restricted to 4-way movement so Manhattan distance encodes this domain-specific knowledge whereas Euclidean distance does not. But using nonadmissible heuristics is in no way limited to the domain of that particular example: they apply to <b>anything</b>.</p>
<p>Tagging on a multiplier on the heuristic is not adding domain-specific knowledge. So, yes, you can do much more than that. (Though, if we do not understand the problem enough to have domain-specific knowledge to apply, the only course of action is to first gain such knowledge.) Scaling the heuristic is pretty much equivalent to admitting you don&#8217;t really understand the domain, so you&#8217;ve resorted to random twiddling by doing that. It&#8217;s okay to do random twiddling, of course, so I&#8217;m not belittling doing so, but it&#8217;s not a substitute for using knowledge, when knowledge is available.</p>
<p>Anyway, to put it more strongly than before: the statement above that &#8220;we can reduce search effort, sometimes drastically, by forfeiting the guarantee of an optimal shortest-path using nonadmissible heuristics&#8221; is not my opinion or anything like that; it is a fact.</p>
<p>For those who do not see this, I thoroughly recommend reading the original paper on A* ([Hart68] as linked above). Pages 64-71 of [Barr82] is also a recommended read (pages 67-71 are entirely devoted to relaxing the optimality restriction for A*).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: alexjc</title>
		<link>http://realtimecollisiondetection.net/blog/?p=56#comment-1053</link>
		<author>alexjc</author>
		<pubDate>Wed, 04 Jun 2008 23:03:54 +0000</pubDate>
		<guid>http://realtimecollisiondetection.net/blog/?p=56#comment-1053</guid>
		<description>Good point about the Manhattan distance.  What I had in mind, however, were much less structured waypoint grids or arbitrary nav-meshes.  Unless I'm missing out on some amazing trick, and assuming you don't consider a hierarchy as a form of heuristic, you can't really do much more to speed up your search except using that extra multiplier we discussed.  (And even that has its performance problems in certain cases.)

Alex</description>
		<content:encoded><![CDATA[<p>Good point about the Manhattan distance.  What I had in mind, however, were much less structured waypoint grids or arbitrary nav-meshes.  Unless I&#8217;m missing out on some amazing trick, and assuming you don&#8217;t consider a hierarchy as a form of heuristic, you can&#8217;t really do much more to speed up your search except using that extra multiplier we discussed.  (And even that has its performance problems in certain cases.)</p>
<p>Alex</p>
]]></content:encoded>
	</item>
</channel>
</rss>
