470 likes | 673 Views
Chapter 3 Structures and Strategies For Space State Search. Contents. Graph Theory Strategies for Space State Search Using the Space State to Represent Reasoning with the Predicate Calculus. The city of Königsberg. Leonhard Euler
E N D
Chapter 3 Structures and Strategies For Space State Search Contents • Graph Theory • Strategies for Space State Search • Using the Space State to Represent Reasoning with the Predicate Calculus Artificial Intelligence
The city of Königsberg • Leonhard Euler • Problem: if there is a walk around the city that crosses each bridge exactly once? Artificial Intelligence
Representations • Predicate calculus: connect(X, Y, Z) connect(i1, i2, b1) connect(i2, i1, b1) connect(rb1, i1, b2) connect(i1, rb1, b2) connect(rb1, i1, b3) connect(i1, rb1, b3) connect(rb1, i2, b4) connect(i2, rb1, b4) connect(rb2, i1, b5) connect(i1, rb2, b5) connect(rb2, i1, b6) connect(i1, rb2, b6) connect(rb2, i2, b7) connect(i2, rb2, b7) • Graph theory • Nodes • Linkes • Easy proof: the walk is impossible since all nodes have odd degrees Artificial Intelligence
Graph of the Königsberg bridge system Artificial Intelligence
A labeled directed graph Artificial Intelligence
A rooted tree, exemplifying family relationships Artificial Intelligence
Finite State Machine (FSM) Artificial Intelligence
Flip Flop FSM (a) The finite state graph for a flip flop and (b) its transition matrix. Artificial Intelligence
Finite State Accepting Machine • Deterministic FSM: transition function for any input value to a state gives a unique next state • Probabilistic FSM: the transition function defines a distribution of output states for each input to a state Artificial Intelligence
String Recognition • The finite state graph • The transition matrix for string recognition example Artificial Intelligence
State Space and Search Artificial Intelligence
State Space of the 8-Puzzle • generated by “move blank” operations • -- up • -- left • -- down • -- left Artificial Intelligence
The travelling salesperson problem • Find the shortest path for the salesperson to travel, visiting each city and returning to the starting city Artificial Intelligence
Search for the travelling salesperson problem. Each arc is marked with the total weight of all paths from the start node (A) to its endpoint. Artificial Intelligence
An instance of the travelling salesperson problem with the nearest neighbour path in bold. Note this path (A, E, D, B, C, A), at a cost of 550, is not the shortest path. The comparatively high cost of arc (C, A) defeated the heuristic. Artificial Intelligence
Strategies for State Space Search • Data-driven search – forward chaining • Begin with the given facts and a set of legal rules for changing states • Apply rules to facts to produce new facts • Repeat rules application until finding a path that satisfies the goal condition • Goal-driven search – backward chaining • Begin with the goal and a set of facts and legal rules • Search rules that generate this goal • Determine conditions of these rules subgoals • Repeat until all conditions are facts Artificial Intelligence
Data-driven Search State space in which data-directed search prunes irrelevant data and their consequents and determines one of a number of possible goals. Artificial Intelligence
Goal-driven Search State space in which goal-directed search effectively prunes extraneous search paths. Artificial Intelligence
Search and Backtrack • Search – find a path • Backtrack – when the path is dead, try others • Backtrack to the most recent node on the path having unexamined siblings • Continue toward to a new path • Like a recursion • Implemented in Prolog as an internal mechanism Artificial Intelligence
Backtrack algorithm Artificial Intelligence
Backtracking search of a hypothetical state space space. Artificial Intelligence
A trace of backtrack on the previous graph Artificial Intelligence
Depth-First and Breadth-First Search • Determine the order of nodes (states) to be examined • Depth-first search • When a state is examined, all of its children and their descendants are examined before any of its siblings • Go deeper into the search space where possible • Breadth-first search • When a state is examined, all of its children are examined after any of its siblings • Explore the search space in a level-by-level fashion Artificial Intelligence
Graph for search examples Artificial Intelligence
The breadth-first search algorithm Artificial Intelligence
A trace of breadth-first search Artificial Intelligence
The graph at iteration 6 of breadth-first search. States on open and closed are highlighted Artificial Intelligence
Breadth-first search of the 8-puzzle, showing order in which states were removed from open Artificial Intelligence
The depth-first search algorithm Artificial Intelligence
A trace of depth-first search Artificial Intelligence
The graph at iteration 6 of depth-first search. States on open and closed are highlighted Artificial Intelligence
Depth-first search of 8-puzzle with a depth bound of 5 Artificial Intelligence
Comparison between breadth- and depth-first search • Breadth-first • Always find the shortest path to a goal • High branching factor -- Combinatorial explosion • Depth-first • More efficient • May get lost Artificial Intelligence
State Space Representation of Logical Systems • Representation • Logical expressions as states • Inference rules as links • Correctness • Soundness and completeness of predicate calculus inference rules guarantee the correctness of conclusions • Theorem Proof • State space search Artificial Intelligence
State space graph of the propositional calculus • Letters as nodes • Implications as links • qp • rp • vq • sr • tr • su Artificial Intelligence
And/or graph • Or – separate • And -- connected • And/or graph of expression q r p • And/or graph of the expression q r → p Artificial Intelligence
And/or graph of a set of propositional calculus expressions. Artificial Intelligence
And/or graph of part of the state space for integrating a function Artificial Intelligence
The facts and rules of this example are given as English sentences followed by their predicate calculus equivalents: Artificial Intelligence
The solution subgraph showing that Fred is at the museum. Artificial Intelligence
Rules for a simple subset of English grammar are: Artificial Intelligence
And/or graph for the grammar. Some of the nodes (np, art, etc) have been written more than once to simplify drawing the graph. Artificial Intelligence
And/or graph searched by the financial advisor. Artificial Intelligence
Parse tree for the sentence “The dog bites the man.” Artificial Intelligence