Chapter 3
Solving Problems by Searching
Problem-solving agent
Goal formulation
Problem formulation
Search
Search algorithm
Well-defined problems and solutions
A problem is defined by 5 components:
(Successor functions)
Well-defined problems and solutions
(successor functions): refer to any state reachable from given state by a single action
Well-defined problems and solutions
-Sometimes there is an explicit set of possible goal states. (example: in Amman).
-Sometimes the goal is described by the properties
Well-defined problems and solutions
Well-defined problems and solutions
Formulating problems
( Remove detail from representation)
Evaluation Criteria
(The ordering of the nodes in FRINGE defines the search strategy)
Problem-Solving Agents
Example
From our Example
1. Formulate Goal
- Be In Amman��2. Formulate Problem�
- States : Cities � - actions : Drive Between Cities ��3. Find Solution �
- Sequence of Cities : ajlun – Jarash - Amman
Our Example
3. Operator : Go from One City To another .
4. State Space : {Jarash , Salat , irbed,……..}
5. Goal Test : are the agent in Amman.
6. Path Cost Function : Get The Cost From The Map.
7. Solution :{ {Aj 🡪 Ja 🡪 Ir 🡪 Ma 🡪 Za 🡪 Am} , {Aj 🡪Ir 🡪 Ma 🡪 Za 🡪 Am} …. {Aj 🡪 Ja 🡪 Am} }
8. State Set Space : {Ajlun 🡪 Jarash 🡪 Amman}
Example: Romania
Example: Romania
Single-state problem formulation
A problem is defined by four items:�initial state e.g., "at Arad"
Example problems
Toy problems
The 8-puzzle
The 8-puzzle
The 8-queens
The 8-queens
The 8-queens
The 8-queens
Example: River Crossing
3.3 Searching for solutions
3.3 Searching for solutions
Search tree
Fringe : Set of search nodes that have not been expanded yet.
Tree search example
Tree search example
Search tree
Search tree
Search tree
Measuring problem-solving performance
Measuring problem-solving performance
(depth of the least-cost solution)
Measuring problem-solving performance
3.4 Uninformed search strategies
3.4 Uninformed search strategies
Uninformed search strategies
Breadth-first search
Breadth-first search
S
A
D
B
D
A
E
C
E
E
B
B
F
D
F
B
F
C
E
A
C
G
G
C
G
F
14
19
19
17
17
15
15
13
G
25
11
Breadth-First Strategy
New nodes are inserted at the end of FRINGE
2
3
4
5
1
6
7
FRINGE = (1)
Breadth-First Strategy
New nodes are inserted at the end of FRINGE
FRINGE = (2, 3)
2
3
4
5
1
6
7
Breadth-First Strategy
New nodes are inserted at the end of FRINGE
FRINGE = (3, 4, 5)
2
3
4
5
1
6
7
Breadth-First Strategy
New nodes are inserted at the end of FRINGE
FRINGE = (4, 5, 6, 7)
2
3
4
5
1
6
7
Breadth-first search (Analysis)
The disadvantage
Properties of breadth-first search
BFS algorithm
Breadth-first search (Analysis)
Cont…
Uniform cost search
Uniform cost search algorithm
Uniform cost search
Cont…
Uniform-cost search
let�C* be the cost of optimal solution.
ε is possitive constant (every action cost)
Depth-first search
Depth-first search
Depth-first search
Depth-first search
Depth-first search
Depth-first search
Depth-first search
Depth-first search
Depth-first search
Depth-first search
Depth-first search
Depth-first search
Depth-first search
Depth-first search
S
A
D
B
D
A
E
C
E
E
B
B
F
D
F
B
F
C
E
A
C
G
G
C
G
F
14
19
19
17
17
15
15
13
G
25
11
Depth-first search (Analysis)
Properties of depth-first search
Depth-Limited Strategy
Depth-limited search
Depth-limited search
S
A
D
B
D
A
E
C
E
E
B
B
F
D
F
B
F
C
E
A
C
G
G
C
G
F
14
19
19
17
17
15
15
13
G
25
11
depth = 3
3
6
Depth Limited Search Algo
Iterative deepening search
Cont..
Iterative deepening search (Analysis)
Properties of iterative deepening search
Iterative lengthening search
has the advantages of uniform cost search
Bidirectional search
Bidirectional Strategy
2 fringe queues: FRINGE1 and FRINGE2
Time and space complexity = O(bd/2) << O(bd)
Bidirectional search
S
A
D
B
D
A
E
C
E
E
B
B
F
D
F
B
F
C
E
A
C
G
G
C
G
F
14
19
19
17
17
15
15
13
G
25
11
Forward
Backwards
Comparing search strategies
Avoiding repeated states
Avoiding repeated states