Search Algorithms

Properties of Search Algorithms

Completeness

Completeness is whether or not the algorithm is guaranteed to find a goal (provided at least one goal exists).

Optimality

Optimality is whether or not the algorithm is guaranteed to find the shallowest goal (i.e. the goal with the lowest cost).

Time Complexity

Time Complexity refers to the degree of time consumed by the algorithm.

Space Complexity

Space Complexity refers to the degree of memory space consumed by the algorithm.

Search Tree Terminology

Node: a state in the search problem

Edge: an action or a transition between states in the search problem

Branching Factor, b: the maximum number of child nodes extending from a parent node

Shallowest Goal Depth, d: the number of edges to the shallowest goal node

Maximum Depth, m: the number of edges to the further node

Heuristics

Heuristics are solution strategies by trial and error used to produce acceptable (optimal or sub-optimal) solutions to complex problems in a reasonably practical time. Heuristics aim to efficiently generate good solutions, but does not guarantee optimality. Heuristics:

A heuristic function h(n) is one that uses domain knowledge and estimates the goodness of node n. It is the estimated cost of the minimal cost path from node n to a goal node.

Admissible Heuristic

An admissible heuristic function is one that never overestimates the cost of reaching a goal:

h(n)h(n),n

where h(n) is the true cost of the minimal cost path from node n to a goal node.

Breadth-First Search involves searching the tree by expanding nodes into a queue data structure.

Search Path: ABCDEF

Search Tree

PropertyRemarks
CompleteYes, if b is finite
OptimalYes, if path cost is equal to depth
Time ComplexityO(bd+1)
Space ComplexityO(bd+1)

Depth-First Search involves searching the tree by expanding nodes into a stack data structure.

Search Path: ABDECF

Search Tree

PropertyRemarks
CompleteYes, if m is finite
OptimalNo
Time ComplexityO(bm)
Space ComplexityO(bm)

Uniform Cost Search involves searching the tree by expanding nodes into a priority queue data structure based on the cost of the path to each node.

Search Path: ACFBDE

Search Tree With Costs

PropertyRemarks
CompleteYes
OptimalYes
Time ComplexityO(bCϵ+1)
Space ComplexityO(bCϵ+1)

C and ϵ are costs of the goal path and the minimum cost of all the other edges respectively in the worst case scenario.

Depth-Limited Search involves searching the tree using Depth-First Search, but limiting the maximum expanded depth to an upper bound l.

Search Path (l=2): ABC

Search Tree

PropertyRemarks
CompleteYes, if ld
OptimalNo
Time ComplexityO(bl)
Space ComplexityO(bl)

Iterative-Deepening Search involves searching the tree using Depth-Limited Search using incremental values of l.

Search Path (l=1): A

Search Path (l=2): ABC

Search Path (l=3): ABDECF

Search Tree

PropertyRemarks
CompleteYes, if b is finite
OptimalYes, if path cost is equal to depth
Time ComplexityO(bd)
Space ComplexityO(bd)

Greedy Search involves running Best-First Search with an evaluation function f(n)=h(n), where h(n) is the heuristic function.

PropertyRemarks
CompleteNo
OptimalNo
Time ComplexityO(bm)
Space ComplexityO(bm)

Beam Search involves storing and expanding the β best nodes at each depth to a queue data structure. β is the beam width.

PropertyRemarks
CompleteNo
OptimalNo
Time ComplexityO(βm)
Space ComplexityO(βm)

A* Search involves running Best-First Search with an evaluation function f(n)=g(n)+h(n), where g(n) is the cost function.

PropertyRemarks
CompleteYes, if h(n) is admissible
OptimalYes, if h(n) is admissible

Hill-Climbing involves always traversing the node that decreases h(n).

PropertyRemarks
CompleteNo
OptimalNo

Max-Min Strategy

Max-Min Strategy (or the minimax algorithm) is a recursive backtracking algorithm that chooses the maximum or minimum value of the child nodes at any node.

PropertyRemarks
CompleteYes, if tree is finite
OptimalYes, if opponent is optimal opponent
Time ComplexityO(bd)
Space ComplexityO(bd)