<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://luminoussheep.net/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Routing_Problem</id>
	<title>Routing Problem - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://luminoussheep.net/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Routing_Problem"/>
	<link rel="alternate" type="text/html" href="https://luminoussheep.net/mediawiki/index.php?title=Routing_Problem&amp;action=history"/>
	<updated>2026-04-16T20:30:09Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://luminoussheep.net/mediawiki/index.php?title=Routing_Problem&amp;diff=93&amp;oldid=prev</id>
		<title>Martin: Created page with &quot;=TreeSearch=  &lt;code&gt; TreeSearch(Problem)  frontier = {[InitialState]}  loop:   If frontier empty return fail - no route exists   path = removeChoice(frontier)   s = path.end...&quot;</title>
		<link rel="alternate" type="text/html" href="https://luminoussheep.net/mediawiki/index.php?title=Routing_Problem&amp;diff=93&amp;oldid=prev"/>
		<updated>2021-09-14T21:43:49Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;=TreeSearch=  &amp;lt;code&amp;gt; TreeSearch(Problem)  frontier = {[InitialState]}  loop:   If frontier empty return fail - no route exists   path = removeChoice(frontier)   s = path.end...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=TreeSearch=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
TreeSearch(Problem)&lt;br /&gt;
 frontier = {[InitialState]}&lt;br /&gt;
 loop:&lt;br /&gt;
  If frontier empty return fail - no route exists&lt;br /&gt;
  path = removeChoice(frontier)&lt;br /&gt;
  s = path.end&lt;br /&gt;
  if goalTest(s) return path&lt;br /&gt;
  for a in actions&lt;br /&gt;
    add [ path + a -&amp;gt; result(s,a)] to frontier&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Key is how removeChoice is made&lt;br /&gt;
&lt;br /&gt;
Must continue until the next path returned from the frontier is the goal to get optimal route - i.e. not testing if found goal when adding state to frontier&lt;br /&gt;
&lt;br /&gt;
Tree search will return to start&lt;br /&gt;
&lt;br /&gt;
=GraphSearch=&lt;br /&gt;
Graph search remembers nodes visited&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
GraphSearch(Problem)&lt;br /&gt;
 frontier = {[InitialState]}&lt;br /&gt;
 explored = {}&lt;br /&gt;
 loop:&lt;br /&gt;
  If frontier empty return fail - no route exists&lt;br /&gt;
  path = removeChoice(frontier)&lt;br /&gt;
  s = path.end&lt;br /&gt;
  add s to explored&lt;br /&gt;
  if goalTest(s) return path&lt;br /&gt;
  for a in actions&lt;br /&gt;
    add [ path + a -&amp;gt; result(s,a)] to frontier unless result(s, a) in explored&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Breadth first search=&lt;br /&gt;
Looks for shortest (steps) next path&lt;br /&gt;
&lt;br /&gt;
=Uniform cost search=&lt;br /&gt;
Looks for cheapest next&lt;br /&gt;
&lt;br /&gt;
=A* (best estimate shortest cost first)=&lt;br /&gt;
f=g(path) + h(path)&lt;br /&gt;
Where:&lt;br /&gt;
* g(path) = path cost so far&lt;br /&gt;
* h(path) == h(state) = estimate distance to goal (heuristic)&lt;br /&gt;
&lt;br /&gt;
==Admissible heuristics==&lt;br /&gt;
heuristic must be optimistic&lt;br /&gt;
* h(s) &amp;lt; true cost&lt;br /&gt;
** h - never overestimates&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finding lowest f :=&lt;br /&gt;
* minimise g - minimise path so far&lt;br /&gt;
* minimise h - focus search&lt;br /&gt;
&lt;br /&gt;
best heuristic - h = max(h1, h2) - where h1, h2 admissible&lt;br /&gt;
&lt;br /&gt;
==Finding a good heuristic==&lt;br /&gt;
Take definition of problem, remove a constraint.&lt;br /&gt;
Removing constraint effectively is adding a new operator that makes the problem simpler.&lt;br /&gt;
&lt;br /&gt;
=Complete=&lt;br /&gt;
Will algorithm find goal given infinite set&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Search type !! Storage !! Complete&lt;br /&gt;
|-&lt;br /&gt;
| Breadth first || 2^n || Y&lt;br /&gt;
|-&lt;br /&gt;
| Uniform cost || ~ 2^n || Y&lt;br /&gt;
|-&lt;br /&gt;
| Depth first || ~n || N&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Martin</name></author>
	</entry>
</feed>