Artificial Intelligence 15-381 Heuristic Search Methods Jaime Carbonell [email protected] 30 August...

21
381 Heuristic Search Methods Jaime Carbonell [email protected] 30 August 2001 Today's Agenda Search Complexity Analysis Heuristics and evaluation functions Heuristic search methods Admissibility and A* search B* search (time permitting) Macrooperators in search (time permitting)

Transcript of Artificial Intelligence 15-381 Heuristic Search Methods Jaime Carbonell [email protected] 30 August...

Page 1: Artificial Intelligence 15-381 Heuristic Search Methods Jaime Carbonell jgc@cs.cmu.edu 30 August 2001 Today's Agenda Search Complexity Analysis Heuristics.

Artificial Intelligence 15-381Heuristic Search Methods

Jaime [email protected] August 2001

Today's AgendaSearch Complexity Analysis

Heuristics and evaluation functions

Heuristic search methods

Admissibility and A* search

B* search (time permitting)

Macrooperators in search (time permitting)

Page 2: Artificial Intelligence 15-381 Heuristic Search Methods Jaime Carbonell jgc@cs.cmu.edu 30 August 2001 Today's Agenda Search Complexity Analysis Heuristics.

Complexity of Search

Definitions Let depth d = length(min(s-Path(S0, SG)))-1

Let branching-factor b = Ave(|Succ(Si)|)

Let backward branching B = Ave(|Succ-1(Si)|); usually b=bb, but not always

Let C(<method>,b,d) = max number of Si visited

C(<method>,b,d) = worst-case time complexity

C(<method>,b,d) >= worst-case space complexity

Page 3: Artificial Intelligence 15-381 Heuristic Search Methods Jaime Carbonell jgc@cs.cmu.edu 30 August 2001 Today's Agenda Search Complexity Analysis Heuristics.

Complexity of Search

Breadth-First Search Complexity C(BFS,b,d) = i=0,dbi = O(bd)

C(BBFS,b,d) = i=0,dBi = O(Bd)

C(BiBFS,b,d) = 2i=0,d/2bi = O(bd/2), if b=B Suppose we have k evenly-spaced islands in

s=Path(S0, SG), then:

C(IBFS,b,d) = (k+1) i=0,d/(k+1)bi = O(bd/(k+1))

C(BiIBFS,b,d) = 2 (k+1) i=0,d/(2k+2)bi = O(bd/(2k+2))

Page 4: Artificial Intelligence 15-381 Heuristic Search Methods Jaime Carbonell jgc@cs.cmu.edu 30 August 2001 Today's Agenda Search Complexity Analysis Heuristics.

Heuristics in AI Search

Definition

A Heuristic is an operationally-effective nugget of information on how to direct search in a problem space. Heuristics are only approximately correct.

Page 5: Artificial Intelligence 15-381 Heuristic Search Methods Jaime Carbonell jgc@cs.cmu.edu 30 August 2001 Today's Agenda Search Complexity Analysis Heuristics.

Common Types of Heuristics

"If-then" rules for state-transition selection Macro-operator formation [discussed later] Problem decomposition [e.g. hypothesizing

islands on the search path] Estimation of distance between Scurr and SG. (e.g.

Manhattan, Euclidian, topological distance) Value function on each Succ(Scurr)

cost(path(S0, Scurr)) + E[cost(path(Scurr,SG))] Utility: value(S) – cost(S)

Page 6: Artificial Intelligence 15-381 Heuristic Search Methods Jaime Carbonell jgc@cs.cmu.edu 30 August 2001 Today's Agenda Search Complexity Analysis Heuristics.

Heuristic Search

Value function: E(o-Path(S0, Scurr), Scurr, SG)

Since S0 and SG are constant, we abbreviate E(Scurr)

General Form:1. Quit if done (with success or failure), else:

2. s-Queue:= F(Succ(Scurr),s-Queue)

3. Snext:= Argmax[E(s-Queue)]

4. Go to 1, with Scurr:= Snext

Page 7: Artificial Intelligence 15-381 Heuristic Search Methods Jaime Carbonell jgc@cs.cmu.edu 30 August 2001 Today's Agenda Search Complexity Analysis Heuristics.

Heuristic Search

Steepest-Ascent Hill-Climbing F(Succ(Scurr), s-Queue) = Succ(Scurr) No history stored in s-Queue, hence: Space

complexity = max(b) [=O(1) if b is bounded] Quintessential greedy search

Max-Gradient Search "Informed" depth-first search Snext:= Argmax[E(Succ(Scurr))] But if Succ(Snext) is null, then backtrack Alternative: backtrack if E(Snext)<E(Scurr)

Page 8: Artificial Intelligence 15-381 Heuristic Search Methods Jaime Carbonell jgc@cs.cmu.edu 30 August 2001 Today's Agenda Search Complexity Analysis Heuristics.

Beyond Greedy Search

Best-First SearchBestFS(Scurr, SG, s-Queue)

IF Scurr = SG, return SUCCESS

For si in Succ(Scurr)

Insertion-sort(<Si, E(Si)>, s-Queue)

IF s-Queue = Null, return FAILURE

ELSE return

BestFS(FIRST(s-Queue), SG, TAIL(s-Queue))

Page 9: Artificial Intelligence 15-381 Heuristic Search Methods Jaime Carbonell jgc@cs.cmu.edu 30 August 2001 Today's Agenda Search Complexity Analysis Heuristics.

Beyond Greedy Search

Best-First Search (cont.)

F(Succ(Scurr)), s-Queue) = Sort(Append(Succ(Scurr), Tail(s-Queue)),E(si))

Full-breadth search "Ragged"fringe expansion Does BestFS guarantee optimality?

Page 10: Artificial Intelligence 15-381 Heuristic Search Methods Jaime Carbonell jgc@cs.cmu.edu 30 August 2001 Today's Agenda Search Complexity Analysis Heuristics.

Beyond Greedy Search

Beam Search

Best-few BFS Beam-width parameter Uniform fringe expansion Does Beam Search guarantee optimality?

Page 11: Artificial Intelligence 15-381 Heuristic Search Methods Jaime Carbonell jgc@cs.cmu.edu 30 August 2001 Today's Agenda Search Complexity Analysis Heuristics.

A* Search

Cost Function Definitions

Let g(Scurr) = actual cost to reach Scurr from S0

Let h(Scurr)= estimated cost from Scurr to SG

Let f(Scurr)= g(Scurr) + h(Scurr)

Page 12: Artificial Intelligence 15-381 Heuristic Search Methods Jaime Carbonell jgc@cs.cmu.edu 30 August 2001 Today's Agenda Search Complexity Analysis Heuristics.

A* Search Definitions

Optimality DefinitionA solution is optimal if it conforms to the minimal-cost path between S0 and SG. If operators cost is uniform, then the optimal solution = shortest path.

Admissibility DefinitionA heuristic is admissible with respect to a search method if it guarantees finding the optimal solution first, even when its value is only an estimate.

Page 13: Artificial Intelligence 15-381 Heuristic Search Methods Jaime Carbonell jgc@cs.cmu.edu 30 August 2001 Today's Agenda Search Complexity Analysis Heuristics.

A* Search Preliminaries

Admissible Heuristics for BestFS "Always expand the node with min(g(Scurr)) first."

If Solution found, expand any Si in s-Queue where g(Si) < g(SG)

Find solution any which way. Then Best FS(Si) for all intermediate Si in solution as follows:

1. If g(S(1curr) >= g(SG) in previous, quit

2. Else if g(S(1G < g(SG), Sol:=Sol1, & redo (1).

Page 14: Artificial Intelligence 15-381 Heuristic Search Methods Jaime Carbonell jgc@cs.cmu.edu 30 August 2001 Today's Agenda Search Complexity Analysis Heuristics.

A*: Better Admissible Heuristics

Observations on admissible heuristics Admissible heuristics based only on look-back

(e.g. on g(S)) can lead to massive inefficiency! Can we do better? Can we look forward (e.g. beyond g(Scurr)) too? Yes, we can!

Page 15: Artificial Intelligence 15-381 Heuristic Search Methods Jaime Carbonell jgc@cs.cmu.edu 30 August 2001 Today's Agenda Search Complexity Analysis Heuristics.

A*: Better Admissible Heuristics

The A* CriterionIf h(Scurr) always equals or underestimates the true remaining cost, then f(Scurr) is admissible with respect to Best-First Search.

A* SearchA* Search = BestFS with admissible f = g + h under the admissibility constraints above.

Page 16: Artificial Intelligence 15-381 Heuristic Search Methods Jaime Carbonell jgc@cs.cmu.edu 30 August 2001 Today's Agenda Search Complexity Analysis Heuristics.

A* Optimality Proof

Goal and Path Proofs Let SG be optimal goal state, and s-path (S0, SG)

be the optimal solution. Consider an A* search tree rooted at S0 with S1

G

on fringe. Must prove f(SG2) >= f(SG) and g(path(S0, SG))

is minimal (optimal). Text proves optimality by contradiction.

Page 17: Artificial Intelligence 15-381 Heuristic Search Methods Jaime Carbonell jgc@cs.cmu.edu 30 August 2001 Today's Agenda Search Complexity Analysis Heuristics.

A* Optimality Proof

Simpler Optimality Proof for A*

Assume s-Queue sorted by f.

Pick a sub-optimal SG2: g(SG2

) > g(SG)

Since h(SG2) = h(SG) = 0, f (SG2

) > f (SG)

If s-Queue is sorted by f, f(SG) is selected before f(SG2

)

Page 18: Artificial Intelligence 15-381 Heuristic Search Methods Jaime Carbonell jgc@cs.cmu.edu 30 August 2001 Today's Agenda Search Complexity Analysis Heuristics.

B* Search

Ideas Admissible heuristics for mono- and bi-polar

search "Eliminates" horizon problem in game-trees

[more later]

Definitions Let Best(S) = Always optimistic eval fn. Let Worst(S) = Always pessimistic eval fn. Hence: Worst(S) < True-eval(S) < Best(S)

Page 19: Artificial Intelligence 15-381 Heuristic Search Methods Jaime Carbonell jgc@cs.cmu.edu 30 August 2001 Today's Agenda Search Complexity Analysis Heuristics.

Basic B* Search

Basic B* SearchB*(S) is defined as:If there is an Si in SUCC(Scurr)

s.t. For all other Sj in SUCC(Scurr), W(Si) > B(Sj)Then select Si

Else ProveBest (SUCC(Scurr)) OR DisproveRest (SUCC(Scurr)

Difficulties in B* Guaranteeing eternal pessimism in W(S) (eternal optimism is

somewhat easier) Switching among ProveBest and DisproveRest Usually W(S) << True-eval(S) << B(S) (not possible to achieve

W(Si) > B(Sj)

Page 20: Artificial Intelligence 15-381 Heuristic Search Methods Jaime Carbonell jgc@cs.cmu.edu 30 August 2001 Today's Agenda Search Complexity Analysis Heuristics.

Macrooperators in Search

Linear Macros Cashed sequence of instantiated operators:

If: S0 ---opi S1 ---opjS2

Then: S0 –opi,j S2

Alternative notation:

if: opj(opi(S0)) = S2, Then: opi,j(S0) = S2

Macros can have any length, e.g. oi,j,k,l,m,n

Key question: do linear macoros reduce search?

Page 21: Artificial Intelligence 15-381 Heuristic Search Methods Jaime Carbonell jgc@cs.cmu.edu 30 August 2001 Today's Agenda Search Complexity Analysis Heuristics.

Macrooperators in Search

Disjunctive Macros

Iterative Macros

op1

op2

op5

op4

op6

op3

op7

Cond (s-Hist,SG)opi,j

NO

YES opk,l,m,n

opo,p,q