informed_search.pdf

Upload: servekarimi

Post on 04-Jun-2018

215 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/14/2019 informed_search.pdf

    1/19

    Chapter 6Search, Games and Problem Solving

    Informed Search

    Using Search Heuristics

    Heuristics are guidelines of where it is best to lookfor a solution

    may find a solution faster than uninformedsearch, but without guarantee

    may result in a solution not being found

    closely linked with the need to make real-timedecisions with limited resources

    in practice, a good solution found quickly ispreferred over an optimal solution, but expen-

    sive to find

    1

  • 8/14/2019 informed_search.pdf

    2/19

    Heuristic evaluation function, f(s)

    used to mathematically model a heuristic

    goal is to find with little effort a solution withminimal total cost

    how good is an estimate of the distance fromthe node to the goal

    iff(m) < f(n), then m is more likely to be

    on an optimal path to the goal nHeuristic search methods (informed search)

    uses heuristics to guide the search

    The 8-puzzle problem

    typically tree depth of 20average branching factor of 3

    exhaustive search: 320 3.5 billion states

    there are only 9! = 362880 possible (unique)states

    use heuristics to avoid repeated states

    2

  • 8/14/2019 informed_search.pdf

    3/19

    Admissibility of heuristics

    should not overestimate the cost of changinga given state to the goal state

    a search heuristic is admissible when it is al-ways guaranteed to find the minimal cost pathto the goal

    Heuristics for 8-puzzle

    h1(n): count how many tiles are in the wrongplace

    h2(n): consider how far each tile has to moveto its correct state

    sum Manhattan distances of each tile from

    its correct position Manhattan distance = sum of horizontal &

    vertical moves to take from one to anotherposition

    h2 is more informed than h1 search using h2 will always perform better

    than using h1

    3

  • 8/14/2019 informed_search.pdf

    4/19

    h3(n): consider that there is extra difficultyinvolved if two tiles have to move past eachother, because tiles can not jump over each

    other k(n) denotes the number of direct swaps

    that need to be made between adjacent tilesto move them into correct sequence

    h3(n) =h2(n) + 2k(n)

    h3 is more informed than h2(n)

    Relaxed problems

    has fewer constraints

    8-puzzle: a tile can move to an adjacent square

    regardless of whether that square is empty ornot

    4

  • 8/14/2019 informed_search.pdf

    5/19

    Many non-dominated heurisics: What then?

    h(n) = max{h1(n), h2(n), , hK(n)}

    if all hk

    are admissible, will h(n) be admissi-ble?

    hdominates all hk

    Monotonicity

    search method is monotone if it always reaches

    a given node by the shortest possible pathif it reaches a given node at different depths,

    it is not monotone

    monotone search method must be admissible,provided there is only one goal state

    5

  • 8/14/2019 informed_search.pdf

    6/19

    Example: Modified traveling salesman problem

    find best route between two cities: A to F

    Figure 1: Modified Traveling Salesman Problem

    Search space

    Figure 2: The Search Space

    Solution using DFS? And BFS?

    6

  • 8/14/2019 informed_search.pdf

    7/19

    Hill Climbing

    Informed search

    How does it work?

    Disadvantages of hill climbing?

    Figure 3: Hill Climbing Illustrated

    Steepest ascent hill climbingfollow the path to the highest next point

    7

  • 8/14/2019 informed_search.pdf

    8/19

  • 8/14/2019 informed_search.pdf

    9/19

    h2(n) = #tiles out of place + node depth

    Figure 5: 8-tiles, with h2(n); Number of tiles out of place + depth

    9

  • 8/14/2019 informed_search.pdf

    10/19

    Beam Search

    Best-first search within a given beam width

    beam width: limits number of nodes expandedApplied to 8-puzzle?

    A Search

    f(n) =g(n) +h(n) g(n) = actual cost of path from start node to

    n

    h(n) = an underestimate of the distance fromnto the goal

    f(n) = path-based evaluation functionexpand the node with the smallest f

    Optimality

    if h(n) is always an underestimate, then A

    is gauranteed to find the shortest path to thegoal

    A is optimal, ifhis admissible, and complete

    if non-admissible heuristic is used, the algo-rithm is called A

    10

  • 8/14/2019 informed_search.pdf

    11/19

    Completeness

    A is complete if the graph it searches is lo-cally finite and if every arc has a non-zero cost

    locally finite if graph has finite branching fac-tor

    Uniform Cost Search

    Also called branch and bound search

    Basically A search with h(n) = 0

    Complete and optimal, provided that cost of apath increases monotonically

    Dijkstras algorithm

    11

  • 8/14/2019 informed_search.pdf

    12/19

    Greedy Search

    A search withg(n) = 0

    Always selects the path with the lowest estimateof the distance to the goal

    Worst case: may never find a solution

    Not optimal, and may follow extremely costly paths

    Example of non-optimal path: if first step on short-est path toward goal is longer than other paths

    12

  • 8/14/2019 informed_search.pdf

    13/19

    Iterative-Deepening A

    As memory requirements grow exponentially with

    depth of the goal in the search tree, even thoughheuristics reduce the branching factor

    IDA combines iterative-deepening with A:

    optimal and complete

    has the low memory requirements of depth-first search

    Executes a series of depth first searches, but usesa cut-off cost value as the depth limit, and notthe actual depth of the tree:

    In the first search, the cost cut-off value is= f(n0) =g(n0) +h(n0) =h(n0)

    The cost of an optimal path may just be equalto

    It can not be less, as h(n0) h(n0), whereh(n0) is the true cost; remember we work with

    underestimates of the true cost to the goal

    Expand nodes in a depth-first fashion, back-tracking whenever f(n) exceeds

    13

  • 8/14/2019 informed_search.pdf

    14/19

  • 8/14/2019 informed_search.pdf

    15/19

    Real-Time A

    Let nbe the current node, and mis a child node

    ofng(m) is the cost (distance) from n to m, and not

    the cost from the root node

    Will backtrack to n, i.e. not further expand fromm, if the cost of backtracking plus the estimatedcost to solve the problem fromnis less than theestimated cost to solve the problem from m, i.e.

    g(m) +h(n)< h(m)

    15

  • 8/14/2019 informed_search.pdf

    16/19

    Recursive Best-First Search (RBFS)

    Slightly more memory than IDA, but generates

    fewer nodes

    kn n

    n1

    n2

    n3

    k

    n m

    Figure 6: RBFS Illustrated

    The node expansion process (refer to figure 6)

    Noden

    is expandedThe f values are computed for the childrenn1, n2, n3

    Then the f values of n and all of its ances-tors in the search tree are recomputed called

    backing-up of f values

    16

  • 8/14/2019 informed_search.pdf

    17/19

    Computing backed-up values:

    backed-up value of a successor, ni, of justexpanded node, ni, is just f(ni)

    backed-up value of any ancestor node, n, is

    f(n) = minni

    f(ni)

    If the a successor ofn, sayn1, has the smallestfvalue over all unexpanded nodes, thenn1is

    futher expanded

    17

  • 8/14/2019 informed_search.pdf

    18/19

    Let n

    be an unexpanded node in the search

    tree, where n

    is not a successor ofn

    If f(n

    ) is the smallest fvalue over all unex-panded nodes, then find the common ancestor

    ofn

    If k is the common ancestor, and kn is thesuccessor ofk leading to n, then

    delete the entire search tree below kn, andlet

    f(kn) = minqi

    f(qi)

    over all unexpanded nodes,qiof the subtreeofkn

    expand node n

    18

  • 8/14/2019 informed_search.pdf

    19/19

    Island Driven Search

    Assumes a list of subgoals exists, i.e. n0, n1, , ng

    First find path fromn0ton1, thenn1ton2, then...ng1 tong

    Is island driven search admissible?

    Hierarchical Search

    Similar to island-driven search, but no explicit setof islands are available

    Assume the availability of macro-operators thatcan make large steps in an implicit search spaceof islands

    Perform a metal-level search, to produce a path ofmacro-operators from from base-level start nodeto base-level goal node

    Perform base-level searches on islandsAdmissible?