# SESSION 2

Artificial Intelligence

Dr. Sherin Youssef

One of the search strategies that comes under the heading of uninformed search. Breadth-first search is a simple strategy in which the root node is expanded first, then all the successors of the root node are expanded next, and so on. Expand shallowest unexpanded node. Implemented by a first-in-first-out queue.

Breadth-first search on a binary tree

.

.

.

each of which generates b more nodes. The root of the search tree generates b nodes at the first level. Keeps every node in memory. The shallowest goal node is not necessarily the optimal one. and the branching factor b is finite. so space is the big problem. . it is optimal if the path cost is a nondecreasing function of the node depth .Evaluating Breadth-first search The search is complete if the shallowest goal node is at some finite depth d. technically. for a total of b² at the second level. And so on.

Depth-first search One of the search strategies that comes under the heading of uninformed search. Implemented by a last-in-first-out queue. Expand deepest unexpanded node. .

Depth-first search on a binary tree .

.

.

.

.

.

.

.

.

.

.

along with remaining unexpanded nodes. . Complete in finite depths. the search needs to store only a single path from the root to a leaf node. Less memory is needed. A node can be removed from memory if all its descendents have been explored. which is not optimal. Not optimal. then depth-first search will return J as a solution. Less time is needed.Evaluating Depth-first search Incomplete in infinite depths (get stuck going down a very long path when a different choice would lead to a solution near the root). For example. if C and J are goal nodes in the previous figures.

. Expand the node that appears to be closest to goal.Greedy search One of the search strategies that comes under the heading of informed search.

Example .

.

.

.

.

Evaluating Greedy search Incomplete. . Not optimal. can get stuck in loops. Complete in finite space with repeated-state checking. Keeps all nodes in memory.

. The paths followed by the search are not retained. in which the aim is to find the best state according to an objective function.Local search Local search algorithms operate using a single current state (rather than multiple path) and generally move only to neighbors of that state. Local search are useful for solving pure optimization problems.

A complete local search algorithm always finds a goal.Evaluating Local search Although local search algorithms are not systematic. . Local search can often find reasonable solutions in large or infinite state spaces for which systematic algorithms are unsuitable. an optimal algorithm always finds a global minimum/maximum. they have two key advantages: Local search uses very little memory usually a constant amount. if one exists.