• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
State Space Search(2)
 

State Space Search(2)

on

  • 3,671 views

Descripcion de espacios de estados

Descripcion de espacios de estados

Statistics

Views

Total Views
3,671
Views on SlideShare
3,667
Embed Views
4

Actions

Likes
0
Downloads
49
Comments
0

1 Embed 4

http://www.slideshare.net 4

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    State Space Search(2) State Space Search(2) Presentation Transcript

    • State Space Search • Readings: Rich and Knight: Sect 2.1
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    • Train Problem • State Representation: A Lisp atom: the current city • Initial State (define *start-state* 'sacramento) • Goal State (define *goal-state* 'austin.texas) (define (solution-state? s) (eqv? s *goal-state*)) • Operators (50) – Go from neighboring capitals to each capital (define *state-operators* (list goto-atlanta goto-montgomery goto-juneau goto-phoenix goto-sacramento goto-santa-fe goto-austin)) (define (goto-montgomery state) (if (member state '(juneau atlanta)) 'montgomery #f))
    • Farmer Wolf Goat and Cabbage problem A problem description consists of ;;;1. A structure to represent the state description: jug-contents A fixed sized data structure comprised of a number of fields • (defstruct name field-1 field-2 ... fieldn) defines a structure (defstruct side farmer wolf goat cabbage) => side ;;;2. A list of operators: *jug-problem-operators* ;;; These functions define legal moves in the state space (define *farmer-wolf-goat-cabbage-operators* '(farmer-takes-self farmer-takes-wolf farmer-takes-goat farmer-takes-cabbage)) ;;;3. A definition of each operator: ;;; An operator is a scheme function, that given a state description, returns a new ;;; state description (Or null if the operator can't be applied) (define (farmer-takes-self state) (safe (make-side 'farmer (opposite (side.farmer state)) 'wolf (side.wolf state) 'goat (side.goat state) 'cabbage (side.cabbage state))))
    • A particular problem requires ;;;.1. A start state (define *start-state* (make-side 'farmer 'east 'wolf 'east 'goat 'east 'cabbage 'east)) ;;;2. A function to determine whether a state is the goal state. ;;; By covention, we'll call this (solution-state? x) (define (solution-state? state) ;;"A state description is the solution if the everything is on the west" (and (eqv? 'west (side.farmer state)) (eqv? 'west (side.wolf state)) (eqv? 'west (side.goat state)) (eqv? 'west (side.cabbage state))))
    • Water Jug Problem State Representation • State Representation (defstruct jug-contents four three) • Initial State (define *start-state* (make-jug-contents 'three 0 'four 0)) • Goal State ;;A state description is the solution if the four galloon jug has 2 gallons in it" (define (solution-state? state) (= 2 (jug-contents.four state))) • A list of operators (define *jug-problem-operators* '(fill-four fill-three dump-four dump-three fill-four-from-three fill-three-from-four empty-three-into-four empty-four-into-three))
    • • Operator 1 (define (fill-four state) (when (< (jug-contents.four state) 4) (make-jug-contents 'three (jug-contents.three state) 'four 4)))
    • Applying the operators
      • ? *start-state*
      • #S(JUG-CONTENTS :FOUR 0 :THREE 0)
      • ? (fill-four *start-state*)
      • #S(JUG-CONTENTS :FOUR 4 :THREE 0)
      • ? (fill-three-from-four (fill-four *start-state*))
      • #S(JUG-CONTENTS :FOUR 1 :THREE 3)
      • ? (fill-three-from-four
      • (fill-four
      • (empty-four-into-three
      • (dump-three
      • (fill-three-from-four
      • (fill-four *start-state*))))))
      • #S(JUG-CONTENTS :FOUR 2 :THREE 3)
      • ? (solution-state? (fill-three-from-four
      • (fill-four
      • (empty-four-into-three
      • (dump-three
      • (fill-three-from-four
      • (fill-four *start-state*)
      • ))))))