Top Banner

Click here to load reader

Artificial Intelligence & Expert Systems

Jan 22, 2016




Artificial Intelligence & Expert Systems. Heuristic Search. Heuristics. Heuristic means “rule of thumb”. To quote Judea Pearl, - PowerPoint PPT Presentation

  • Artificial Intelligence & Expert SystemsHeuristic Search

  • Heuristics Heuristic means rule of thumb. To quote Judea Pearl, Heuristics are criteria, methods or principles for deciding which among several alternative courses of action promises to be the most effective in order to achieve some goal. In heuristic search or informed search, heuristics are used to identify the most promising search path.

  • Heuristics . . . The study of the methods and rules of discovery and invention defined by George PolyaGreek root word is euisco which means I discoverArchimedes emerged and shouted Eureka meaning I have found itIn state space search, heuristics are formalized as rules for choosing those branches in a state space that are most likely to lead to an acceptable solution

  • AI problem solvers employ heuristics in two basic situationA problem may not have an exact solution because of inherent ambiguities in the problem statement or available data. A given set of symptoms may have several possible causes; doctors use heuristics to choose the most likely diagnosis and formulate a plan of treatment

  • (2) A problem may have an exact solution, but the computational cost of finding it may be prohibitive. In many problems (such as chess),state space growth is combinatorially explosive, with the number of possible states increasing exponentially or factorially with the depth of the search. In these cases, exhausive, bruce-force search techniques such as depth-first or breadth-first search may fail to find a solution within any practical length of time. Heuristics attack this complexity by guiding the search along the most promising path through the space. By eliminating unpromising states and their descendants from consideration, a heuristics algorithm can defeat this combinatorial explosion and find an acceptable solution.

  • Inherent limitation of heuristic searchHeuristic is only an informed guess of the next step to be taken in solving a problem.Because heuristics use limited information, they are seldom able to predict the exact behavior of the state space farther along in the search.a heuristic can lead a search algorithm to a sub-optimal solution or fail to find any solution at all.

  • Importance of heuristicsBut heuristics and the design of algorithms to implement heuristic search have long been a core concern of artificial intelligence researchIt is not feasible to examine every inference that can be made in a mathematics domainheuristic search is often the only practical answermore recently, expert systems research has affirmed the importance of heuristics as an essential component of problem solving

  • Algorithms for Heuristic Search

  • Hill ClimbingTo implementation of heuristic search is through a procedure called hill climbingHill climbing strategies expand the current state in the search and evaluate its childrenthe best child is selected for further expansion; neither its siblings nor its parent are retainedsearch halts when it reaches a state that is better than any of its childrengo uphill along the steepest possible path until it can go no fartherbecause it keeps no history, the algorithm cannot recover from failures of its strategy

  • Hill Climbing . . . If the Node is better, only then you proceed to that Node.Algorithm:1. Start with current-state (cs) = initial state2. Until cs = goal-state or there is no change in the cs do:

    (a)Get the successor of cs and use the EVALUATION FUNCTION to assign a score to each successor(b)If one of the successor has a better score than cs then set the new state to be the successor with the best score.

  • Example-1: Tic-Tac-ToeIn tic-tac-toe problem,

    the combinatorics for exhaustive search are high but not insurmountabletotal number of states that need to be considered in an exhaustive search at 9x8x7x.or 9!Symmetry reduction decrease the search spaceSymmetry reductions on the second level further reduce the number of paths through the space to 12x7!

  • First three levels of the tic-tac-toe state space reduced by symmetry.

  • The most wins heuristic applied to the first children in tic-tac-toe.

  • Which one to choose???

    Heuristic:calculate winning lines and move to state with most winning lines.

  • Heuristically reduced state space for tic-tac-toe.

  • Example-2:

  • Devise any heuristic to reach goal:Start:LibraryGoal:University

  • Evaluation Function:Distance between two placeAdopt the one with minimum distance from goal

    Probable route will be:

    LibraryHospitalNewsagent University

  • Suppose S2 < S1

    Then what will happen?

    The algorithm will always go to park from hospital instead of going to newsagent. The algorithm will get stuck here.

  • Drawback of Hill Climbing

  • Ridge = sequence of local maxima difficult for hill climbing to navigatePlateaux = an area of the state space where the evaluation function is flat.GETS STUCK 86% OF THE TIME.

  • Simulated AnnealingA method to get rid of the local minima/maxima problem.

    It is an optimization method that employ certain techniques to take small steps in the direction indicated by the gradient, but occasionally large steps in the gradient direction / same other directional taken.

  • Best-First Search

    A major problem of hill climbing strategies is their tendency to become stuck at local maximaif they reach a state that has a better evaluation than any of its children, the algorithm haltshill climbing can be used effectively if the evaluation function is sufficiently informative to avoid local maxima and infinite pathsheuristic search requires a more flexible algorithm: this is provided by best-first search, where, with a priority queue, recovery from local maxima is possible

  • Heuristic search of a hypothetical state space

  • A trace of the execution of best-first search

  • Heuristic search of a hypothetical state space with open and closed highlighted

  • The best-first search algorithm always select the most promising state on open for further expansionas it is using a heuristic that may prove erroneous, it does not abandon all the other states but maintains then on openIn the event a heuristic leads the search down a path that proves incorrect, the algorithm will eventually retrieve some previously generated, next best state from open and shift its focus to another part of the spaceIn best-first search, as in depth-first and breadth-first search algorithms, the open list allows backtracking from paths that fail to produce a goal

  • Evaluation Function1.Count the no. of tiles out of place in each state when compared with the goal.

    Out of place tiles2, 8, 1, 6In place tiles3, 4, 5, 7

    Initial stateGoal

  • Heuristic Function f(n) = h(n)

    Drawback:The heuristic defined does not take into account the distance each tile has to be moved to bring it to the correct place.

  • Sum the no. of boxes the tile has to be moved to reach the goalfor example:Total places to be moved = 2No. of places to be moved = 3

  • Total tiles out of place = 5Sum of distances out of place = 6TilesDistance1121826171 total: 6

  • Another ScenarioThe first picture shows the current state n, and the second picture the goal state. h(n) = 5 because the tiles 2, 8, 1, 6 and 7 are out of place.

  • Manhattan Distance Heuristic: Another heuristic for 8-puzzle is the Manhattan distance heuristic. This heuristic sums the distance that the tiles are out of place. The distance of a tile is measured by the sum of the differences in the x-positions and the y-positions. For the above example, using the Manhattan distance heuristic, h(n) = 1 + 1 + 0 + 0 + 0 + 1 + 1 + 2 = 6

  • Total tiles out of place = 7Sum of distancesTilesDistance32112282726353 total: 15

  • In general,

    Best-first search is a general algorithm for heuristically search any state space graph (as were in the breadth-and depth-first algorithms)It is equally appropriate data-and goal-driven searches and supports a variety of heuristic evaluation functionsBecause of its generality, best-first search can be used with a variety of heuristics, ranging from subjective estimates of states goodness to sophisticated measure based on the probability of a state leading to a goal

  • Drawbacks with BFSProblems with Best First SearchIt reduces the costs to the goal butIt is not optimal nor completeUniform cost

  • Algorithm AConsider the evaluation function f(n) = g(n) + h(n)where n is any state encountered during the search g(n) is the cost of n from the start state h(n) is the heuristic estimate of the distance n to the goalIf this evaluation algorithm is used with the best_first_search algorithm, the result is called algorithm A.

  • Algorithm A*If the heuristic function used with algorithm A is admissible, the result is called algorithm A* (pronounced A-star).A heuristic is admissible if it never overestimates the cost to the goal.The A* algorithm always finds the optimal solution path whenever a path from the start to a goal state exists.

  • MonotonicityA heuristic function h is monotone if 1. For all states ni and nJ, where nJ is a descendant of ni, h(ni) - h(nJ) cost (ni, nJ), where cost (ni, nJ) is the actual cost (in number of moves) of going from state ni to nJ.2. The heuristic evaluation of the goal state is zero, or h(Goal) = 0.

  • InformednessFor two A* heuristics h1 and h2, if h1 (n) h2 (n), for all states n in the search space, heuristic h2 is said to be more informed than h1.

  • Condition for Admissible Sear