1 / 28

Chapter 6 Building Control Algorithms For State Space Search

Chapter 6 Building Control Algorithms For State Space Search. Contents. Recursion-Based Search Production Systems The Blackboard Architecture for Problem Solving. Recursive Search. Recursive search A recursive step: procedure calls itself A terminating condition

thu
Download Presentation

Chapter 6 Building Control Algorithms For State Space Search

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 6 Building Control Algorithms For State Space Search Contents • Recursion-Based Search • Production Systems • The Blackboard Architecture for Problem Solving Artificial Intelligence

  2. Recursive Search • Recursive search • A recursive step: procedure calls itself • A terminating condition • Depth-first recursive search algorithm Artificial Intelligence

  3. Recursive Search with Global Variables Global variables : open and closed Artificial Intelligence

  4. Pattern-Driven Reasoning • Problem: • Given a set of assertions (predicate expressions) • Determine whether a given goal is a logical consequence of the given set of assertions • Solution • Use unification to select the implications (rules) whose conclusions match the goal • Unify the goal with the conclusion of the rule • Apply the substitutions throughout the rule • Transform the rule premise into a new subgoal • If the subgoal matches a fact, terminate • Otherwise recur on the subgoal • Recursive algorithm – next page Artificial Intelligence

  5. Pattern-driven Reasoning Artificial Intelligence

  6. Some Issues • The order of assertions • Logical connectives in the rule premises • Logical negation Artificial Intelligence

  7. Artificial Intelligence

  8. Artificial Intelligence

  9. A production system. Control loops until working memory pattern no longer matches the conditions of any productions. Artificial Intelligence

  10. Trace of a simple production system. Artificial Intelligence

  11. The 8-puzzle as a production system Artificial Intelligence

  12. The 8-puzzle searched by a production system with loop detection and depth-bound. Artificial Intelligence

  13. The Knight’s Tour Problem • Problem: find a series of legal moves in which the knight lands on each square of the chessboard exactly once • Legal moves of a chess knight. Artificial Intelligence

  14. A 3 x 3 chessboard with move rules for the simplified knight tour problem. Artificial Intelligence

  15. Production rules for the 3 x 3 knight problem. Artificial Intelligence

  16. A production system solution to the 3 x 3 knight’s tour problem. Artificial Intelligence

  17. Control Algorithms • The general recursive path definition X path(X,X) X,Y[path(X,Y)  Z[move(X,Z)  path(Z,Y)]] • The revised path definition to avoid infinite loop X path(X,X) X,Y[path(X,Y)  Z[move(X,Z)  (been(Z))  assert(been(Z))  path(Z,Y)]] Artificial Intelligence

  18. The recursive path algorithm as production system. Artificial Intelligence

  19. A Production System in Prolog • Farmer, wolf, goat, and cabbage problem • A farmer with his wolf, goat, and cabbage come to the edge of a river they wish to cross. There is a boat at the river’s edge, but, of course, only the farmer can row. The boat also can carry only two things, including the rower, at a time. If the wolf is ever left alone with the goat, the wolf will eat the goat; similarly if the goat is left alone with the cabbage, the goat will eat the cabbage. Devise a sequence of crossings of the river so that all four characters arrives safely on the other side of the river. • Representation • state(F, W, G, C) describes the location of Farmer, Wolf, Goat, and Cabbage • Possible locations are e for east, w for west, bank • Initial state is state(w, w, w, w) • Goal state is state(e, e, e, e) • Predicates opp(X, Y) indicates that X and y are opposite sides of the river • Facts: opp(e, w). opp( w, e). Artificial Intelligence

  20. Sample crossings for the farmer, wolf, goat, and cabbage problem. Artificial Intelligence

  21. Portion of the state space graph of the farmer, wolf, goat, and cabbage problem, including unsafe states. Artificial Intelligence

  22. Production Rules in Prolog • Unsafe states unsafe(state(X, Y, Y, C)) :- opp(X, Y). unsafe(state(X, W, Y, Y)) :- opp(X, Y). • Move rules move(state(X, X, G, C), state(Y, Y, G, C))) :- opp(X, Y), not(unsafe(state(Y, Y, G, C))), writelist([‘farms takes wolf’, Y, Y, G, C]). move(state(X, W, X, C), state(Y, W, Y, C)) :- opp(X, Y), not(unsafe(state(Y, W, Y, C))), writelist([‘farmers takes goat’, Y, W, Y,C]). move(state(X, W, G, X), state(Y, W, G, Y)) :- opp(X, Y), not(unsafe(state(Y, W, G, Y))), writelist(‘farmer takes cabbage’, Y, W, G, Y]). move(state(X, W, G, C), state(Y, W, G, C)) :-opp(X, Y), not(unsafe(state(Y, W, G, C))), writelist([‘farmer takes self’, Y, W, G, C]). move(state(F, W, G, C), state(F, W, G, C)) :- writelist([‘Backtrack from ‘, F, W, G, C]), fail. • Path rules Path(Goal, Goal, Stack) :- write(‘Solution Path Is: ‘), nl, reverse_print_stack(Stack). Path(State, Goal, Stack) :- move(State, Next), not(member_stack(Next, Stack)), stack(Next, Stack, NewStack), path(Next, Goal, NewStack), !. • Start rule Go(Start, Goal) :- empty_stack(EmptyStack), stack(Start, EmptyStack, Stack), path(Start, Goal, Stack). • Question ?- go(state(w, w, w, w), state(e, e, e, e) Artificial Intelligence

  23. Data-driven search in a production system. Artificial Intelligence

  24. Goal-driven search in a production system. Artificial Intelligence

  25. Bidirectional search missing in both directions, resulting in excessive search. Artificial Intelligence

  26. Bidirectional search meeting in the middle, eliminating much of the space examined by unidirectional search. Artificial Intelligence

  27. Major advantages of production systems for artificial intelligence • Separation of Knowledge and Control • A Natural Mapping onto State Space Search • Modularity of Production Rules • Pattern-Directed Control • Opportunities for Heuristic Control of Search • Tracing and Explanation • Language Independence • A Plausible Model of Human Problem-Solving Artificial Intelligence

  28. Blackboard architecture • Extend production systems • Separate productions into modules • Each module is an agent -- knowledge source • A single global structure -- blackboard Artificial Intelligence

More Related