Bratko, Chapter 11: Basic Problem-Solving Strategies 11.1 Introductory Concepts and Examples - state space - start node - goal condition, satisfied by goal nodes - goal(Situation) - solve(Start,Solution) - solve([[c,a,b],[],[]],Solution) - examples - blocks world - eight puzzle 11.2 Depth-First Search and Iterative Deepening - depth-first search: - solve(State,[State]) :- goal(State). solve(State,[State|Solution]) :- successor(State,State1), solve(State1,Solution). - eight queens - successor(Queens,[Queen|Queens]) :- member(Queen,[1,2,3,4,5,6,7,8]), noattack(Queen,Queens). goal([_,_,_,_,_,_,_,_]). - cycle detection [Fig11.7, depthfirst] - depth limit [Fig11.8, depthfirst2] - iterative deepening - call depthfirst2 with ever increasing depth limit - or generate all paths in increasing order by length [sec11.2] - this is actually breadth-first search 11.3 Breadth-First Search - maintain a list of paths, not a single path - remove the first path and put successors on the end of the list - check if first node of first path is a goal node - use bagof to collect all successors of a node - breadth-first search with cycle detection [Fig11.10] - breadthfirst([[StartNode]],Solution) - use of concatentation (conc) is inefficient - using list differences [Fig11.11] - using 'path' from iterative deepening HW - various searches for blocks world [Exer11.3, p268]