Object-Oriented Search ---------------------- Goal: Design a class hierarchy for general-purpose breadth-first, depth-first, uniform-cost and best-first search. Search Engine (solve) 1. Put start node on OPEN 2. Get first node on OPEN. If none, Fail. 3. Remove first node N from OPEN and put on CLOSED. If n is a goal, then return n. 4. Expand N to obtain successors. 5. Put new successors on OPEN. Goto 2. Insertion on OPEN depends on existence and heuristic value. Example: 8-puzzle - state is a 3x3 array OPEN and CLOSED lists - doubly-linked list class (LIST_) - sorted doubly-linked list class (SORTEDLIST_ : LIST_) - list iterator class (LIST_ITERATOR_) NODE representation - state description (depends on problem) - state equality (test uniqueness and goal condition) - apply operators (do_operator(int)) - display Search Problem - problem initialization (constructor) - number of operators - initial and goal states - OPEN and CLOSED lists - adding to lists (add(NODE_ *)) - search engine (solve) Tree Search vs. Graph Search - tree assumes all states unique - graph assumes a state arrived at thru multiple paths - keeps best path - affects whether children added to OPEN