Searching for Solutions
The Concept of State Space
State-space searching assumes:
The Concept of State Space
Searching for solution
- The initial state at the root
- The branches are the actions and the nodes correspond to states in the state space of the problem.
Searching for solution. Example
In(Arad).
- we do this by expanding the current state
- Applying each legal action to the current state, thereby
generating a new set of states (Transition model)
We add three branches from the parent node In(Arad)
leading to three new child nodes:
- In(Sibiu)
- In(Timisoara)
- In(Zerind)
Now we must choose which of these three possibilities
to consider further.
Searching for solution. Example
and then expand it to get In(Arad), In(Fagaras),
In(Oradea), and In(RimnicuVilcea)
or go back and choose Timisoara or Zerind
any given point is called the frontier.
- tree consists of those nodes with bold outlines.
either a solution is found or there are no more states to expand.
Search Algorithms
Search Algorithms
Search Algorithms
Search Algorithms
The algorithm has another nice property:
Infrastructure for search algorithms
Data structures to keep track of the search tree
Data structures to keep track of the search tree
Nodes Vs States:
- A node is a bookkeeping data structure used to represent the search tree.
- A state corresponds to a configuration of the world.
The queue data structure
The operations on a queue data structure are as follows:
- EMPTY?(queue) returns true only if there are no more elements in the queue.
- POP(queue) removes the first element of the queue and returns it.
- INSERT(element, queue) inserts an element and returns the resulting queue.
- Queues are characterized by the order in which they store the inserted nodes
- Three common variants are:
- The first-in, first-out or FIFO queue, which pops the oldest of the queue.
- The last-in, first-out or LIFO queue (also known as stack), which pops newest element.
- The priority queue which pops the element of the queue with the highest priority according to some ordering function.
Measuring problem-solving performance
- We can evaluate an algorithms performance in four ways:
- Completeness: is the algorithm guaranteed to find a solution when there is one?
- Optimality: Does the strategy find the optimal solution?
- Time complexity: How long does it take to find a solution?
- Space complexity: How much memory is needed to perform the search?
- For S&T complexity, the typical measure is size of the state space graph, |V|+|E|.
- where V is the set of vertices(nodes) of the graph and E is the set of edges (links).
Measuring problem-solving performance