02 Searching Flashcards

1
Q

Searching

A

The search starts in an initial state. Then it iteratively explores the state space by selecting a state node and applying operators to generate successor nodes until it finds the goal state node or has to give up.

The choice of which node to expand at each level is determined by the search strategy

The part of the state space (defined by inital state and actions) that is explored is called the search tree

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Formulation of a search problem

A

Initial state
Initial state of environment

Actions
Set of actions available to agent

Path
Sequence of actions leading from one state to another

Goal state
Test to check if a state is a goal state

Path cost
Function that assigns cost to a path

Solution
Path from initial state to a state that satisfies goal test

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Problem-solving agents

A

Problem-solving agents are goal-based agents that use search to find action sequences

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Tree search vs. graph search

A

The state space may contain loops (path back to earlier state) or redundant paths (more than one path between two states). Simple tree expansion will run infinitely or “explode” in such search spaces.

To avoid the problem, tree search can be replaced by generalized graph search. In graph search, the algorithm keeps track and avoids expanding already visited nodes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Uninformed search strategies

A

Uninformed search has no information on path cost from current to goal states.

Breadth-firsth
Uniform-cost
Depth-first
Depth-limited
Iterative deepening
Bidirectional

The strategies differ by order in which nodes are expanded

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Evaluation of search strategies

A

Completeness
Does the strategi always find a solution when there is one?

Optimality
Does it always find the best solution?

Time complexity
How long does it take to find a solution?

Space complexity
How much memory is needed?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Search tree data structures

A

Datatype node with components
– STATE - search space state corresponding to the node
– PARENT-NODE - node that generated this node
– ACTION - action that was applied to generate this node
– PATH-COST - cost of path from initial node (called g)
– DEPTH - number of nodes on path from initial node

Search tree nodes kept in a queue with operators
– MAKE-QUEUE(Elements) - create queue with given elements
– EMPTY?(Queue) - true if no more elements in queue
– FIRST(Queue) - returns first element of the queue
– REMOVE-FIRST(Queue) - removes and returns first element
– INSERT(Element, Queue) - inserts an element into queue
– INSERT-ALL(Elements, Queue) - inserts set of elements into queue

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

General tree-search algorithm

A
  • frontier is an initially empty queue of a certain type (FIFO, etc.)
  • SOLUTION returns sequence of actions back to root
  • EXPAND generates all successors of a node
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Breadth-first search

A

FIFO - First In First Out (add nodes as last)
• Expands all nodes at a certain depth of search tree before expanding any node at next depth
• Exhaustive method - if there is a solution, breadth-first will find it (completeness)
• Will find the shortest solution first (optimal)
• All nodes on one level are explored before moving to next level
• Complexity: O(b^d) (exponential)
– b = branching factor
– d = depth(rootnode, d=0)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Uniform-cost search

A

The search begins at the root node. The search continues by visiting the next node which has the least total cost from the root. Nodes are visited in this manner until a goal state is reached.

Uniform-cost search is optimal since it always expands the node with the lowest cost so far. Completeness is guaranteed if all path costs > 0.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Depth-first search

A

Start at the root (selecting some arbitrary node as the root in the case of a graph) and explores as far as possible along each branch before backtracking.

LIFO-Last In First Out (add nodes as first). Always expands a node at deepest level of the tree, backtracks if it finds node with no successor. May never terminate if it goes down an infinite branch, even if there is a solution (not complete). May return an early found solution even if a better one exists (not optimal).

Worst case time complexity is O(b^m) for branching factor b and depth m. But depth-first may find solution much quicker if there are many solutions (m may be much larger than d - the depth of the shallowest solution).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Depth-limited search

A

Modifies depth-first search by imposing a cutoff on the maximum depth of a path. Avoids risk of non-terminating search down an infinite path. Finds a solution if it exists within cutoff limit (not generally complete). Not guaranteed to find shortest solution (not optimal). Time and space complexity as for depth-first

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Iterative deepening search

A

Modifies depth-limited search by iteratively trying all possible depths as the cutoff limit. Combines benefits of depth-first and breadth-first. Time complexity is O(b^d), space complexity O(bd). Iterative deepening is the preferred (uninformed) search strategy when there is a large search space and the solution depth is unknown.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Bidirectional search

A

Searches simultaneously both forward from initial state and backward from goal state. Time complexity reduced from O(b^d) to O(b^{d/2}).

But. . . Does the node predecessor function exist? What if there are many possible goals? Must check a new node if it exists in other tree. Must keep at least one tree, space complexity O(b^{d/2}).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Evalution of uninformed search strategies (table)

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Informed search

A

Search can be improved by applying knowledge to better select which node to expand (best-first).

An function to estimate the cost to reach a solution is called a search heuristic (h).

17
Q

Greedy search

A

Greedy search minimizes h(n) - the estimated cost of the cheapest path from n to the goal. Greedy search reduces search time compared to uninformed search, but is neither optimal nor complete.

18
Q

A* search

A

A* uses a best-first search and finds a least-cost path from a given initial node to one goal node (out of one or more possible goals). As A* traverses the graph, it follows a path of the lowest expected total cost or distance, keeping a sorted priority queue of alternate path segments along the way.

It uses a knowledge-plus-heuristic cost function of node n (usually denoted f(n)) to determine the order in which the search visits nodes in the tree. The cost function is a sum of two functions:

1) The past path-cost function, which is the known distance from the starting node to the current node n (usually denoted g(n))
2) A future path-cost function, which is an admissible “heuristic estimate” of the distance from n to the goal (usually denoted h(n)).

f(n) = g(n) + h(n)

The h(x) part of the f(x) function must be an admissible heuristic; that is, it must not overestimate the distance to the goal. Thus, for an application like routing, h(x) might represent the straight-line distance to the goal, since that is physically the smallest possible distance between any two points or nodes.

A* is the most widely known informed search method. Identical to Uniform-Cost except that it minimizes f(n) instead of g(n).

A* is optimal (and optimally efficient) and complete. Both time and space complexities are exponential (space is the most severe problem).

Effective branching factor b* using A* depends on chosen heuristic function h.