# Search, complex states & virtual worlds. state descriptions.

## Presentation on theme: "Search, complex states & virtual worlds. state descriptions."— Presentation transcript:

search, complex states & virtual worlds

state descriptions

using sets of tuples... (relation object value)

state descriptions (defvar blocks '((isa b1 block) (isa b2 block) (isa p1 pyramid) (on p1 b1) (on b1 floor) (on b2 floor) (cleartop p1) (cleartop b2) (cleartop floor) (holds nil))) using sets of tuples... (relation object value)

state transformation pickup ?x

state transformation (isa b1 block) (isa b2 block) (isa p1 pyramid) (holds p1) (on b1 floor) (on b2 floor) (cleartop b1) (cleartop b2) (cleartop p1) (cleartop floor) (isa b1 block) (isa b2 block) (isa p1 pyramid) (on p1 b1) (on b1 floor) (on b2 floor) (cleartop p1) (cleartop b2) (cleartop floor) (holds nil)

state transformation pickup ?x (pre(holds nil)(cleartop ?x)(on ?x ?y)) (del(holds nil)(on ?x ?y)) (add(holds ?x)(cleartop ?y))

operator application operator specification results

operator application operator specification (pickup ?x) results p1  ?x

operator application operator specification (pickup ?x) pre (holds nil) (cleartop ?x) (on ?x ?y) results p1  ?x ok, b1  ?y

operator application operator specification (pickup ?x) pre (holds nil) (cleartop ?x) (on ?x ?y) del (holds nil) (on ?x ?y) results p1  ?x ok, b1  ?y blocks  (isa b1 block)(isa b2 block)(isa p1 pyramid) (on b1 floor) (on b2 floor) (cleartop p1) (cleartop b2)(cleartop floor)

operator application operator specification (pickup ?x) pre (holds nil) (cleartop ?x) (on ?x ?y) del (holds nil) (on ?x ?y) add (holds ?x) (cleartop ?y) results p1  ?x ok, b1  ?y blocks  (isa b1 block)(isa b2 block)(isa p1 pyramid) (on b1 floor) (on b2 floor) (cleartop p1) (cleartop b2)(cleartop floor) blocks  (isa b1 block)(isa b2 block)(isa p1 pyramid) (holds p1)(on b1 floor)(on b2 floor) (cleartop p1)(cleartop b2)(cleartop p1) (cleartop floor)

an example (page 1) (defparameter *ops* '((pick-up (pre. ((holding nil) (cleartop ?x) (supports ?y ?x))) (del. ((holding nil) (supports ?y ?x))) (add. ((holding ?x) (cleartop ?y))) ) (drop-on (pre. ((holding ?obj) (cleartop ?x))) (del. ((holding ?obj) (cleartop ?x))) (add. ((holding nil) (supports ?x ?obj))) ))) (defun apply-op (op object world) (all-present ((-> op 'pre) world `((x,object))) (\$+ (match-bind (-> op 'add)) (\$- world (match-bind (-> op 'del)))) )) > (apply-op (-> *ops* 'pick-up) 'p1 state3)  ((cleartop b1) (holds p1) (cleartop floor) (cleartop b2) (cleartop p1) (on b2 floor) (on b1 floor) (isa p1 pyramid)...)

an example (page 2) (defun arm-control (world commands) (match commands over '(?op ?obj) doing (format t "~2&Applying ~a with ~a..." #?op #?obj) (setf world (apply-op (-> ops #?op) #?obj world)) (format t "ok~%") (pprint world) )) > (arm-control blocks '((pick-up p1) (drop-on b2)))  Applying (PICK-UP P1)...ok  ((CLEARTOP B1) (HOLDS P1) (CLEARTOP FLOOR) (CLEARTOP B2) (CLEARTOP P1) (SUPPORTS FLOOR B2) (SUPPORTS FLOOR B1) (ISA P1 PYRAMID) (ISA B2 BLOCK) (ISA B1 BLOCK))  Applying (DROP-ON B2)...ok  ((SUPPORTS B2 P1) (HOLDS NIL) (ISA B1 BLOCK) (ISA B2 BLOCK) (ISA P1 PYRAMID) (SUPPORTS FLOOR B1) (SUPPORTS FLOOR B2) (CLEARTOP P1) (CLEARTOP FLOOR) (CLEARTOP B1))

problems? goal:stack all targets in bottom left corner

GPS - example ops (pickup (use (pickup ?x)) (pre (at R ?p) (at ?x ?p) (holds R nil)) (add (holds R ?x)) (del (at ?x ?p) (holds R nil)) ) (drop (use (drop ?x)) (pre (at R ?p) (holds R ?x)) (add (at ?x ?p) (holds R nil)) (del (holds R ?x)) ) (move (use (moveto ?p2)) (pre (at R ?p1) (isa ?p2 place)) (add (at R ?p2)) (del (at R ?p1)) )

means-end analysis goal directed measures difference between start & goal breaks problem into smaller sub-problems finds suitable operators notes measuring difference not trivial differences prioritised

difference between Kn fragments important but can get complex underpins planning some learning (later) IQ tests (later) automatic rule generation (later) etc, etc, etc (later)