













































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Search tree is created by searching through the state space. Search tree can be infinite even if the state space is finite. NB: state space contains cycles ...
Typology: Study notes
1 / 53
This page cannot be seen from the preview
Don't miss anything!














































Introduction to Artificial Intelligence
Prof. Jan SnajderĖ Assoc. Prof. Marko CupiĀ“Ė c Prof. Bojana Dalbelo BaĖsiĀ“c
University of Zagreb Faculty of Electrical Engineering and Computing
Academic Year 2021/
Creative Commons AttributionāNonCommercialāNoDerivs 3.0 v3.
Many analytical problems can be solved by searching through a space of possible states Starting from an initial state, we try to reach a goal state Sequence of actions leading from initial to goal state is the solution to the problem The issues: large number of states and many choices to make in each state Search must be performed in a systematic manner
Let S be a set of states (state space) A search problem consists of initial state, transitions between states, and a goal state (or many goal states)
problem = (s 0 , succ, goal) (^1) s 0 ā S is the initial state (^2) succ : S ā ā(S) is a successor function defining the state transitions (^3) goal : S ā {>, ā„} is a test predicate to check if a state is a goal state
The successor function can be defined either explicitly (as a map from input to output states) or implicitly (using a set of operators that act on a state and transform it into a new state)
How to reach Buzet from Pula? problem = (s 0 , succ, goal) s 0 = Pula succ(Pula) = {Barban, Medulin, Vodnjan} succ(Vodnjan) = {Kanfanar , Pula} .. . goal(Buzet) = > goal(Motovun) = ā„ goal(Pula) = ā„ .. .
initial state:
goal state:
What sequence of actions leads to the goal state? problem = (s 0 , succ, goal) s 0 =
succ( ) =
goal( ) = >
goal( ) = ā„
goal( ) = ā„ .. .
State space search amounts to a search through a directed graph (digraph) graph nodes = states arcs (directed edges) = transitions between states Graph may be defined explicitly or implicitly Graph may contain cycles If we also need the transition costs, we work with a weighted directed graph
Search tree is created by searching through the state space Search tree can be infinite even if the state space is finite NB: state space contains cycles ā search tree is infinite
Node n is a data structure comprising the search tree A node stores a state, as well as some additional data:
n = (s, d) s ā state d ā depth of the node in the search tree
state(n) = s, depth(n) = d
initial(s) = (s, 0)
When expanding a node, we must update all components stored within it:
function expand(n, succ) return { (s, depth(n) + 1) | s ā succ(state(n)) }
The function gets more complex as we store more data in a node (e.g., a pointer to the parent node)
Problem properties: |S| ā number of states b ā search tree branching factor d ā depth of the optimal solution in the search tree m ā maximum depth of the search tree (possibly ā) Algorithm properties: (^1) Completeness ā an algorithm is complete iff it finds a solution whenever the solution exists (^2) Optimality (admissibility) ā an algorithm is optimal iff the solution it finds is optimal (has the smallest cost) (^3) Time complexity (number of generated nodes) (^4) Space complexity (number of stored nodes)
There are two types of strategies: Blind (uninformed) search Heuristic (directed, informed) search
Today we focus on blind search.
(^1) Breadth-first search (BFS) (^2) Uniform cost search (^3) Depth-first search (DFS) (^4) Depth-limited search (^5) Iterative deepening search
We get the BFS strategy if we always insert the generated nodes at the end of the open nodes list
function breadthFirstSearch(s 0 , succ, goal) open ā [ initial(s 0 ) ] while open 6 = [ ] do n ā removeHead(open) if goal(state(n)) then return n for m ā expand(n, succ) do insertBack(m, open) return fail
List open now functions as a queue (FIFO)
(^0) open = [ (Pula, 0) ] (^1) expand(Pula, 0) = {(Vodnjan, 1), (Barban, 1), (Medulin, 1)} open = [ (Vodnjan, 1), (Barban, 1), (Medulin, 1) ] (^2) expand(Vodnjan, 1) = {(Kanfanar , 2), (Pula, 2)} open = [ (Barban, 1), (Medulin, 1), (Kanfanar , 2), (Pula, 2) ] (^3) expand(Barban, 1) = {(Labin, 2), (Pula, 2)} open = [ (Medulin, 1), (Kanfanar , 2), (Pula, 2), (Labin, 2), (Pula, 2) ] (^4) expand(Medulin, 1) = {(Pula, 2)} open = [ (Kanfanar , 2), (Pula, 2), (Labin, 2), (Pula, 2), (Pula, 2) ] (^5) expand(Kanfanar , 2) = {(Baderna, 3), (Rovinj , 3), (Vodnjan, 3)(Zminj , 3)} open = [ (Pula, 2), (Labin, 2), (Pula, 2), (Pula, 2), (Baderna, 3),... .. .