140 likes | 219 Views
Artificial Intelligence as Representation and Search. Representation. The purpose of representation is to abstract out the problem features which are non-essential to solving the problem and to capture those features which are essential.
E N D
Representation • The purpose of representation is to abstract out the problem features which are non-essential to solving the problem and to capture those features which are essential. • An example is “blocks worlds” where the problem is to construct a sequence of actions for a robot arm to transform the initial arrangement of blocks into a goal arrangement. • Essential Features • Which blocks are on top of which blocks • Which blocks are clear • Which blocks are on table
Blocks World Representations • Predicate Calculus • Predicates : Clear(a), Ontable(a), On(b,a) • Rules : X ¬Y on(Y,X) Clear(X) • Arrays or Strings • Stack : ABC • State Space Graph • Graph with 3 blocks • Start and Goal states
Natural Language UnderstandingSemantic Net Representation vertebrate isa flies bird feathers property covering isa bluebird small blue size color
Blocks World Search Find path from Start State to Goal State
Semantic Net Searchfind attributes of specified object – CLIPS implementation
Semantic Net Searchfind attributes of specified object – CLIPS implementation
BFS Semantic Net • (deftemplate concept (slot cid) (slot name) (slot depth)) • (deftemplate link (slot start) (slot end) (slot linkName)) • (deffacts snet • (concept (cid 1) (name bluebird) (depth -1)) • (concept (cid 2) (name small) (depth -1)) • (concept (cid 3) (name blue) (depth -1)) • (concept (cid 4) (name feathers) (depth -1)) • (concept (cid 5) (name bird) (depth -1)) • (concept (cid 6) (name flies) (depth -1)) • (concept (cid 7) (name vertebrate) (depth -1)) • (link (start 1) (end 2) (linkName size)) • (link (start 1) (end 3) (linkName color)) • (link (start 1) (end 5) (linkName isa)) • (link (start 5) (end 4) (linkName covering)) • (link (start 5) (end 6) (linkName property)) • (link (start 5) (end 7) (linkName isa)) • ) • (defrule initsearch • (concept (cid 1) (name ?n) (depth -1)) • => • (assert (concept (cid 1) (name ?n) (depth 0)) ) • ) • (defrule search • (concept (cid ?s) (name ?n) (depth ?d)) • (test (> ?d -1)) • (concept (cid ?e) (name ?m) (depth -1)) • (link (start ?s) (end ?e) (linkName ?x)) • => • (bind ?dep (+ ?d 1)) • (assert (concept (cid ?e) (name ?m) (depth ?dep))) • (printout t "Name : " ?m " , relation: " ?x " , depth : " ?dep crlf) • )
BFS Semantic Net • CLIPS (V6.20 03/31/02) • CLIPS> (load SemanticNet2.txt) • Defining deftemplate: concept • Defining deftemplate: link • Defining deffacts: snet • Defining defrule: initsearch +j • Defining defrule: search +j+j+j • TRUE • CLIPS> (reset) • CLIPS> (run) • Name : bird , relation: isa , depth : 1 • Name : vertebrate , relation: isa , depth : 2 • Name : flies , relation: property , depth : 2 • Name : feathers , relation: covering , depth : 2 • Name : blue , relation: color , depth : 1 • Name : small , relation: size , depth : 1 • CLIPS>
Tic Tac Toe Search If Start then Mark Center Else Find Row, Column or Diagonal which is a win for Player and Mark Else Find Row, Column or Diagonal which is a win for opponent and Mark Else Construct a Fork if possible .. Etc.