11848_lecture_12_15

Upload: nitesh-mishr

Post on 09-Apr-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/8/2019 11848_Lecture_12_15

    1/27

  • 8/8/2019 11848_Lecture_12_15

    2/27

    10/1/2010

    Heuristic Search Techniques

    Artificial Intelligence

    Some of the search strategies are as undero Depth Firsto Breadth Firsto Generate & Testo Hill Climbingo Best- First Searcho Problem Reductiono Constraint Satisfactiono Means-ends analysis

  • 8/8/2019 11848_Lecture_12_15

    3/27

    10/1/2010

    Heuristic Search Techniques

    Artificial Intelligence

    Generate & Testo It is the simplest of the all.o Algorithm

    Generate a possible solution. For some problems, this meansgenerating a particular point in the problem space. For others,

    it means generating a path from a start state. Test to see if this is actually a solution by comparing the

    chosen point or the endpoint of the chosen path to the set ofacceptable goal states.

    If a solution has been found, quit otherwise return to step 1.

  • 8/8/2019 11848_Lecture_12_15

    4/27

    10/1/2010

    Heuristic Search Techniques

    Artificial Intelligence

    If the generation of possible solutions is done systematically, thenthis procedure will find a solution eventually.

    If the problem space is large it may take a long time. It uses a Depth-First Search procedure, since complete solution must

    be generated before it can be tested.

    The procedure is very exhaustive. It can also generate solutions randomly, but that will not guarantee

    that we will find a solution.( British Museum Algorithm) The most straight forward way to implement systematic Generate &

    Test is a depth-first search tree with backtracking. For simple problems, exhaustive G&T is often a reasonable

    technique. Example Four six sided cubes.

  • 8/8/2019 11848_Lecture_12_15

    5/27

    10/1/2010

    Heuristic Search Techniques

    Artificial Intelligence

    Example of complex problem - DENDRALo It infers the structure of the organic compounds using mass

    spectrogram and nuclear magnetic resonance.o It uses a strategy called plan-generate-test.o The major weakness is that it often produces somewhat

    inaccurate solutions since there is no feedback from the world.

  • 8/8/2019 11848_Lecture_12_15

    6/27

    10/1/2010

    Heuristic Search Techniques

    Artificial Intelligence

    Hill Climbingo It is a variant of generate and test in which the feedback from the

    test procedure is used to help the generator decide whichdirection to move in the search space.

    o In a pure generate and test procedure, the test function respondswith only a yes or a no.

    o Hill climbing is often used when a good heuristic function isavailable for evaluating states bur when no other usefulknowledge is available.

    o Example moving towards the tallest building in town.

    o End a Hill Climbing search when there is no reasonablealternative state to move to.

  • 8/8/2019 11848_Lecture_12_15

    7/27

    10/1/2010

    Heuristic Search Techniques

    Artificial Intelligence

    Simple Hill Climbingo Algorithm

    Evaluate the initial state. If it is also a goal state, then return itand quit. Otherwise, continue with the initial state as thecurrent state.

    Loop until a solution is found or until there are no new

    operators left to be applied in the current state. Select an operator that has not yet been applied to the

    current state and apply it to produce a new state. Evaluate the new state. If it is a goal state then return it and quit. If it is not a goal state but it is better than the current state,

    then make it the current state. If it is not better than the current state, then continue in the

    loop.

  • 8/8/2019 11848_Lecture_12_15

    8/27

    10/1/2010

    Heuristic Search Techniques

    Artificial Intelligence

    Steepest Ascent Hill Climbingo It is a variation from the simple Hill Climbing, we consider all the

    moves from the current state and select the best one possible.

    o

    Both Simple Hill Climbing and Steepest Ascent may fail to find thebest solution, what kind of situations occur are discussed on thenext slide.

  • 8/8/2019 11848_Lecture_12_15

    9/27

    10/1/2010

    Heuristic Search Techniques

    Artificial Intelligence

    o A local maxima is a state that is better than all neighbors but is notbetter than some other state farther away. At local maxima, allmoves appear to make things worse.

    o A Plateau is a flat area of the search space in which a whole setof neighboring states have the same value. It is difficult to pick thebest direction.

    o A Ridge is a special kind of local maxima. It is an area of thesearch space that is higher than surrounding areas.

    Ways to tackle these problemso Backtracko Make a big jump

    o Apply two or more rules before applying the test.

  • 8/8/2019 11848_Lecture_12_15

    10/27

    10/1/2010

    Heuristic Search Techniques

    Artificial Intelligence

    Simulated Annealingo It is another variation of hill climbing where at the beginning of the

    process, some downhill moves may be made. The idea is to doenough exploration of the while space early on so that the finalsolution is relatively insensitive to the starting state. This should

    lower the chances of getting caught at a local maximum, plateauor a ridge.

  • 8/8/2019 11848_Lecture_12_15

    11/27

    10/1/2010

    Heuristic Search Techniques

    Artificial Intelligence

    Best First Searcho It is the way of combining the advantage of both depth-first &

    breath first into a single method.o Depth-first is good as it allows a solution to be found without all

    competing branches having to be expanded.o Breath-first is good because it does not get trapped on dead-end

    paths.o One way to combine the both is to follow a single path at a time,

    but switch paths whenever some competing path looks morepromising than the current one does.

    o Usually, we start with BFS and when we sense a opportunity, thenwe move to DFS.

  • 8/8/2019 11848_Lecture_12_15

    12/27

    10/1/2010

    Heuristic Search Techniques

    Artificial Intelligence

    Best First Searcho It is very similar to the procedure followed in Steepest-ascent hill

    climbing, exception being as under In hill climbing, one move is selected and all the others are

    rejected, never to be considered again, in BFS one move is

    selected, but the others are kept around so that they can berevisited later if the selected path becomes less promising.

  • 8/8/2019 11848_Lecture_12_15

    13/27

    10/1/2010

    Heuristic Search Techniques

    Artificial Intelligence

    Best First Searcho We can use a graph technique as well.o To implement such a graph-search procedure, we will need two

    use lists of nodes: OPEN : Nodes that have been generated and have had the

    heuristic function applied to them but which have not beenexamined yet.

    CLOSED : nodes that have been already examined.

  • 8/8/2019 11848_Lecture_12_15

    14/27

    10/1/2010

    Heuristic Search Techniques

    Artificial Intelligence

    Best First Searcho Algorithm

    Start with OPEN containing just the initial state. Until a goal is found or there are no nodes left on OPEN do:

    Pick the best node on OPEN. Generate its Successors. For each successor do: If it has not been generated before, evaluate it, add it to

    OPEN , and record its parent. If it has been generated before, change the parent if this

    new path is better than the previous one. In that case,update the cost of getting to this node and to anysuccessors that this node may already have.

  • 8/8/2019 11848_Lecture_12_15

    15/27

    10/1/2010

    Heuristic Search Techniques

    Artificial Intelligence

    Problem Reductiono We work on AND-OR technique graph (tree) , it is useful for

    representing the solution of problems that can be solved bydecomposing them into a set of smaller problems, all of whichmust then be solved.

    o This decomposition generates arcs that we call AND arcs. OneAND arc may point to any number of successor nodes, all ofwhich must be solved in order for the arc to point to a solution.

    o In OR graph, several arcs may emerge from a single node,indicating a variety of ways in which the original might be solved.

    o An AND arc are indicated with the line connecting all thecomponents.

    o f , g and h

  • 8/8/2019 11848_Lecture_12_15

    16/27

    10/1/2010

    Heuristic Search Techniques

    Artificial Intelligence

    Goal : Acquire TV Set

    Goal : Steal TV Goal : Earn Money Goal : Buy TV Set

    Problem Reductiono .

  • 8/8/2019 11848_Lecture_12_15

    17/27

    10/1/2010

    Heuristic Search Techniques

    Artificial Intelligence

    Problem Reduction Algorithmo Initialize the graph to start node.o Loop until the starting node is labeled SOLVED or until its cost

    goes above FUTILE. Traverse the graph, starting at the initial node and following the

    current best path, and accumulate the set of nodes that are onthat path and have not yet been expanded or labeled assolved.

    Pick one of these unexpected nodes and expand it. If there areno successors, assign FUTILITY as the value of this node.Otherwise , add its successors to the graph and for each ofthem compute f ( use only h and ignore g) If f of any node is0, mark it as SOLVED

  • 8/8/2019 11848_Lecture_12_15

    18/27

    10/1/2010

    Heuristic Search Techniques

    Artificial Intelligence

    Problem Reductiono Change the f estimate of the newly expanded node to reflect the

    new information provided by its successors. Propagate thischange backwards through the graph. It any node contains asuccessor arc whose descendants are all solved, label the node

    itself as SOLVED. At each node that is visited while going up thegraph, decide which of its successors arcs is the most promisingand mark it as part of the current best path. This may cause thecurrent best path to change. This propagation of revised costestimates back up the tree was not necessary in the best-firstsearch algorithm because only unexpected nodes wereexamined. But now expanded nodes must be reexamined so thatthe best current path can be selected. Thus it is important thattheir f values be the best estimate available.

    o Fig : 3.8

  • 8/8/2019 11848_Lecture_12_15

    19/27

    10/1/2010

    Heuristic Search Techniques

    Artificial Intelligence

    Difference between Best First & ProblemReductiono In the best first search algorithm, the desired path from one node

    to another was always the one with the lowest cost. But the same

    is not true when searching an AND

    -OR graph.o Fig: 3.9 of text book

    Limitation , illustrated by fig 3.10

  • 8/8/2019 11848_Lecture_12_15

    20/27

    10/1/2010

    Heuristic Search Techniques

    Artificial Intelligence

    Constraint Satisfactiono The goal is to discover some problem state that satisfies a given

    set of constraints. E.g. Puzzles, real-world perceptual labelingproblems, design tasks etc.

    o Helps in reducing the amount of search required as compared

    with a method that attempts to form partial solutions directly bychoosing specific values for components of the eventual solution.

    o The fundamental issue is to include restrictions first that can beinferred from the rules of arithmetic. This reduces the number ofguesses.

    o The initial state contains the constraints that are originally given in

    the problem description.o A goal state is any state that has been constrained enough,

    enough has to be defined for each problem.

  • 8/8/2019 11848_Lecture_12_15

    21/27

    10/1/2010

    Heuristic Search Techniques

    Artificial Intelligence

    Constraint Satisfactiono It is a 2 step process.

    First, constraints are discovered and propagated as far aspossible throughout the system.

    Then, if there is still no solution, search begins. A guess about

    something is made and added as a new constraint.Propagation can then occur with this new constraint and soforth.

  • 8/8/2019 11848_Lecture_12_15

    22/27

    10/1/2010

    Heuristic Search Techniques

    Artificial Intelligence

    Constraint Satisfactiono Algorithm

    Propagate available constraints. To do this, first set OPEN tothe set of all objects that must have values assigned to them ina complete solution. Then do until an inconsistency is detected

    or until OPEN is empty : Select an object OB from OPEN. Strengthen as much as

    possible the set of constraints that apply to OB. If this set is different from the set that was assigned the last

    time OB was examined or it this is the first time OB hasbeen examined, then add to OPEN all objects that share

    any constraints with OB. Remove OB from OPEN.

  • 8/8/2019 11848_Lecture_12_15

    23/27

    10/1/2010

    Heuristic Search Techniques

    Artificial Intelligence

    Constraint Satisfactiono Algorithm

    If the union of the constraints discovered above defines asolution, then quit and report the solution.

    If the union of the constraints discovered above defines acontradiction, then return failure.

    If neither of the above occurs, then it is necessary to make aguess at something in order to proceed. To do this, loop until asolution is found or all possible solutions have been eliminated: Select an object whose value is not yet determined and

    select a way of strengthening the constraints on thatobject. Recursively invoke constraint satisfaction with the current

    set of constraints augmented by the strengtheningconstraint just selected.

  • 8/8/2019 11848_Lecture_12_15

    24/27

    10/1/2010

    Heuristic Search Techniques

    Artificial Intelligence

    Means-Ends analysiso So far, we have presented a collection of search strategies that

    can reason either forward or backward, but for a given problem,one direction or the other must be chosen. Often, however amixture of two directions is appropriate.

    o By doing this we can solve the major part of problem first and thengo back and solve the small problems that arise in putting the bigpicture together.

    o The technique is called, means-ends analysis.o It processes the centers around the detection of differences

    between the current state and the goal state. Once that difference

    is found , and operator that can reduce the difference must befound.o Divide the problem into sub-problems.

  • 8/8/2019 11848_Lecture_12_15

    25/27

    10/1/2010

    Heuristic Search Techniques

    Artificial Intelligence

    Means-Ends analysiso The first AI program to use Means-Ends analysis was GPS(

    General Problem Solver)o We need to have three things Operator, Preconditions & Resulto Eg. Push, Carry, Walk, Pickup, Putdown, Place

  • 8/8/2019 11848_Lecture_12_15

    26/27

    10/1/2010

    Heuristic Search Techniques

    Artificial Intelligence

    Means-Ends analysiso Compare CURRENT to GOAL. If there are no differences

    between them then return.o Otherwise , select the most important difference and reduce it by

    doing the following until success or failure is signaled. Select an option that is untried, Operator O that is applicable to

    the current differences. It there as no such operators thensignal FAILURE

    Attempt to apply O to CURRENT. Generate descriptions of twostates : O-START, a state in which Os preconditions aresatisfied and O-RESULT, the state that would result if O were

    applied in O-START.

  • 8/8/2019 11848_Lecture_12_15

    27/27

    10/1/2010

    Heuristic Search Techniques

    Artificial Intelligence

    Means-Ends analysiso If ( FIRST-PART MEA ( CURRENT, O-START)

    and((LAST-PART MEA(O-RESULT,GOAL)are successful, then signal success and return the result of

    concatenating FIRST-PART,O & LAST-PART