state space 3 chapter 4
DESCRIPTION
State Space 3 Chapter 4 . Heuristic Search. Backtrack Depth First Breadth First All work if we have well-defined: Goal state Start state State transition rules But could take a long time. Three Algorithms. An informed guess that guides search through a state space - PowerPoint PPT PresentationTRANSCRIPT
State Space
State Space 3Chapter 4 Heuristic Search1Three AlgorithmsBacktrackDepth FirstBreadth First
All work if we have well-defined:Goal stateStart stateState transition rules
But could take a long time2HeuristicAn informed guess that guides search through a state spaceCan result in a suboptimal solution3Blocks World: A Stack of BlocksStartGoalADBCCBDATwo rules:clear(X) on(X, table)clear(X) ^ clear(Y) on(X,Y)Generate part of the search space BF. Well find the answer, but it could take a long time. 4Heuristic 1For each block that is resting where it should, subtract 1For each block that is not resting where it should, add 15Hill ClimbingAt every level, generate all childrenContinue down path with lowest score
Define three functions:f(n) = g(n) + h(n)Where:h(n) is the heuristic estimate for n--guides the searchg(n) is path length from start to current nodeensures that we choose node closest to root when more than 1 have same h value 6
7Problem: heuristic is localGiven CandCBBDAADAt level nThe f(n) of each structure is the samef(n) = g(n) = (1+1-1-1) = g(n)
But which is actually better8Problem with local heuristicsCB ADMust be entirely undoneGoal Requires 6 moves
CBDAGoal requires only two moves9Global HeuristicTakes the entire structure into accountSubtract 1 for each block that has correct support structureAdd 1 for each block in an incorrect support structure
10Seems to WorkGoal:D CBA
C f(n) = g(n) + (3+2+1+0) =g(n) + 6B AD
CB f(n) = g(n) + (1 + 0 -1+ 0) = g(n)DA
So the heuristic correctly chose the second structure11Best FirstThe Road Not Taken
Open contains current fringe of the searchOpen: priority queue ordered by f(n) Closed: queue of states already visitedNodes could contain backward pointers so that path back to root can be recovered12path best_first(Start){ open = [start], closed = []; while (!open.isEmpty()) { cs = open.serve(); if (cs == goal) return path; generate children of cs; for each child { case: { child is on open;//node has been reached by a shorter path if (g(child) < g(child) on open) g(child on open) = g(child); break;
child is on closed; if (g(child < g(child on closed)) { //node has been reached by a shorter path and is more attractive remove state from closed; open.enqueue(child); } break;
default: { f(child) = g(child) + h(child);//child has been examined yet open.enqueue(child); } } } closed.enqueue(cs);//all cs children have been examined. open.reorder();//reorder queue because case statement may have affected ordering } return([]); //failure}
13
14AdmissibilityAdmissible Search AlgorithmsFind the optimal path to the goal if a path to the goal existsBreadth-First: AdmissibleDepth-First: Not admissible
15Algorithm AUsesBest Firstf(n) = g(n) + h(n)
16f*f*(n) = g*(n) + h*(n)
Whereg*(n) is the cost of the shortest path from start to nh*(n) is the cost of the shortest path from n to goal
So, f*(n) is the actual cost of the optimal path
Can we know f*(n)?
17The OracleNot without having exhaustively searched the graphGoal: Approximate f*(n)Consider g*(n)g(n) actual cost to ng*(n) shortest path from start to n
So g(n) >= g*(n)
When g*(n) = g(n), the search has discovered the optimal path to n19Consider h*(n)Often we can knowIf h(n) is bounded above by h*(n)(This sometimes means finding a function h2(n) such that h(n)