Search Flashcards
Describe a simple search agent.
Deterministic, goal-driven agent.
What is a solution to a problem given a set of start nodes and goal nodes?
A path from a start node to a goal node.
What is the forward branching factor of a node?
It is the number of arcs going out of the node.
What is the backward branching factor of a node?
It is the number of arcs going into the node
Describe generic search algorithm.
- Given a graph, start nodes, and goal nodes, incrementally explore paths from start node.
- Maintain a frontier of paths from the start node that have been explored.
- As search proceeds, the forntier expands the unexplored nodes until a goal node is encountered.
What does it mean for a search algorithm to be complete?
A search algorithm is complete of whenever there is at least one solution, the algorithm is guaranteed to find it within a finite amount of time.
What does it mean for a search algorithm to be optimal?
A search algorithm is optimal if when it finds a solution, it is the best one.
What is the time complexity of a search algorithm?
The time complexity of a search algorithm is the worst-case amount of time it will take to run, expressed in terms of:
- maximum path length m
- maximum branching factor b
What is the time complexity of a search algorithm?
The space complexity of a search algorithm is the worst-case amount of memory that the algorithm will use, expressed in terms of:
- maximum path length m
- maximum branching factor b
What does define the search strategy?
The way in which the frontier is expanded defines the search strategy.
What is frontier?
Frontier is the set of paths which could be xplored next.
Define depth-first search.
Depth-first search is a search algorithm that explores each path on the frontier until its end (or until a goal is found) before considering any other path.
What is the frontier in DFS?
In DFS, the frontier is a last-in-first-out stack.
Is DFS complete?
No, it may stuck in infinite loops.
Is DFS optimal?
No, it can “stumble” on longer solution paths before it gets to shorter ones.
What is the time complexity of DFS?
DFS time complexity is O(b^m). Must examine every node in the tree
What is the space complexity of DFS?
DFS space complexity is O(bm). The longest possible path is m, and for every node in that path must maintain a fringe of size b.
When DFS is complete?
DFS is complete for finite acyclic graphs
When is using DFS appropriate?
DFS is appropriate when:
- Space restricted
- Many solutions, with long path length
When is using DFS unappropriate?
DFS is a poor method when:
- There are cycles in the graph
- There are sparse solution at shallow depth
Define breadth-first search.
Breadth-first search is a search algorithm that explores all paths of legth l on the frontier, before looking at path of length l+1
What is the frontier in BFS?
In BFS, the forntier is a first-in-first-out queue.
Is BFS complete?
BFS is complete. If a solution exists at level l, the path to it will be explored before any other path of length l+1.
Is BFS optimal?
Yes. Any goal at level l will be reached before goals at lower levels.
What is the time complexity of BFS?
Time complexity of BFS is O(b^m). Like DFS, in the worst case BFS must examine every node on the tree.
What is the space complexity of BFS/
Space complexity of BFS is O(b^m). <ist keep paths to all the nodes at level m.
When is using BFS is appropriate?
Using BFS is appropriate when:
- The search graph has cycles or is infinite
- We need the shortest path to a solution
- there are some solutions at shallow depth and others deeper
When is using BFS is unappropriate?
BFS is a poor method when:
- There are only solutions at grat depth
- No way the search graph will fir into the memory
How are search strategies different?
Search strategies are different with respect to how they add/remove paths from the frontier.
Define Iterative Deepening DFS.
Iterative deepening DFS is a search strategy that uses DFS to look for solution at depth 1, then 2, then 3, etc.
What is the time complexity of Iterative Deepening DFS?
Time complexity of the iterative deepening DFS is O(b^m), but it has an overhead factor (b/(b-1)).
What is the cost of a path?
The cost of a path is the sum of the costs of its arcs.
Define the Lowest-cost-first search and explain how it works.
Lowest-cost-first search is a search strategy that finds the path with the lowest cost. At each stage, it selects the path with the lowest cost on the frontier.