AI Lecture 10
AI Lecture 10
Lecture 10
Problem Solving as Search
& State Space Search
Start
Search: Basic idea
o We will move to one of the five states
o I do not if any of them is the goal or not until now
o Also, I do not know from an state of them where we can go
outcomes; Action
▪ The root node corresponds to the starting state. Successor
▪ The children of a node correspond to the State
successor states of that node’s state.
▪ A path through the tree corresponds to a
sequence of actions.
▪ A solution is a path ending in the goal state …
Frontier
Goal
State
Search Tree (theWhat-if tree) Starting
State
Nodes vs. States ..? A state is a representation of the
Action
world, while a node is a data structure that is part of the
search tree. Node must keep pointer to parent, path Successor
State
cost, possibly other info.
frontier.
Stopping criteria will be based on two options:
First is to reach the goal
Second is when the frontier or fringe is empty.
Tree Search Example
Start: Arad
Goal: Bucharest
Tree Search Example
Start: Arad
Goal: Bucharest
Tree Search Example
Start: Arad
Goal: Bucharest
Tree Search Example
One problem here exists is that we started from Arad and we reach
Arad once again.
This is called cycle or a loop and here in this problem it is direct and it
appeared after two steps only. You can have a problem the cycle are
large and appear after 6 or 7 steps or even more than that.
For Example in the 8 puzzle you can move the blank up or down more
than one time till you reach the same beginning you started with after 9
or 10 moves
This is big problem you moved to Arad and then you can move from
Arad to Sibie again and then to Arad and this cycle will not stop. The
tree is not finite tree. You should detect that there exist cycles
especially in the problems that contain cycles so that you can break
these cycles.
We must find a way to handle the cycles found or the repeated states.
Handling Repeated States
To handle repeated states:
1. Every time you expand a node, add that state to the
explored set; do not put explored states on the frontier
again.
2. Every time you add a node to the frontier, check
whether it already exists with a higher path cost, and if
yes, replace that node with the new one.
Backtracking Search
“Backtracking is a technique for systematically trying all
paths through a state space”
Backtracking is a technique that is based on trying all the paths in the
state space. Therefore backtracking search is considered as blind
search or uninformed search algorithms.
It begins at the start state and moves in a path till reaching or finding
a goal then quit and brings back the solution path. If he find a dead
end then it back track to the most recent unexamined node and
continue down one of its branches.
Backtracking algorithm is known as the depth first search. Both move
on the tree in the same way. The difference is in the data structure
used in to build the algorithm. Each one is implemented in a way
different from the other in the data structure.
Backtracking Search
Start
Node