Problem Solving by Searhing
Problem Solving by Searhing
Solving by
Searching
1
2
Disclaimer Statement
In preparation of these slides, materials have been taken from
different online sources in the shape of books, websites,
research papers and presentations etc. However, the author
does not have any intention to take any benefit of these in
her/his own name. This lecture (audio, video, slides etc) is
prepared and delivered only for educational purposes and is
not intended to infringe upon the copyrighted material.
Sources have been acknowledged where applicable. The
views expressed are presenter’s alone and do not necessarily
represent actual author(s) or the institution.
SEARCH
Search involves trying to find a particular object
from a large number of such objects.
A search space defines the set of objects that we are
interested in searching among.
A few Examples:
6
OPERATIONS
• The problem solving system moves from
one state to another according to well
defined operations.
• Typically these operations are described as rules
.
• A control system decides which rules are
applicable at any state, and resolves conflicts
and/ or ambiguities.
7
EXAMPLE: WATER JUG PROBLEM
4 Gal 3 Gal
11
Start State WATER JUG STATE SPACE
4,0 0,3
13
SEARCH TREES
• The search for a solution can be described by
a tree - each node represents one state.
• The path from a parent node to a child node
represents an operation.
• Search Trees provide a convenient
description of the search space, they are not
a data structure stored in memory!!!
14
GRAPH THEORY
A graph consists of :-
• A set of nodes N1, N2, N3, … , Nn…
• A set of arcs that connects pair of nodes.
• Arcs are ordered pairs of nodes, i.e. the arc (N3, N4)
connects node N3 to node N4. This means a directed
connection from N3 to N4.
• If a directed arc connects node Nj to node Nk,
– Then Nj is called parent of Nk
– And Nk is called child of Nj.
• If the graph also contains an arc (Nj, Nl) then Nk and
Nl are called siblings.
15
GRAPH THEORY
A graph consists of :-
• A rooted graph has a unique node Ns. All paths in the
graph originates from this node. That means Ns has
no parents.
• A tip of a leaf node has no children.
• A path that contains any node more than once, is said
to contain a cycle or loop.
• A tree is a graph in which there is a unique path
between each pair of nodes. The paths in a tree
therefore contains no cycles or loops.
16
GRAPH THEORY
• A graph consists of a set of nodes and a set of arcs or
links connecting pairs of nodes.
17
GRAPH THEORY
• The arcs of graph represent transitions between states
or the act of applying a rule, such as:-
– Logical inferences.
18
GRAPH THEORY
20
A rooted tree, exemplifying family relationships.
STATE SPACE SEARCH
21
STATE SPACE SEARCH
• The theory of state space search is our
primary tool for successful design and
implementation of search algorithms.
23
STATE SPACE
• We studied predicate calculus as an example of an
artificial intelligence representational language.
24
Slide II.7
Figure II.5: Portion of the state space for tic-tac-toe.
25
A R T I F I C I A L I N T E L L I G E N C E: Structure and Strategies for Complex ProblemSolving, 4th Edition George F. Luger © 2002 Addison Wesley
DESCRIPTION OF STATE SPACE
TIC- TAC-TOE
•There are 39 (19683) ways to arrange (Blank, X, O) in nine
spaces.
•State space is a graph.
•The graph is a “directed acyclic graph”.
•Complexity of Problem (No of possible move paths)
•Nine possible first moves.
•Eight possible responses to each first move at 2nd
level.
•Seven possible responses to each 2nd level move at
3rd level. And so on …
•So 9 x 8 x 7 …, or 9! = 362,880 possible games paths
can be generated. 26
DESCRIPTION OF STATE SPACE
TIC- TAC-TOE
•Tic-Tac-Toe has 9! possible games paths.
•Chess has 10120 possible game paths.
•Checker has 1040 possible game paths.
•Problem spaces with these large number of possible
paths, are difficult or impossible to search
exhaustively.
•Strategies must be defined to reduce the complexity
of the problem.
•These strategies, however, rely on heuristics to
reduce the complexity of the search.
27
State space of the 8-puzzle generated by “move blank” operations.
28
EXAMPLE OF 8- PUZZLE.
4 possible moves for Blank , , ,
31
Search of the traveling salesperson problem. Each arc is marked with the
total weight of all paths from the start node (A) to its endpoint.
32
THE TRAVELING SALESPERSON
Complexity
Goal Data
34
STRATEGIES FOR STATE SPACE SEARCH
Data Driven Search (Also Called Forward Chaining)
The problem solver begins with given facts of the problem and
a set of legal moves or rules for changing states.
37
STRATEGIES FOR STATE SPACE SEARCH
• Data-driven search will by preferred for
problems in which:-
– All are most of the data are given in the initial problem
statement.
– There are a large number of potential goals, but there
are only a few ways to use the facts and given
information of a particular problem instance.
– It is difficult to form a goal or hypothesis.
38
STRATEGIES FOR STATE SPACE SEARCH
• Goal-driven search will be preferred for
problems in which:-
– A goal or hypothesis is given in the initial problem
statement or can easily be formulated.
– There are a large number of rules that match the facts
of the problem and thus produce an increasing
number of conclusions or goals. Early selection of a
goal can eliminate most of these branches, making
goal driven search more effective.
– Problem data are not given but must be acquired by
the problem solver. In this case goal driven search
can help guide data acquisition.
39
State space in which goal-directed search effectively prunes extraneous
search paths.
40
State space in which data-directed search prunes irrelevant data and
their consequents and determines one of a number of possible goals.
41