Game Description General Game Playing Lecture 2

Slides:



Advertisements
Similar presentations
Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)
Advertisements

Query Answering for OWL-DL with Rules Boris Motik Ulrike Sattler Rudi Studer.
Models of Concurrency Manna, Pnueli.
Theory Of Automata By Dr. MM Alam
For Friday No reading Homework: –Chapter 9, exercise 4 (This is VERY short – do it while you’re running your tests) Make sure you keep variables and constants.
Answer Set Programming Overview Dr. Rogelio Dávila Pérez Profesor-Investigador División de Posgrado Universidad Autónoma de Guadalajara
Complexity 11-1 Complexity Andrei Bulatov Space Complexity.
A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines Andreas Glausch and Wolfgang Reisig 1.
A Probabilistic Framework for Information Integration and Retrieval on the Semantic Web by Livia Predoiu, Heiner Stuckenschmidt Institute of Computer Science,
CSE 636 Data Integration Datalog Rules / Programs / Negation Slides by Jeffrey D. Ullman.
© Love Ekenberg The Algorithm Concept, Big O Notation, and Program Verification Love Ekenberg.
Let remember from the previous lesson what is Knowledge representation
Introduction General Game PlayingLecture 1 Michael Genesereth Spring 2006.
Finite-State Machines with No Output
1 Knowledge Based Systems (CM0377) Lecture 4 (Last modified 5th February 2001)
Declarative vs Procedural Programming  Procedural programming requires that – the programmer tell the computer what to do. That is, how to get the output.
Steffen Staab Advanced Data Modeling 1 of 32 WeST Häufungspunkte Bifurkation: x n+1 = r x n (1-x n ) Startwert x 0 = 0,25.
Parsing Prepared by Manuel E. Bermúdez, Ph.D. Associate Professor University of Florida Programming Language Principles Lecture 3.
CSE 636 Data Integration Conjunctive Queries Containment Mappings / Canonical Databases Slides by Jeffrey D. Ullman Fall 2006.
Simultaneously Learning and Filtering Juan F. Mancilla-Caceres CS498EA - Fall 2011 Some slides from Connecting Learning and Logic, Eyal Amir 2006.
Logical Agents Chapter 7. Knowledge bases Knowledge base (KB): set of sentences in a formal language Inference: deriving new sentences from the KB. E.g.:
Mathematical Preliminaries
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
1 Knowledge Based Systems (CM0377) Lecture 6 (last modified 20th February 2002)
1 Reasoning with Infinite stable models Piero A. Bonatti presented by Axel Polleres (IJCAI 2001,
Introduction General Game PlayingLecture 1 Michael Genesereth Spring 2012.
Propositional Logic Rather than jumping right into FOL, we begin with propositional logic A logic involves: §Language (with a syntax) §Semantics §Proof.
Set Theory Concepts Set – A collection of “elements” (objects, members) denoted by upper case letters A, B, etc. elements are lower case brackets are used.
Presented by: Belgi Amir Seminar in Distributed Algorithms Designing correct concurrent algorithms Spring 2013.
Strategic Reasoning with Game Description Language Ji Ruan, Prof. W. van der Hoek, Prof. M. Wooldridge Department of Computer Science From Specific Game.
Propositional Nets General Game PlayingLecture 6 Michael Genesereth Spring 2012.
1 Datalog with negation Adapted from slides by Jeff Ullman.
Logical Agents. Outline Knowledge-based agents Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability.
1 Semester © Michael Thielscher, Michael Genesereth 2011 General Game Playing Intelligent Agents for eMarkets Prof Michael Thielscher Adjunct.
Capabilities, Minimization, and Transformation of Sequential Machines
CS510 Compiler Lecture 4.
Knowledge Representation and Reasoning
Game Description General Game Playing Lecture 3
Modeling Arithmetic, Computation, and Languages
Corky Cartwright January 18, 2017
Containment Mappings Canonical Databases Sariaya’s Algorithm
Semantics of Datalog With Negation
Subject today is General Game Playing, a new variation on an old topic in Artificial Intelligence. Playing games like chess couples intellectual activity.
Pruning Techniques General Game Playing Lecture 8
Prolog syntax + Unification
Cse 344 January 29th – Datalog.
Relational Proofs Computational Logic Lecture 8
Back to “Serious” Topics…
More Metagaming General Game Playing Lecture 7
Relational Logic Semantics
Logical Entailment Computational Logic Lecture 3
Logic Based Query Languages
Instructor: Aaron Roth
Brief Introduction to Computational Logic
Herbrand Logic Semantics
Datalog Inspired by the impedance mismatch in relational databases.
This Lecture Substitution model
Game Description General Game Playing Lecture 2
Game Reformulation General Game Playing Lecture 7
Relational Logic Semantics
Properties of Relational Logic
Properties of Relational Logic
Model Minimization Computational Logic Lecture 16
Herbrand Semantics Computational Logic Lecture 15
Representations & Reasoning Systems (RRS) (2.2)
Resolution Preliminaries
COMPILER CONSTRUCTION
Herbrand Logic Semantics
CSPA Templates for sharing services
CSPA Templates for sharing services
Presentation transcript:

Game Description General Game Playing Lecture 2 Michael Genesereth Spring 2011

Finite Deterministic Games Environment Game “world” with finitely many states One initial state and one or more terminal states Players Finite number of players Each with finitely many “percepts” and “actions” Each with one or more goal “states” Deterministic Operation Environment changes only in response to moves Synchronous and asynchronous actions Pieces are not players. Moves can be noops.

Single Player Game as a State Machine b s2 s5 s8 a a b a a b d b d s1 s3 s6 s9 b s11 a a c a c b b s7 a s4 s10 In General Game Playing, we consider finite, synchronous games. These games take place in an environment with finitely many states, with one distinguished initial state and one or more terminal states. In addition, each game has a fixed, finite number of players; each player has finitely many possible actions in any game state, and each terminal state has an associated goal value for each player. The dynamic model for general games is synchronous update: all players move on all steps (although some moves could be “no-ops”), and the environment updates only in response to the moves taken by the players. In its most abstract form, we can think of a finite, synchronous game as a state machine. Since all of the games that we are considering are finite, it is possible, in principle, to describe such games in the form of lists (of states and actions) and tables (to express legality, goals, temination, and update). Unfortunately, such explicit representations are not practical in all cases. Even though the numbers of states and actions are finite, they can be extremely large; and the tables relating them can be larger still. For example, in Chess, there are thousands of possible moves and approximately 10^30 states.

Composite Actions for Multiple Players aa ab s2 s5 s8 aa bb ab aa aa ab bb ab ab ba s1 s3 s6 s9 s11 aa ab ba ba bb bb aa aa s4 s7 s10

Problem Since all of the games that we are considering are finite, it is possible in principle to communicate game information in the form of transition graphs. Problem:Size of description. Even though everything is finite, the graphs can be large. Chess, for example, has approximately 1030 states.

Solution Different Conceptualizations: * State Machines Propositional Nets Object Nets Different Linearizations: Direct Encoding * Logical Encoding Chess, for example, has approximately 1030 states.

Game Description Language

Vocabulary Components: Object Variables: X, Y, Z Object Constants: a, b, c Function Constants: f, g, h Relation Constants: p, q, r Logical Operators: ~, &, :- Punctuation: (, ,, ) The arity of a function or relation is the number of arguments that can be supplied to the function or relation. NB: Variadic functions and relations are possible, but in our work here we fix the arity for each function and relation in advance.

Syntax Terms: Variables: X, Y, Z Object Constants: a, b, c Functional Terms: f(a), g(X,b), h(X,f(Y),c) Sentences: Atoms: p(a,b), p(a,f(a)), p(g(f(a),b),c) Negations: ~p(a,b) Rules: r(X,Y) :- p(X,Y,c) & ~q(Y)

ra(X,Y) :- a(X,Y) & ~p(X,Y) Logic Programs A logic program is a finite set of atoms and rules. Example: p(X,Y) :- f(X,Y) p(X,Y) :- m(X,Y) g(X,Z) :- p(X,Y) & p(Y,Z) a(X,Z) :- p(X,Z) a(X,Z) :- p(X,Y) & a(Y,Z) ra(X,Y) :- a(X,Y) & ~p(X,Y)

Terminology A literal is either an atom or a negation of an atom. p(a,b), ~p(a,b) Rules: subgoal … subgoal head body An expression is ground if and only if it contains no variables.

r(X,Z) :- p(X,Y) & q(Y,Z) & ~r(X,Y) Safety A rule is safe if and only if every variable in the head appears in some positive subgoal in the body. Safe Rule: r(X,Z) :- p(X,Y) & q(Y,Z) & ~r(X,Y) Unsafe Rule: r(X,Z) :- p(X,Y) & q(Y,X) r(X,Z) :- p(X,Y) & ~q(Y,Z) In GDL, we require all rules to be safe.

Dependency Graph The dependency graph for a set of rules is a directed graph in which (1) the nodes are the relations mentioned in the head and bodies of the rules and (2) there is an arc from a node p to a node q whenever p occurs with the body of a rule in which q is in the head. r(X,Y) :- p(X,Y) & q(X,Y) S(X,Y) :- r(X,Y) S(X,Z) :- r(X,Y) & t(Y,Z) t(X,Z) :- s(X,Y) & s(Y,X) A set of rules is recursive if it contains a cycle. Otherwise, it is non-recursive. t s r p q

Stratified Negation The negation in a set of rules is said to be stratified if and only if there is no recursive cycle in the dependency graph involving a negation. Negation that is not stratified: r(X,Z) :- p(X,Y,Z) r(X,Z) :- p(X,Y,Z) & ~r(Y,Z) Stratified Negation: t(X,Y) :- q(X,Y) & ~r(X,Y) r(X,Z) :- p(X,Y) r(X,Z) :- r(X,Y) & r(Y,Z) In GDL, we require that all negations be stratified.

r(X,Z) :- p(X,Y) & q(Z) & r(Y,Z) Stratified Recursion The recursion in a set of rules is said to be stratified if and only if every variable in a subgoal relation occurs in a subgoal with a relation at a lower stratum. Stratified Recursion: r(X,Z) :- p(X,Y) & q(Z) & r(Y,Z) Recursion that is not stratified: r(X,Z) :- r(X,Y) & r(Y,Z) In GDL, we require that all recursions be stratified.

Herbrand Universe The Herbrand universe for a logic program is the set of all ground terms in the language. Example 1: Object Constants: a, b Herbrand Universe: a, b Example 2: Object Constants: a Unary Function Constants: f Herbrand Universe: a, f(a), f(f(a)), …

{p(a), p(b), q(a,a), q(a,b), q(b,a), q(b,b)} Herbrand Base The Herbrand base for a logic program is the set of all ground atoms in the language. Object Constants: a, b Unary Relation Constant: p Binary Relation Constant: q Herbrand Universe: a, b Herbrand Base: {p(a), p(b), q(a,a), q(a,b), q(b,a), q(b,b)}

Herbrand Interpretations An interpretation for a logic program is an arbitrary subset of the Herbrand base for the program. Herbrand Base: {p(a), p(b), q(a,a), q(a,b), q(b,a), q(b,b)} Interpretation 1: {p(a), q(a,b), q(b,a)} Interpretation 2: Interpretation 3: {}

Herbrand Models A n interpretation  satisfies a ground sentence (i.e. it is a model) under the following conditions:  satisfies an atom  iff .  satisfies ~ iff  does not satisfy .  satisfies 1 & … & n iff  satisfies every i.  satisfies 2 :- 1 iff  satisfies 2 whenever it satisfies 1. An interpretation satisfies a non-ground sentence if and only if it satisfies every ground instance of that sentence.

Multiple Models In general, a logic program can have more than one model. Logic Program: {p(a,b), q(X,Y):-p(X,Y)} Model 1: {p(a,b), q(a,b)} Model 2: {p(a,b), q(a,b), q(b,a)}

Minimality To eliminate ambiguity, we adopt a minimal model semantics. A model D is a minimal model of a program O iff no proper subset of D is a model of O. Logic Program: {p(a,b), q(X,Y):-p(X,Y)} Good Model 1: {p(a,b), q(a,b)} Bad Model 2: {p(a,b), q(a,b), q(b,a)} Theorem: Given our various restrictions, every logic program has a unique minimal model. Therefore, unambiguous answers. Also, all models are finite!

Open versus Closed Logic Programs Logic programs as just defined are closed in that they fix the meaning of all relations. In open logic programs, some of the relations are given as inputs (rather than being defined) and other relations are produced as outputs (defined in terms of the inputs). In other words, open logic programs can be used with different input datasets to produce different output datasets.

Open Logic Programs An open logic program is a logic program together with a partition of the relations into two types - base relations (the inputs) and view relations (the defined relations). View relations can appear anywhere in the program, while base relations can appear only in the bodies of rules (never in the heads of rules).

Inputs and Outputs An overall model of an open logic program O with an input model D is is the minimal model of OD. The output of an open logic program for input D is the subset of the overall model of O and D that mentions only output relations.

Example Base Relations: p, q View Relations: r Rules: {r(X,Y) :- p(X,Y) & ~q(Y)} Input 1: {p(a,b), p(b,b), q(b)} Output 1: {r(a,b)} Input 2: {p(a,b), p(b,b)} Output 2: {r(a,b), r(b,b)}

GDL

Relevance to GDL A GDL description is an open logic program in which we treat does and true as inputs. For each choice of inputs, the description tells us init, legal, next, goal, and terminal. Upshot is that each GDL program corresponds to one and only one state machine. Initial state is the state in which all init facts are true. Initial legal actions are defined in terms of this state. Given initial facts and choice of legal actions, next tells us what is true in the next state. And so forth.

Game-Independent Vocabulary Object Constants: 0, 1, 2, 3, … , 100 - numbers Relation Constants: role(player) proposition(proposition) action(action) init(proposition) true(proposition) next(proposition) legal(player,action) does(player,action) goal(proposition) terminal

Game-Specific Vocabulary Object constants: white, black - players x, o, b - marks Function Constants: mark(number,number) --> action cell(number,number,mark) --> proposition control(player) --> proposition RelationConstants: row(number,player) column(number,player) diagonal(player) line(player) open

No Built-in Assumptions What we see: next(cell(M,N,x)) :- does(white,mark(M,N)) & true(cell(M,N,b)) What the player sees: next(welcoul(M,N,himenoing)) :- does(himenoing,dukepse(M,N)) & true(welcoul(M,N,lorenchise))

Tic-Tac-Toe X O

State Representation X O cell(1,1,x) cell(1,2,b) cell(1,3,b) cell(2,2,o) cell(2,3,b) cell(3,1,b) cell(3,2,b) cell(3,3,x) control(black) X O

Initial State init(cell(1,1,b)) init(cell(1,2,b)) init(cell(1,3,b)) init(control(x))

Legality Conclusions: legal(W,mark(X,Y)) :- cell(1,1,x) true(cell(X,Y,b))  cell(1,2,b) true(control(W)) cell(1,3,b) cell(2,1,b) legal(white,noop) :- cell(2,2,o) true(cell(X,Y,b))  cell(2,3,b) true(control(black)) cell(3,1,b) cell(3,2,b) legal(black,noop) :- cell(3,3,x) true(cell(X,Y,b))  control(black) true(control(white)) Conclusions: legal(white,noop) legal(black,mark(1,2)) … legal(black,mark(3,2))

Physics 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))

Physics next(cell(M,N,x)) :- does(white,mark(M,N)) next(cell(M,N,o)) :- does(black,mark(M,N)) next(cell(M,N,Z)) :- does(W,mark(M,N)) & true(cell(M,N,Z)) & Z#b next(cell(M,N,b)) :- does(W,mark(J,K)) & true(cell(M,N,b)) & (M#J | N#K) next(control(white)) :- true(control(black)) next(control(black)) :- true(control(white))

Supporting Concepts row(M,W) :- diagonal(W) :- true(cell(M,1,W)) & true(cell(1,1,W)) & true(cell(M,2,W)) & true(cell(2,2,W)) & true(cell(M,3,W)) true(cell(3,3,W)) column(N,W) :- diagonal(W) :- true(cell(1,N,W)) & true(cell(1,3,W)) & true(cell(2,N,W)) & true(cell(2,2,W)) & true(cell(3,N,W)) true(cell(3,1,W)) line(W) :- row(M,W) line(W) :- column(N,W) line(W) :- diagonal(W) open :- true(cell(M,N,b))

Goals and Termination goal(white,100) :- line(x) goal(white,50) :- ~line(x) & ~line(o) goal(white,0) :- line(o) goal(black,100) :- line(o) goal(black,50) :- ~line(x) & ~line(o) goal(black,0) :- line(x) terminal :- line(W) terminal :- ~open

Roles role(white) role(black)

GGP Details

Knowledge Interchange Format Knowledge Interchange Format is a standard for programmatic exchange of knowledge represented in relational logic. Syntax is prefix version of standard syntax. Operators are renamed. Case-independent. Variables are prefixed with ?. r(X,Y) :- p(X,Y) & ~q(Y) (<= (r ?x ?y) (and (p ?x ?y) (not (q ?y)))) (<= (r ?x ?y) (p ?x ?y) (not (q ?y))) Semantics is the same.

Agent Communication Language Start Message (start id role (s1 … sn) startclock playclock) Play Message (play id (a1 ... ak)) Stop Message (stop id (a1 ... ak))

Completeness Of necessity, game descriptions are logically incomplete in that they do not uniquely specify the moves of the players. Every game description contains complete definitions for legality, termination, goalhood, and update in terms of the primitive moves and the does relation. The upshot is that in every state every player can determine legality, termination, goalhood and, given a joint move, can update the state.

Playability A game is playable if and only if every player has at least one legal move in every non-terminal state. Note that in chess, if a player cannot move, it is a stalemate. Fortunately, this is a terminal state. In GGP, we guarantee that every game is playable.

Winnability A game is strongly winnable if and only if, for some player, there is a sequence of individual moves of that player that leads to a terminating goal state for that player. A game is weakly winnable if and only if, for every player, there is a sequence of joint moves of the players that leads to a terminating goal state for that player. In GGP, every game is weakly winnable, and all single player games are strongly winnable.