Professional Documents
Culture Documents
AI Lecture 5
AI Lecture 5
AI Lecture 5
Artificial Intelligence
Contents
5.1 Problem Solving by Search 5.2 Search Strategies 5.3 Blind Search 5.4 8-Puzzle Game
Search:
Search is a method that can be used by computers to examine a problem in order to find a goal. At any given time we consider the state of the search to represent where we have reached as a result of the actions we have applied so far. A problem can be considered to be a search because in order to solve the problem, we will search for a goal state.
Approaches:
Top-Down Search:
Starts from an initial state and uses actions to move forward until a goal is reached. This is known as forward chaining search.
Bottom-Up Search:
Search starts at the goal and work back toward a start state by seeing what moves could have led to the goal state known as backward chaining search.
A. Blind/uninformed search
The uninformed or blind search is
The search methodology having no additional information about search states beyond that provided in the problem definitions. In this search total search space is looked for solution
Having no information about the number of steps from the current state to the goal. Zero information search
B. Informed/Heuristic Search
More efficient than uninformed search Heuristic: involving or serving as an aid to learning, discovery, or
problem-solving by experimental and especially trial-anderror methods. (Merriam-Websters dictionary)
B. Informed/Heuristic Search
Best-First Search an algorithm in which a node is selected for expansion based on an evaluation function f(n)
Traditionally the node with the lowest evaluation function is selected Not an accurate nameexpanding the best node first would be a straight march to the goal. Choose the node that appears to be the best A* (A star) is the most widely known form of Best-First search
You might think that informed search is the best solution to the problem But its not true Mouse found the cheese but not from the best optimal path.
B. Informed/Heuristic Search
Any path/Non optimal search
In this search we are concerned with finding any solution As we find the solution we stop the search There could have been a better path which might take lesser time
Depth-first search
Expand one of the nodes
at the deepest level.
B D E F
C G
H L M N O
I P
K Q
Tree Search A tree search starts at the root and explores nodes from there, looking for a goal node For some problems, any goal node is acceptable (N or J); for other problems, you want a minimum-depth goal node, that is, a goal node nearest the root (only J)
Goal nodes
Depth-first searching
A
B D E F
C G
H L M N O
I P
K Q
A depth-first search (DFS) explores a path all the way to a leaf before backtracking and exploring another path For example, after searching A, then B, then D, the search backtracks and tries another path from B Node are explored in the order A B D E H L M N I OPCFGJKQ N will be found before J
4 6
8 SG
Breadth-First Search
1
10
11
12
SG
1
SG
Breadth-first searching
A
B D E F
C G
H L M N O
I P
K Q
A breadth-first search (BFS) explores nodes nearest the root before exploring nodes further away For example, after searching A, then B, then C, the search proceeds with D, E, F, G Node are explored in the order A B C D E F G
HIJKLMNOPQ J will be found before N
How can we combine the advantages (and avoid the disadvantages) of these two search techniques?
Depth-limited searching
Depth-first searches may be performed with a depth limit:
limit = 0; found = false; while (not found) { found = limitedDFS(root, limit, 0); limit = limit + 1; }
This searches to depth 0 (root only), then if that fails it searches to depth 1, then depth 2, etc. If a goal node is found, it is a nearest node and the path to it is on the stack
24
25
26
27
28