03.2 Breadth-First Search//Uniform-Cost Search Flashcards

1
Q

function Breadth-First-Search (problem) returns a solution or failure
node ← Node(…)
if problem.Is-Goal(node.State) then return Solution(node)

frontier ← a … as the only element
reached ← …

A

State=problem.Initial-State, Path-Cost=0

FIFO queue with node

{node.State}

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

loop do
if Is-Empty(frontier) then …
node ← Pop(frontier) // chooses a shallowest node in frontier for each child in Expand(problem, node) do
s ← child.State
if problem.Is-Goal(s) then return Solution(child)
if s is not in reached then

frontier ← Add(child,frontier)

A

return failure

add s to reached

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

Auxiliary Algorithm: Expand

function Expand (problem, node) yields nodes
s ← …
for each action in problem.Actions(s) do
s′ ← …
cost ← …
yield Node(…)

A

node.State

problem.Result(s, action)

node.Path-Cost + problem.Action-Cost(s, action, s′)

State=s′, Parent=node, Action=action, Path-Cost=cost

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

Performance of BFS

  • the branching factor b (maximum number of successors of any node)
  • the depth d (depth of the shallowest goal node, where root is at depth 0),
    -the maximum length m of any path in the state space

Assess it on the performance metrics.

A

Completeness: Yes, if depth d and branching factor b are finite.

Optimality: Yes, if cost is equal per step; not optimal in general.

Time complexity: The worst case is that each node has b successors. The number of explored nodes sums up to
b+b2+b3+···+bd =O(bd)

Space complexity: All explored nodes are O(bd−1) and all nodes in the frontier are O(bd )

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

When all step costs are equal, breadth-first is optimal because it …

Uniform-cost search is optimal for any step costs, as …
This is realized by …ordered by g.

A

always expands the shallowest nodes.

it expands the node with the lowest path cost g(n) = n.Path-Cost.

storing the frontier as a priority queue

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