Docsity

Lecture 5: Search Algorithms - Hierarchical and Anytime A* - Prof. Shlomo Zilberstein, Study notes of Computer Science

Toggle sidebar
bg1
Lecture 5: Search - 4
Lecture 5: Search - 4
Jiaying Shen
CMPSCI 683
Fall 2004
2
Copyright: S.Zilberstein & V.Lesser; CMPSCI 683
Today
Today’
’s lecture
s lecture
•Anytime A*
•Hierarchical A*
•Other Examples of Hierarchical
Problem Solving
•Reviews of A* and its varations
3
Copyright: S.Zilberstein & V.Lesser; CMPSCI 683
Anytime algorithms
Anytime algorithms
!Ideal (maximal quality in no time)
!Traditional (quality maximizing)
!Anytime (utility maximizing)
Decision
Quality
Time
Ideal
Traditional
Time cost
Anytime Value
4
Copyright: S.Zilberstein & V.Lesser; CMPSCI 683
Anytime A*
Anytime A*
!A* is best first search with f(n) = g(n) + h(n)
!Three changes make it an anytime algorithm:
(1) Use a non-admissible evaluation function f’(n) to select
node to expand next so that sub-optimal solutions are found
quickly.
(2) Continue the search after the first solution is found, using
an auxiliary, admissible evaluation function f(n) to prune the
open list.
(3) When the open list is empty, the last solution generated is
optimal.
!How to choose a non-admissible evaluation function f’(n)?
pf3
pf4
pf5
pf8
pf9
pfa
pfd

Partial preview of the text

Download Lecture 5: Search Algorithms - Hierarchical and Anytime A* - Prof. Shlomo Zilberstein and more Study notes Computer Science in PDF only on Docsity!

Lecture 5: Search - 4Lecture 5: Search - 4

Jiaying Shen

CMPSCI 683

Fall 2004

Copyright: S.Zilberstein & V.Lesser; CMPSCI 683 2

TodayToday’’s lectures lecture

  • Anytime A*
  • Hierarchical A*
  • Other Examples of Hierarchical Problem Solving
  • Reviews of A and its varations*

Anytime algorithms Anytime algorithms

! Ideal (maximal quality in no time) ! Traditional (quality maximizing) ! Anytime (utility maximizing) Decision Quality Time Ideal Traditional Time cost Anytime (^) Value

Anytime AAnytime A

! A is best first search with* f(n) = g(n) + h(n) ! Three changes make it an anytime algorithm: (1) Use a non-admissible evaluation function f’(n) to select node to expand next so that sub-optimal solutions are found quickly. (2) Continue the search after the first solution is found, using an auxiliary, admissible evaluation function f(n) to prune the open list. (3) When the open list is empty, the last solution generated is optimal. ! How to choose a non-admissible evaluation function f’(n)****?

Copyright: S.Zilberstein & V.Lesser; CMPSCI 683 5

Weighted evaluation functions Weighted evaluation functions

! Use f’ ( n ) = (1! w ) " g ( n ) + w " h ( n ) ! Higher weight on h ( n ) tends to search deeper. ! Admissible if h ( n ) is admissible and w # 0. ! Otherwise, the search may not be optimal, but it normally finds solutions much faster. ! An appropriate w makes possible a tradeoff between the solution quality and the computation time Copyright: S.Zilberstein & V.Lesser; CMPSCI 683 6

Adjusting W Adjusting W DynamicallyDynamically

Suppose you had the following situations, how would you adjust w.

  • the open list has gotten so large that you are running out of memory?
  • you are running out of time and you have not yet reached an answer?
  • there are a number of nodes on the open list whose h value is very small?

Pruning States in Anytime A* Pruning States in Anytime A*

  • For each node, store real f(n) = g(n)+h(n)
    • f(n) is the lower bound on the cost of the best solution path through n
  • When find solution node n
    • f(n1) is an upper bound of the cost of the optimal solution
    • Prune all nodes n on the open list that have real f(n)

      = f(n1)

Performance profile of w=.6 Performance profile of w=.

What would w=.75 look like? time quality Heavier weights tend to create more of an anytime effect

Copyright: S.Zilberstein & V.Lesser; CMPSCI 683 13

Naive Hierarchical ANaive Hierarchical A

  • Operates like A except that h(s) is computed by* searching at the next higher level of abstraction. - h(s) = d($(s), $(goal))
  • The result is combined with other estimates (e.g. cheapest operator cost) to produce the final h(s). - h(s) >= to cheapest operator cost
  • Heuristic values are being cached to improve performance. Copyright: S.Zilberstein & V.Lesser; CMPSCI 683 14

State-space Abstraction for A* State-space Abstraction for A*

  • A mapping $ of states from state space

<S,d> into <S’,d’> is an abstraction

transformation iff:

d'( $ (s1), $ (s2)) # d(s1, s2)

  • Abstraction can be used in order to

automatically create admissible heuristic

functions

  • h(s1) = d’($(s1), $(g))
  • Searching in Abstraction Space to Compute h using blind search

Types of AbstractionsTypes of Abstractions

  • Embedding = adding edges to the original

graph (corresponds to macro or relaxed

operators).

  • Homomorphism = grouping together sets of

states to create a single abstract state

(corresponds to dropping a feature/variable

from the state representation).

EmbeddingEmbedding Eliminate conditions Make possible new operator

Copyright: S.Zilberstein & V.Lesser; CMPSCI 683 17

Not always a useful idea... Not always a useful idea...

The primary risk in using a heuristic

created by abstraction is that the total

cost of computing h(-) over the course

of the search can exceed the savings.

Copyright: S.Zilberstein & V.Lesser; CMPSCI 683 18

Generalized Generalized ValtortaValtorta’’ss TheoremTheorem

  • If state s must be expanded by blind search, then either s or $ (s) must be expanded by A using* h $ (-). - A state is necessarily expanded by blind search if its distance from the start state is strictly less than the distance from the start state to the goal state
  • As a result
    • no speed-up when $ is an embedding since $(s) not equal to $(s’)
    • possible speed-up when $ is a homomorphism
  • Q. What speed-up can be achieved?

““Max-degreeMax-degree””^ Star AbstractionStar Abstraction

  • The state with the highest degree is grouped

together with its neighbors within a certain

distance (the abstraction radius) to form a

single abstract state.

Star abstraction with radius = 2 Star abstraction with radius = 2

State with the largest degree within a certain distance is grouped together with neighbors, repeat for non- grouped states

start goal goal goal start start

Copyright: S.Zilberstein & V.Lesser; CMPSCI 683 25

The Granularity of Abstraction The Granularity of Abstraction

  • Increasing the radius of abstraction has two

contradictory effects:

+ abstract spaces contain fewer states and each

abstract search produces values for more

states, but

- the heuristic is less discriminating

  • The best case breaks the Valtorta’s barrier in

every search space.

Copyright: S.Zilberstein & V.Lesser; CMPSCI 683 26

A* with best abstraction radius A* with best abstraction radius

Hierarchical Problem Solving Hierarchical Problem Solving

Traditional vs. Hierarchical Traditional vs. Hierarchical Problem Problem (^) SolverSolver

  • Traditional problem solver:
    • Problem space
      • Set of operators
      • Set of states
    • Problem
      • Initial state
      • Goal state
  • Hierarchical problem solver:
    • Generate abstraction space(s)
      • Set of operators and states
    • Produce solution in highest abstraction space
      • Map from operators and states in ground space
    • Refine down to ground level
      • Map to operators and states in ground space

Copyright: S.Zilberstein & V.Lesser; CMPSCI 683 29 3-Disk Towers of Hanoi 3-Disk Towers of Hanoi Example Operator Example Operator (MOVE_DISK3_FROM_PEG2_TO_PEG3) (preconds ( (on disk3 peg2) (not (on disk2 peg2)) (not (on disk1 peg2)) (not (on disk2 peg3)) (not (on disk1 peg3)))) (effects ( (not (on disk3 peg2)) (on disk3 peg3)))) (MOVE_DISK2_FROM_PEG2_TO_PEG3) (preconds ( (on disk1 peg2) (not (on disk1 peg2)) (not (on disk1 peg3)) (effects ( (not (on disk2 peg2)) (on disk2 peg3)))) A smaller disk can be always moved without interfering with a large disk!! P1 P2 P P1 P2 P D D D D D D Copyright: S.Zilberstein & V.Lesser; CMPSCI 683 30

Producing Abstraction Spaces Producing Abstraction Spaces

  • Idea: Abstraction spaces are formed by removing sets of literals from the operators and states of the domain
  • Premise: Literals in a domain only interact with some of the other literals - literals in D3 moves do not interact with literals in D2 moves
  • Method: Partition literals into classes based on their interactions, and order the classes
  • This forms a monotonic hierarchy of abstraction spaces, that is, any plan to achieve a literal cannot **add or delete a literal higher in the hierarchy. Producing Abstraction Spaces: Producing Abstraction Spaces: Algorithm Algorithm Input: The set of operators for a domain. Output: A hierarchy of monotonic abstraction spaces. Create_Abstraction_Hierarchy(OPERATORS)
  1. ForEach OP in OPERATORS ForEach LIT1 in Effects(OP) i. ForEach LIT2 in Effects(OP) Add_Directed_Edge(LIT1,LIT2,GRAPH) ii. ForEach LIT2 in Preconditions(OP) Add_Directed_Edge(LIT1,LIT2,GRAPH)
  2. Combine_Strongly_Connected_Components(GRAPH)
  3. Topological_Sort(GRAPH)**
  • Complexity: O(o n^2 )
  • o is number of operators
  • n is number of different instantiated literals 3-Disk Towers of Hanoi 3-Disk Towers of Hanoi Constraints Constraints onon thethe LiteralsLiterals (on disk3 peg1) (on disk3 peg2) (on disk3 peg3) (on disk1 peg1) (on disk1 peg2) (on disk1 peg3) (on disk2 peg1) (on disk2 peg2) (on disk2 peg3) Level 3 Level (^1) Level 2 A smaller disk can be always moved without interfering with a large disk!! A directed edge indicates that the first literal must be at a higher or the same level

Copyright: S.Zilberstein & V.Lesser; CMPSCI 683 37 ABSTRIPS ABSTRIPS

cont cont’’dd

Copyright: S.Zilberstein & V.Lesser; CMPSCI 683 38

A*

Questions Questions

  • What are open list and closed list? Why do we

need them?

  • Why is A optimal?*
  • Why does A suffer from high memory*

requirement?

Copyright: S.Zilberstein & V.Lesser; CMPSCI 683 41

IDA* IDA*

Copyright: S.Zilberstein & V.Lesser; CMPSCI 683 42

Questions Questions

  • How is IDA different from standard iterative*

deepening?

  • What is the f-bound of each iteration?
  • Why does IDA use less memory than A?**
  • What problems does IDA suffer from?* RBFS 447 447

Questions Questions

  • Why do we need to back up the best f-value of

all the successors of a node?

  • Why do we need to back up the f-value of a

node’s best forgotten child?

  • Is SMA optimal? Why?*
  • Why is SMA guaranteed not to get stuck in a*

loop?

Next lecture Next lecture

  • Iterative Improvement
    • Simulated Annealing (Hill Climbing)
    • Solution Repair/Debugging
    • GSAT
  • Heuristics for CSP
    • texture measures