web viewtamil created date: 01/29/2015 19:46:00 last modified by: tamil

12
Uninformed search There is no information about the number of steps or the path cost from the current state to the goal. All they can do is distinguish a goal state from a non-goal. 1. Breadth-first search 2. Uniform cost search 3. Depth-first search 4. Depth limited search 5. Iterative deepening search 6. BI-directional Search Breadth-first search The root node is expanded first, then all the successors of the root node, and their successors and so on In general, all the nodes are expanded at a given depth in the search tree before any nodes at the next level are expanded Expand shallowest unexpanded node Implementation: fringe is a FIFO queue, The nodes that are visited first will be expanded first All newly generated successors will be put at the end of the queue Shallow nodes are expanded before deeper nodes

Upload: vandan

Post on 24-Feb-2018

213 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Web viewtamil Created Date: 01/29/2015 19:46:00 Last modified by: tamil

Uninformed search

There is no information about the number of steps or the path cost from the current state to the goal. All they can do is distinguish a goal state from a non-goal.

1. Breadth-first search2. Uniform cost search3. Depth-first search4. Depth limited search5. Iterative deepening search 6. BI-directional Search

Breadth-first search

The root node is expanded first, then all the successors of the root node, and their successors and so on In general, all the nodes are expanded at a given depth in the search tree before any nodes at the next level are expanded

Expand shallowest unexpanded node Implementation: fringe is a FIFO queue, The nodes that are visited first will be expanded first All newly generated successors will be put at the end of the queue Shallow nodes are expanded before deeper nodes

Completeness BFS is complete because if the shallowest goal node is at some finite depth d, BFS will eventually find it after expanding all shallower nodes(provide the branching factor b is finite)

Page 2: Web viewtamil Created Date: 01/29/2015 19:46:00 Last modified by: tamil

Optimal The shallowest goal node is not necessarily optimal BFS will yield optimal solution only when all actions have the same cost, let it be at any depthTime complexity and space complexity The total number of nodes generated isb + b2 + b3 +…. +bd +( bd+1 – b) = O (bd+1)Every node that is generated must remain in memory. The space complexity is same as the time complexity (bd+1)Advantage: Guaranteed to find the single solution at the shallowest depth level.Disadvantage: I) The memory requirements are a bigger problem for breadth-first search than is the execution time.II) Exponential-complexity search problems cannot be solved by uninformed methods for any but only suitable for smallest instances problem (i.e.) (number of levels to be minimum (or) branching factor to be minimum)Uniform cost searchThe root node is expanded first, and then the next node to be expanded is selected as the lowest cost node on the fringe rather than the lowest depth node i.e. g (n) = path cost. Breadth first search is equivalent to Uniform cost search when g(n) = DEPTH(n).Uniform cost search does not care about the number of steps a path has, but only about their total cost,it use priority queue for selecting node with lowest path cost

Uniform cost search finds the cheapest solution provided a simple requirement is met: theCost of a path must never decreases we go along the path. In other words, we insist that

Page 3: Web viewtamil Created Date: 01/29/2015 19:46:00 Last modified by: tamil

g(SlJCCESSOR(n))>g(n)

Completeness:

complete if the cost of each step exceeds some small positive integer, this to prevent infinite loops.

Optimality:

Always optimal -the node that it always expands is the node with the least path cost.

Time Complexity:

Guided by path cost rather than path length Consider C to be the cost of the optimal solution, and every action costs at least e,

then the algorithm worst case is O(bC/e).

Space Complexity:

The space complexity is O(bC/e)

Adv: Guaranteed to find the single solute.ion at minimum path cost.Disadv: Only suitable for smallest instances problem.Depth First Search

Depth-first-search always expands the deepest node in the current fringe of the search tree. The progress of the search is illustrated in figure. The search proceeds immediately to the deepest level of the search tree, where the nodes have no successors. As those nodes are expanded, they are dropped from the fringe, so then the search “backs up” to the next shallowest node that still has unexplored successors. If dead end occurs, backtracking is done to the next immediate previous node for nodes to be expanded.

DFS can be implemented with stack (LIFO) data structure which will explore the latest added node first, suspending exploration of all previous node on the path. This can be done recursive procedure that call itself on each of the children in turn.

Complete

No: fails in infinite-depth spaces, spaces with loops

Modify to avoid repeated states along path

complete in finite spaces

Time O(bm): terrible if m is much larger than d

Page 4: Web viewtamil Created Date: 01/29/2015 19:46:00 Last modified by: tamil

but if solutions are dense, may be much faster than breadth-first

Space O(bm), i.e., linear space!

Optima l As DFS reach to deepest node firt , it may ignore some shallow node which can be a goal node . Therefore optimality is expected only when all states have same path cost

Figure 1.31 Depth-first-search on a binary tree. Nodes that have been expanded and have no descendants in the fringe can be removed from the memory;these are shown in black. Nodes at depth 3 are assumed to have no successors and M is the only goal node.

Page 5: Web viewtamil Created Date: 01/29/2015 19:46:00 Last modified by: tamil

Drawback of Depth-first-search

The drawback of depth-first-search is that it can make a wrong choice and get stuck going down very long(or even infinite) path when a different choice would lead to solution near the root of the search tree. For example ,depth-first-search will explore the entire left sub tree even if node C is a goal node.

BACKTRACKING SEARCH

A variant of depth-first search called backtracking search uses less memory and only one successor is generated at a time rather than all successors.; Only O(m) memory is needed rather than O(bm)

Depth Limited search

The problem of unbounded trees can be alleviated by supplying depth-first search with predetermined depth limit L. i.e., nodes at depth L are treated as if they have no successors. This approach is called depth-limited search. The maximum level of depth depends on the number of states.

The depth limits solves the infinite path problem. Depth limited search will be non optimal if we choose l > d. Its time complexity is O(bl) and its space complexity is O(bl). Depth-first-search can be viewed as a special case of depth-limited search with l = oo

Even if the search could still expand a node beyond that depth, it will not do so and thereby it will not follow infinitely deep paths or get stuck in cycles.

Therefore depth-limited search will find a solution if it is within the depth limit, which guarantees at least completeness on all graphs.

Three possible outcomes:

Solution

Failure (no solution)

Cutoff (no solution within cutoff)

Page 6: Web viewtamil Created Date: 01/29/2015 19:46:00 Last modified by: tamil

Complete: Only if depth limit (d) is finite.

Optimal: It does not guarantee to find the least-cost solution

• If d large enough to include best solution, will find it.

• It is not necessarily to find it.

Time : O(bl)

Space : O(bl)

function Depth-Limited-Search( problem, limit) returns a solution/fail/cutoff

return Recursive-DLS(Make-Node(Initial-State[problem]), problem, limit)

function Recursive-DLS(node, problem, limit) returns solution/fail/cutoff

cutoff-occurred? false

if Goal-Test(problem,State[node]) then return Solution(node)

else if Depth[node] = limit then return cutoff

else for each successor in Expand(node, problem) do

result Recursive-DLS(successor, problem, limit)

if result = cutoff then cutoff_occurred? true

else if result not = failure then return result

if cutoff_occurred? then return cutoff else return failure

Interactive deepening search

• Combine BFS and DFS - the completeness and optimality of BFS and the modest memory requirements of DFS.

• IDS works by looking for the best search depth d, thus starting with depth limit 0 and make a BFS

• If the search failed it increase the depth limit by 1 and try a BFS again with depth 1 and so on – first d = 0, then 1 then 2 and so on – until a depth d is reached where a goal is found.

Page 7: Web viewtamil Created Date: 01/29/2015 19:46:00 Last modified by: tamil

Properties of iterative deepening search

IDS - hybrid search strategy between BFS and DFS inheriting their advantages.

IDS is faster than BFS and DFS.

“IDS is the preferred uniformed search method when there is a large search space and the depth of the solution is not known”.

Page 8: Web viewtamil Created Date: 01/29/2015 19:46:00 Last modified by: tamil

Bidirectional Search

It runs two simultaneous searches: 2 queues

One forward from the initial state, and one backward from the leaf, Stopping when the two meet in the middle.

For problems of where the branching factor is band the solution of depth d, the solution will be found after half steps of depth first.

Both of forward and backward will deal with half of the nodes.

Page 9: Web viewtamil Created Date: 01/29/2015 19:46:00 Last modified by: tamil

The reason for this approach is that each of the two searches has complexity O(bd/2),and O(bd/2+ bd/2)is much less than the running time of one search from the beginning to the goal, which would be O(bd)

Problem: how do we search backwards from goal? Predecessor of node n= all nodes that have n as successor This may not always be easy to compute! If several goal states, apply predecessor function to them just as we applied

successor (only works well if goals are explicitly known; may be difficult if goals only characterized implicitly).

For bidirectional search to work well, there must be an efficient way to check whether a given node belongs to the other search tree.

Select a given search algorithm for each half.

Comparing Uninformed Search Strategies

Figure 1.38 Evaluation of search strategies,b is the branching factor; d is the depth of the shallowest solution; m is the maximum depth of the search tree; l is the depth limit. Superscript caveats are as follows: a complete if b is finite; b complete if step costs >= E for positive E; c

optimal if step costs are all identical; d if both directions use breadth-first search.