1 / 31

Propositional Nets

Learn how metagaming can optimize game performance in specific matches without opponent dependency. Explore examples and benefits of propositional nets processing in game analysis and design. Discover the efficiency of propositional nets for game processing.

prudence
Download Presentation

Propositional Nets

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. General Game Playing Lecture 6 Propositional Nets Michael Genesereth Spring 2012

  2. Metagaming Metagaming is match-independent game processing, i.e. game processing that is done independent of any particular opponent or any particular state. Objective of metagaming - to optimize performance in playing specific matches of the game. Usually done offline, i.e. during the startclock or between moves or in parallel or interleaved with regular game play.

  3. Examples Boring: Headstart on Game-Graph Search Endgame book Structural: Change of Framework (e.g. state machines to propnets) Game Reformulation (e.g. game decomposition) Engineering: Compilation (machine language, fpga’s)

  4. Benefits Methods discussed so far take time proportional to the size of the game graph. Propositional nets can be processed in time proportional to the size of the game graph but with much lower coefficient. Propositional Nets can be exponentially smaller. They lend themselves to analysis and many properties can be discovered in time proportional to this smaller size instead of the size of the game graph.

  5. Games as State Machines aa ab s2 s5 s8 aa bb ab aa aa ab bb ab ab s1 s3 s6 s9 s11 ba aa ba ba ab bb bb aa aa s4 s7 s10

  6. States versus Features In many cases, worlds are best thought of in terms of features, e.g. red or green, left or right, high or low. Individual actions often affect individual features or small subsets fo features. States represent all possible ways the world can be. As such, the number of states is exponential in the number of “features” of the world, and the action tables are correspondingly large. Idea - represent features directly and describe how actions change individual features rather than entire states. (Reference: STRIPS.)

  7. Tictactoe Example cell(1,1,x) cell(1,1,x) cell(1,2,b) cell(1,2,b) cell(1,3,b) cell(1,3,o) cell(2,1,b) black cell(2,1,b) cell(2,2,o) cell(2,2,o) cell(2,3,b) mark(1,3) cell(2,3,b) cell(3,1,b) cell(3,1,b) cell(3,2,b) cell(3,2,b) cell(3,3,x) cell(3,3,x) control(black) control(white) next(cell(M,N,o)) :- does(black,mark(M,N)) & true(cell(M,N,b))

  8. Propositions s1 Decompose states into “propositions”. Benefit - n propositions can represent 2n states. p q s r

  9. Propositional Net Components Propositions Connectives Transitions p q r

  10. Propositional Net p r q

  11. Propositional Net p r q Input Proposition View Proposition Base Proposition

  12. Markings A marking for a propositional net is a function from the propositions P to boolean values. m: P  {true,false} A marking m is partial if and only if m is a partial function. Otherwise, it is total. Think of a marking as a state of a game.

  13. Acceptability A marking is acceptable if and only if it obeys the logical properties of all connectives. Negation with input x and output y: m(x)=false  m(y)=true Conjunction with inputs x and y and output z: m(x)=true  m(y)=true  m(z)=true Disjunction with inputs x and y and output z: m(x)=true  m(y)=true  m(z)=true

  14. Definitions A transition is enabled by a marking m if and only if all of its inputs are marked true. The transitional marking for m is the partial marking that assigns true to the base propositions that are outputs of transitions enabled by m and false to the outputs of all other base propositions. An input marking for a propositional net is a marking for the input propositions.

  15. Update The updatem’ of a marking m (with transitional marking t) and input marking i is any acceptable marking consistent with t and i. Algorithm for update: (1) Given m, compute enabled transitions and form a transitional marking t. (2) Take as input an input marking i. (3) Erase all marks from propnet. (4) Compute acceptable marking m’ from t and i using the rules of acceptability. Theorem: This algorithm produces exactly one update for each initial marking and input marking.

  16. Example

  17. Buttons and Lights Pressing button a toggles p. Pressing button b interchanges p and q. p q a b

  18. Propositional Net for Buttons and Lights p a q

  19. Tic-Tac-Toe X O X

  20. Partial Propositional Net for Tic-Tac-Toe b11 11o 11b b12 12o 12b b13 13o 13b

  21. Propositional Net Fragment 31x 11o 21x 21o 11x 31o 12o 22o 32x 12x 22x 32o row3o row3x row2o row1x row2x row1o 13o 13x 23o 23x 33x 33o

  22. Propositional GDL row1o :- row1x :- true(11o), true(11x), true(12o), true(12x), true(13o) true(13x) row2o :- row1x :- true(21o), true(21x), true(22o), true(22x), true(23o) true(23x) row3o :- row1x :- true(31o), true(31x), true(32o), true(32x), true(33o) true(33x)

  23. Performance ? (time (genwinnerp tttrel)) 5,478 states 130,444 milliseconds. 142,685,136 bytes of memory allocated. NIL ? (time (genwinnerp tttprop)) 5,478 states 594,555 milliseconds 117,281,008 bytes of memory allocated. NIL ? (time (propwinnerp tttprop)) 5,478 states 10,390 milliseconds. 5,900,904 bytes of memory allocated. NIL

  24. Compilation Specialized Data Structures for state e.g. Boolean propositional net 1 bit per proposition Convert rules to bit operations e.g. Relational net vector of relations Compile the Game Description into machine code subroutine to compute view prop/rel from state update routine to compute base prop/rel from state

  25. Propositional GDL (<= (next 11x) (does white mark11)) (<= (next 11x) (true 11x)) (<= (next 11o) (does black mark11)) (<= (next 11o) (true 11o)) (<= (next 11b) (true 11b) (not (does white mark11)) (not (does black mark11)))

  26. Example (defun tttinit () (vector nil nil t nil nil t nil nil t nil nil t nil nil t nil nil t nil nil t nil nil t nil nil t t nil)) (defun true11x (state) (elt state 1)) (defun true11o (state) (elt state 2)) (defun true11b (state) (elt state 3)) (defun next11x (input state) (or (does 'white 'mark11 input) (true11x state))) (defun next11o (input state) (or (does 'black 'mark11 input) (true11o state))) (defun next11b (input state) (and (true11b state) (not (does 'white 'mark11 input)) (not (does 'black 'mark11 input))))

  27. Performance ? (time (genwinnerp tttprop)) 5,478 states 594,555 milliseconds 117,281,008 bytes of memory allocated. NIL ? (time (propwinnerp tttprop)) 5,478 states 10,390 milliseconds. 5,900,904 bytes of memory allocated. ? (time (compwinnerp tttprop)) 5,478 states 855 milliseconds 3,475,432 bytes of memory allocated. NIL Compilation time: 234 milliseconds

  28. Example (defun pbvinit () #b000000000000000000) (defun x11 () #b100000000000000000) (defun true11x (state) (= (logand state #b110000000000000000) #b100000000000000000)) (defun true11o (state) (= (logand state #b110000000000000000) #b010000000000000000)) (defun true11b (state) (= (logand state #b110000000000000000) #b000000000000000000)) (defun newsimulate (input state) (logior input state))

  29. Performance ? (time (genwinnerp tttprop)) 5,478 states 594,555 milliseconds 117,281,008 bytes of memory allocated. NIL ? (time (compwinnerp tttprop)) 5,478 states 855 milliseconds 3,475,432 bytes of memory allocated. NIL ? (time (pbvwinnerp tttprop)) 5,478 states 234 milliseconds 64 bytes of memory allocated. NIL

More Related