Free AI web copilot to create summaries, insights and extended knowledge, download it at here
2540
Abstract
)
current_state = <span class="hljs-keyword">pp</span>.predict_state(current_state, action)
plan.<span class="hljs-keyword">append</span>(action)</pre></div><p id="e288">The algorithm get applicable actions, choose one of them, predict the resultant state and continue iteratively until it finds either the goal state or a no more applicable actions which means that the algorithm has failed to find a solution.</p><h1 id="ee06">Deterministic-search</h1><p id="4925">In this post we specifically look into deterministic version of forward-search, based on “Automated Planning and Acting” book.</p><p id="4c09">Here is the generic version of the algorithm which can be derived by many variety of forward-search algorithms which we will see later.</p>
<figure id="4631">
<div>
<div>
<iframe class="gist-iframe" src="/gist/debbynirwan/dc69672e7b535b8fbd3069ede55c6bb0.js" allowfullscreen="" frameborder="0" height="undefined" width="undefined">
</div>
</div>
</figure></iframe></div></div></figure><p id="6c21">We focus on <b>search</b> function to understand how this algorithm works.</p><p id="5b85">Before we look into the algorithm, first we understand a few concepts.</p><blockquote id="aeb5"><p><b>Frontier</b> is the list of nodes that are ready to be visited whereas <b>Expanded</b> is the list of nodes that has been visited so far.</p></blockquote><figure id="bdfb"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*DGa1u7KrbKAo98KeFcBY5Q.png"><figcaption>Visited and Frontier Nodes</figcaption></figure><p id="8e4d">If we illustrate the nodes in tree like in the picture above, those nodes in green are <b>visited nodes</b> and those nodes in orange are <b>frontier</b> (candidates to be visited) nodes.</p><h1 id="931a">Starting the algorithm</h1><p id="4f97">We start the algorithm by adding initial state or root node to Frontier list before we execute the algorithm.</p><h1 id="bc7b">Executing the algorithm</h1><p id="bdff">These are the main steps in the algorithm.</p><ol><li>Select a node from Frontier
This is an important step and is implemented differently by different algorithms</li><li><b>If the selected node is not the goal</b>, the child nodes are generated
This is the process where we use <b><i>Action Templates</i></b> to search for applicable actions in current state.
We then predict the resultant states by applying the actions to current state (see picture below).</li><li>This step is t
Options
o construct the node by adding <b>successor</b>, <b>predecessor</b> and the <b>total cost of actions</b> so far</li><li>We then compute the heuristic value
This step is basically helping the algorithm to not explore the entire search space because it can be exponentially large, which will make the algorithm runs slowly</li><li>Prune the nodes
This too is a step implemented differently by different algorithms to remove unpromising nodes.
One common thing in this step is to do cycle-checking to ensure that an algorithm terminates, not entering infinite loop.
In some algorithms this step removes nodes from Child Nodes which is not following current direction.
We’ll see more when we discuss instances of this generic algorithm.</li></ol><figure id="90e1"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*t4rHBSpjkj8EqRAN0rI-AA.png"><figcaption>Flow to generate child nodes</figcaption></figure><h1 id="b6bb">Ending the algorithm</h1><p id="7dc4">The algorithm continues to run until it finds a solution (goal state) or has empty Frontier which means it has failed to find a solution to the Planning Problem.</p><h1 id="6e92">Heuristic Function</h1><p id="d662">In <b>step 4</b> we compute a heuristic which is an informed guess to help the algorithm move towards parts of the <b>search space </b>that are <b>likely</b> to lead to solutions.</p><p id="7ab5">h(s)≈h*(s)=min{cost(π)∣γ(s,π) satisfies g}</p><p id="1e79">We choose the likely lowest cost for all paths such that predicted resultant state satisfy goal state.</p><p id="0405">In the next post we’ll look into instances of this algorithm and the examples in solving problems. They are:</p><ul><li>Breadth-first search (BFS)</li><li>Depth-first search (DFS)</li><li>Hill-climbing (Greedy)</li><li>Uniform-cost search</li><li>A*</li><li>Greedy Best-first search (GBFS)</li><li>DFS Branch and Bound</li></ul><div id="fd78" class="link-block">
<a href="https://readmedium.com/deterministic-search-algorithms-part-1-cbb0c6a8ecda">
<div>
<div>
<h2>Deterministic Search Algorithms Part 1</h2>
<div><h3>Learning to solve AI Planning Problems with Deterministic Search Algorithms</h3></div>
<div><p>medium.com</p></div>
</div>
<div>
<div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*BkgvlmVn0mFiUg24sFhxhA.png)"></div>
</div>
</div>
</a>
</div></article></body>