Blay Whitby 2003 blayw@sussex.ac.uk Search Blay Whitby 2003 blayw@sussex.ac.uk
Knowledge Representation Spot the Connection… Chippenham, Wiltshire April 17th 1960. Finding routes, making plans, Deep Blue. One greater than two (if you believe in integer theory). 21/02/2019 Knowledge Representation
Knowledge Representation Jargon State Space or Problem Space ALL the steps achievable in a particular problem Search Space Those steps achievable GIVEN an initial start state and operators for moving between states [usually a directed graph] 21/02/2019 Knowledge Representation
Knowledge Representation Jargon… Directed Graph A graph in which the ARCS are directional and may rejoin as opposed to a: Tree A Special case of a directed graph in which each NODE may have several descendants, but only one ancestor. 21/02/2019 Knowledge Representation
Knowledge Representation State Space Search A general problem solving technique, the basis of: Game playing Planning Natural Language Processing Theorem proving The main step forward in 50’s – 60’s AI 21/02/2019 Knowledge Representation
Knowledge Representation State Space Search Represent the problem as a space of possibilities Solving the problem is then a matter of ‘finding’ if one of these possibilities is the solution. There are many techniques for doing this. 21/02/2019 Knowledge Representation
Knowledge Representation Trees Root Root node Arcs Goal ‘Daughter’ nodes Nodes 21/02/2019 Knowledge Representation
Knowledge Representation How to Grow a Tree Most problems have: A start state A possible solution (or goal) Possible transitions (or legal moves) 21/02/2019 Knowledge Representation
Knowledge Representation How to Grow a Tree Problem: Build a tower of bricks 5cm high from any of 4 bricks: 1cm, 2cm, 3cm & 4cm high. Start state: No bricks at all Possible transitions: Add any one brick, provided it is not already on the pile. Goal: 5cm pile of bricks 21/02/2019 Knowledge Representation
Tower of Bricks Search space tree [ ] [1] [2] [3] [4] [2,1] [2,3] [2,4] [4,1] [4,2] [4,3] [1,2] [1,3] [1,4] [3,1] [3,2] [3,4] [1,2,3] [1,2,4] Note 4 paths to goal [1,2,3,4] 21/02/2019 Knowledge Representation
State Space Representation of Predicate Calculus q r u v t s qp t r r p s u v q s s r t p q r p a b Q Λ r p a V b p Luger & Stubblefield pp. 100-101. 21/02/2019 Knowledge Representation
Knowledge Representation Implementation Most search programs use lists: [a,b,c,d,e] It is important to know if a state has already been visited, so two lists are needed: Considered – states already looked at – closed Alternatives – generated but not yet examined – open Generating and examining these lists is an algorithmic procedure 21/02/2019 Knowledge Representation
Generate & Test Algorithm Generate a possible solution (legal move) Test to see if this is the goal (or 1 of a set of end states) If goal then STOP else return to 1 21/02/2019 Knowledge Representation
Knowledge Representation Search Strategies Depth First: Explore one path at a time to final node or goal. Breadth First: Explore all nodes that are one step away until all visited or goal found. Exhaustive search strategies. They will find a solution if one exists. As such they may be inefficient and need to be limited 21/02/2019 Knowledge Representation
More efficient Strategies For most non-trivial problems exhaustive search is not practicable e.g., Chess (2.5x10154) Many techniques exist to reduce the need to explore unpromising parts of the search space Take into account how much effort has been made in getting this far or how near we think we are to the goal: or, best, both. 21/02/2019 Knowledge Representation
Best First and Hill Climbing Best First: Explore the most promising node first. Hill Climbing:Explore the daughter of the most promising node first. To do this we need a static evaluation function: measure of how good this node is, without looking ahead or: An heuristic* evaluation function? * rule of thumb 21/02/2019 Knowledge Representation
Knowledge Representation Branch and Bound Consider the ‘cost’ of getting to a node Euston Vic. Charing X Northern Oxford Circus Vic. Warren St. Northern Warren St. Vic. Vic. Vic. Green Pk. 2 5 1 4 Here ‘cost’ = travelling time between nodes 21/02/2019 Knowledge Representation
Knowledge Representation Branch and Bound Good in that it guarantees an ‘optimal path’ but: Poor in that it will explore ‘pointless’ options because it is unguided. 21/02/2019 Knowledge Representation
Knowledge Representation A* Algorithm Requires an evaluation of the cost so far (K) and a heuristic (guess) of how close we are to the goal (>K) Where: g(n)=cost of best path from start to n h(n)=estimate of cost of best path to goal from n. Evaluate nodes and always choose lowest f value 21/02/2019 Knowledge Representation
Knowledge Representation A* Algorithm If will find the lowest cost path. Where: h*(n) is the actual cost to goal. In other words: The heuristic must underestimate the cost to goal The closer the heuristic is to the real costs, the more effective is the search. 21/02/2019 Knowledge Representation
Knowledge Representation The 8 Puzzle Tiles 1 3 4 6 8 7 5 2 Represent as a list [1,3,4,6,8,7,hole,5,2] 21/02/2019 Knowledge Representation
Knowledge Representation State Representation 1 4 3 2 8 7 5 6 = [1,4,3,2,8,hole,7,5,6] 1 4 2 8 3 7 5 6 = [1,4,hole,2,8,3,7,5,6] 21/02/2019 Knowledge Representation
Knowledge Representation Program run: 21/02/2019 Knowledge Representation
First 4 layers of search tree 21/02/2019 Knowledge Representation
Comparison of search methods Source Thornton & DuBoulay (1992) 21/02/2019 Knowledge Representation
Comparison of search methods 21/02/2019 Knowledge Representation