<?xml version="1.0" encoding="UTF-8" standalone="yes"?><oembed><version><![CDATA[1.0]]></version><provider_name><![CDATA[vyasastrategy]]></provider_name><provider_url><![CDATA[https://vyasastrategy.wordpress.com]]></provider_url><author_name><![CDATA[vvyasa]]></author_name><author_url><![CDATA[https://vyasastrategy.wordpress.com/author/vvyasa/]]></author_url><title><![CDATA[Finding Optimal Paths]]></title><type><![CDATA[link]]></type><html><![CDATA[<p>Given a  search space, apply search and find the solution quickly and make sure that solution is optimal. i.e, both look up cost and execution cost must be minimum.</p>
<p>Brute force procedure</p>
<p style="text-align:left;">BritishMuseum (){</p>
<ol>
<li style="text-align:left;">Explore the entire search space;</li>
<li style="text-align:left;"><em><strong>return</strong> </em>the optimal solution;</li>
</ol>
<p>}</p>
<p>Branch&amp;Bound(){</p>
<ol>
<li>open &lt;- {(start, NIL, Cost(start))}</li>
<li>closed &lt;- {}</li>
<li><em><strong>while</strong></em> TRUE</li>
<li>  <em><strong>do if</strong></em> Empty(open)</li>
<li>                  <em><strong>then return</strong></em> FAILURE;</li>
<li>  pick  the cheapest node n from  open</li>
<li>  <em><strong>if</strong></em> GoalTest(Head(n))</li>
<li>          <strong><em> then</em> </strong>return ReconstructPath(n)</li>
<li>  <strong><em> else </em></strong> children &lt;- MoveGen(Head(n))</li>
<li>             <em><strong>for each</strong></em> m ∈ children{</li>
<li>                      <em><strong>do</strong></em> Cost(m) &lt;- Cost(n) + K(m, n)</li>
<li>                       Add  (m, Head(n), Cost(m) ) to open }</li>
</ol>
<p>}</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>GeneralisedBranch&amp;Bound(){</p>
<ol>
<li>start with all possible solutions</li>
<li><strong><em>repeat</em> </strong></li>
<li>     Refine the least ( Estimated cost ) solution further</li>
<li><em><strong>until </strong></em>the cheapest solution is fully refined<em><strong><br />
</strong></em></li>
<li><em>return</em> s</li>
</ol>
<p>}</p>
<p>&nbsp;</p>
<p>Dijkstra&#8217;s Alg(){</p>
<ol>
<li>Color all nodes white</li>
<li>cost(start) &lt;- 0</li>
<li>parent(start) &lt;- NIL</li>
<li><em><strong>for</strong></em> all other nodes n</li>
<li>      <strong><em> do</em></strong> cost(n) &lt;- ∞</li>
<li><em><strong>repeat</strong></em></li>
<li>    select lowest cost white node n</li>
<li>     color n black</li>
<li>     <em><strong>for</strong> </em>all white neighbors m of n</li>
<li>            <strong><em>do if</em></strong> (const(n) + k(n, m)) &lt; cost(m)</li>
<li>                  <em><strong>then</strong></em> cost(m) = const(n) + k(n, m)</li>
<li>                            parent(m) &lt;- n</li>
<li><em><strong>until</strong> </em>all nodes are colored black</li>
</ol>
<p>}</p>
<p>A*(){</p>
<p>// heuristic fun f(n) = g(n) + h(n)</p>
<p>//g(n) =known cost of path found from S to n</p>
<p>//h(n) = Estimated cost of path from n to G</p>
<ol>
<li>open &lt;- List(start)</li>
<li>f(start) &lt;- h(start)</li>
<li>parent(start) &lt;- NIL</li>
<li>closed &lt;- {}</li>
<li>while open is not EMPTY</li>
<li>   do</li>
<li>       Remove node n from open such that f(n) has the lowest value</li>
<li>       Add n to closed</li>
<li>       if GoalTest(n) == TRUE</li>
<li>            then return Reconstructpath(n)</li>
<li>       neighbors &lt;- MoveGen(n)</li>
<li>       for each m ∈ neighbors</li>
<li>              do switch</li>
<li>                   case m ∉ open and m ∉ closed : /* new node */</li>
<li>                           Add m to open</li>
<li>                           parent(m) &lt;- n</li>
<li>                           g(m) &lt;- g(n) + k(n, m)</li>
<li>                           f(m) &lt;- g(m) + h(m)</li>
<li></li>
<li>                    case m ∈ open :</li>
<li>                           if (g(n) + k(n, m) ) &lt; g(m)</li>
<li>                                  then  parent(m) &lt;- n</li>
<li>                                             g(m) &lt;- g(n) + k(n, m )</li>
<li>                                             f(m) &lt;- g(m) + h(m)</li>
<li></li>
<li>                    case m ∈ closed :</li>
<li>                           if (g(n) + k(n, m) ) &lt; g(m)</li>
<li>                                  then  parent(m) &lt;- n</li>
<li>                                             g(m) &lt;- g(n) + k(n, m )</li>
<li>                                             f(m) &lt;- g(m) + h(m)</li>
<li>                                            propagateImprovement(m)</li>
<li>return FAILURE</li>
</ol>
<p>}</p>
<p>PropagateImprovement(m){</p>
<ol>
<li> neighbours &lt;- MoveGen(m)</li>
<li>for each  s ∈ neighbours</li>
<li>        do newGvalue &lt;- g(m)  + k(m, s)</li>
<li>              if newGvalue &lt; g(s)</li>
<li>                  then parent(s) &lt;- m</li>
<li>                            g(s) &lt;- newGvalue</li>
<li>                            if s ∈ closed</li>
<li>                                  then PropagateImprovement(s)</li>
</ol>
<p>}</p>
<p>&nbsp;</p>
<p>Admissibility of A*</p>
<p>Assumptions:</p>
<ol>
<li>The branching factor is finite</li>
</ol>
]]></html></oembed>