Presentation is loading. Please wait.

Presentation is loading. Please wait.

Formal Semantics for an Abstract Agent Programming Language K.V. Hindriks, Ch. Mayer et al. Lecture Notes In Computer Science, Vol. 1365, 1997

Similar presentations


Presentation on theme: "Formal Semantics for an Abstract Agent Programming Language K.V. Hindriks, Ch. Mayer et al. Lecture Notes In Computer Science, Vol. 1365, 1997"— Presentation transcript:

1 Formal Semantics for an Abstract Agent Programming Language K.V. Hindriks, Ch. Mayer et al. Lecture Notes In Computer Science, Vol. 1365, M1. Nguyen Tuan Duc

2 Source Formal Semantics for an Abstract Agent Programming Language Authors: K.V.Hindriks, F.S. de Boer, W. van der Hock, J.Ch. Mayer (Dept. of Computer Science, Utrecht Univ., the Netherlands) Lecture Notes In Computer Science; Vol. 1365, 1997, pp 215 – 229 Proceedings of the 4th International Workshop on Intelligent Agents IV, Agent Theories, Architectures, and Languages

3 1.Introduction There exist many agent programming languages  AGENT-0, AgentSpeak(L)  Lack a clear and formally defined semantics, difficult to formalize the design, specification and verification Need for an agent programming model based on existing programming concepts  Logic programming, imperative programming  Operational semantics

4 Agenda Introduction Programming BDI-agents Abstract agent programming language Operational semantics Comparison with existing APLs Conclusions

5 2.Programming BDI-agents BDI-agents: agents have  Explicit goals (Desires)  A set of plans to achieve a goal (Intensions)  Information about the environment (Belief)  Based on Human practical reasoning theory (Michael Bratman) Many agent programming languages (APLs) based on this model  AGENT-0, AgentSpeak(L), … However, APL is still disconnected from theory

6 Characteristics of BDI-agents Complex internal mental state changes over time  Beliefs, Desires, Plans, Intentions Pro-active and reactive  Goal-directed (proactive)  Respond to changes in environment in a timely manner (reactive) Reflective  Meta-level reasoning capabilities (e.g. goal revision) Agent = goal-directed, belief-transforming entity

7 Requirement for APL Theoretically, APL must have features for  Belief updating (for newly observed, communicated data, …)  Goal updating (for goal revision)  Practical reasoning (for finding the means to achieve a goal) Practically, APL should contain all the familiar constructs from imperative programming  Sequential composition, tests, parallel execution, etc.

8 3. An abstract agent programming language (3APL) An APL provides mechanism for  Belief updating  Goal updating (goal revision)  Practical reasoning (rule / plan to achieve a goal)

9 Belief Beliefs are represented as First-order logic formulae from a language L. P, F, C, A  P: set of predicate symbols  F: set of function symbols  C: set of constant  A: set of action symbols (not used in Belief) Basic elements of L are given by a signature (Σ)  Σ =  Term T ::= x | f(t, t,..., t) (x ∈ TVar, variable; f ∈ F)  Formulae B::= P(t, t,..., t) | not B | B ∧ B | B ∨ B | ∃ x.P(x)  At = the set of atoms ( constants, primitive predicates, …)

10 Example 1: robot Greedy Robot & Diamond  Diamond may randomly appear / disappear  Rocks are obstacles Basic predicates  diam( d, x, y ) : diamond d at (x, y)  robot( r, x, y ): robot r at (x, y)  rock( x, y ) : rock at (x, y) Basic functions  xc( x, y ) = x of nearest diamond from (x, y)  yc( x, y ) Perfect knowledge

11 Goals and actions Goal: set of objectives agent tries to achieve  Goal to do some action  Goal to achieve some state of affairs Signature Σ=, Gvar: global variables, set of goal L g  A ⊆ L g (basic actions)  At ⊆ L g  Φ ∈ L ⇒ φ? ∈ L g  Gvar ⊆ L g  π1, π2 ⊆ L g ⇒ π1; π2, π1 + π2, π1 || π2 ∈ L g Rule for composition of goal Basic goals: basic actions, achievement goals (P(t) ∈ At), test goal (φ?) Basic actions are update operators on belief base  pickup( Greedy, d ) ⇒ delete diam( d, x, y ) from σ (belief base)

12 Goal variables The language contains variables range over Goals  Reflective reasoning  Communication (parameter passing) Receive request to establish some goal in a goal variable

13 Example 2: Actions and goal of Greedy west, east, north, south: move a step pickup( r, d ) : robot r pickup diamond d Goal: max_diam  User defined predicate  Usually given in a procedure definition

14 Practical reasoning rules To achieve its goals, agent has to  Find the means for achieving them  Revise its goal (in case of failure…) ⇒ Practical reasoning Practical reasoning rules L p  φ ∈ L, π,π’ ∈ L g ⇒ π ← φ| π’ ∈ L p  π: head of the rule  π’: body of the rule  φ: guard  Global variables of the rule = Free variables in π  Local variables = variables in the rule except global one Practical reasoning rule (PR) serves two functions  Mean, recipe to achieve a goal (plan rule)  Goal revision -Φrepresents condition to apply the rule - Or used to retrieve data from B (by unifying predicates)

15 Plan rules: procedural knowledge Plan rules: rules with head is a basic goal P(t)  P(t) may be viewed as procedure calls to plans to achieve the goal Plan rules encode procedural knowledge of an agent

16 Example 3: plan rules max_diam ← robot( Greedy, x0, y0 ) ∧ x = xc( x0, y0 ) ∧ y = yc( x0, y0 ) | robot( Greedy, x, y ); diam( z, x, y )?; pickup( Greedy, z ); max_diam  Implementing greedy algorithm: repeat the following action: go to nearest diamond, take it

17 max_diam x0 = 0, y0 = 0 x = 1, y = 1 robot(Greedy, 1, 1) diam(z, 1, 1)? pickup(Greedy, z) x0 = 1, y0 = 1 x = 3, y = 2 robot(Greedy, 3, 2) diam(z, 3, 2)? pickup(Greedy, z)

18 robot( r, x, y ) robot( r, x, y ) ← robot( r, x0, y0 ) | (x = x0 ∧ y = y0 )? + [(x y0)? south + (y0 > y)? north]; robot( r, x, y)  robot( r, x0, y0 ) : to retrieve current position  robot( r, x, y ) (in body): sub-goal

19 Revision of goals: reflective rules Rules with head contains an arbitrary programs (including goal variables) Goal revise in case  Found a more optimal strategy  Failure

20 Example 4: More optimal strategy Diamond suddenly appeared as nearer position X; robot( r, x, y ) ← robot( r, x0, y0 ) ∧ not( x = xc( x0, y0 ) ∧ y = yc(x0, y0) ) | robot( r, xc( x0, y0 ), yc( x0, y0) )

21 Example 5: Failure rock as (x0-1, y0) west; robot( r, x, y ) ← robot( r, x0, y0 ) ∧ rock( x0 – 1, y0 ) | [(y<=y0)?; north + (y0 <= y)?; south]; robot( r, x, y )

22 Three levels of agent programming Action Goal execution Goal revision (self-modifying program)

23 Agent programs Agent = goal directed, belief transforming entity Beliefs are updated by Actions Goals are updated by execution and revision An agent changes its beliefs and goals (PR and basic actions are fixed)

24 Mental state Mental state =, where  Π ∈ L g is a goal base (set of goals)  σ ∈ L is a belief base (set of beliefs)  Thus, the changing components in previous slide  Denote: B: set of belief bases, Γ: PR-base The behavior of an agent is fully specified if  The semantics of basic actions is given  The mechanism for executing goals and applying rules are defined

25 Some definitions Free vs. bounded variables  P(x, d) ∧∃ x. Q(y, x) ∧ ∀ z. G(a, b, z)  Alpha conversion: P(x, d) ∧∃ x1. Q(y, x1) ∧∀ z. G(a,b,z) Free(e) = { x | x is free in e } Substitution: [x/5] f(x) ≡ f(5) Unifier: if t1, t2, … are terms then unifier of t1, t2,…, tn is a substitution θsuch that θ(t1) ≡ θ(t2) ≡…≡θ(tn) Ex: f(x, x) and f(y, z) ⇒ θ = [x/z, y/z] Most general unifier (MGU) ξ  ∀ θ ∈ unifier 、∃ ψ: θ = ψξ  In the above example: [x/c, y/c] = [z/c][x/z, y/z]

26 Basic action transitions Semantics of basic actions A is given by a transition function T: B x B → P(A)  P(A) is variant of A  If a ∈ T(σ,σ’) then denoted by a west; pickup(Greedy, d) By observing the environment, agent knows action has succeeded or failed

27 Agent program An agent program is a quadruple  T : a basic transition function (specifying the effect of basic actions)  Π0 : initial goal base  σ0 : initial belief base  Γ : PR-base Thus, to program an agent is to  specify its initial mental state  define semantics of basic actions  write a set of PR

28 Example 6: Agent program for Greedy Basic actions:  west;  north, south, east  pickup(Greedy, d) Π0 = {max_diam} σ0 = { robot(Greedy, 0, 0), rock(1,5), rock(3,3), rock(2,1), diam(d, 2, 2) } PR-base in example 4, 5

29 4. Operational semantics Operational semantics  Specify how a program can transform the system state A transition system is a deductive system which allows to derive the transition of a program.  Transition rules specify the meaning of each programming construct.  Transition rules transform configuration In APL, configuration is mental state

30 4.1. Practical reasoning rule V = set of global variables in goal base PR-rule application π’ ← φ| π’’ ∈ ’ Γ ∧ σ|= ∀ (φθγ) ____________________________________ V → θγ  Where, θ(π’) = θ(π), π ∈ Π A ∈ ’ Γmeans A is a variant of a PR-rule (alpha conversion) γis a substitution such that no variable x: γ(x) ∈ V (retrieves parameter values from σ) ⇒ Perform alpha-conversion to avoid interference of local and global parameters → followed by θγ to record the substitution process

31 Example 7: goal revision Suppose that Π = {east; robot( Greedy, 3, 2 )}, σ = {robot(Greedy, 0, 0), diam(d’, 3, 2), diam(d,2,2) } Apply rule: X; robot( r, x, y ) ← robot( r, x0, y0 ) ∧ not( x = xc( x0, y0 ) ∧ y = yc(x0, y0) ) | robot( r, xc( x0, y0 ), yc( x0, y0) ) θ = { X/east, r/Greedy, x/3, y/2 } ⇒ φθ≡ robot(Greedy, x0, y0) ∧ not( 3 = xc(x0, y0) ∧ 2 = yc(x0, y0) ) γ= {x0/0, y0/0} π’’θγ ≡ robot(Greedy, xc(0, 0), yc(0, 0)) ≡ robot(Greedy, 2, 2)

32 4.2. Execution rules E denotes termination  E ; π ≡ π  E + π ≡ π  …. Execution rule 1: basic actions a ____________________________ V → Φ  Φ is an identity substitution  Thus, basic action means changing the state according to transition function and stop execution

33 First-order tests Check if some condition follows from σ σ |= ∀ (φθ) ____________________ V → θ Ex: diam(z, x, y)?; pickup(Greedy, z)  θ = {z/d, x/2, y/2}  After first-order test, goal becomes pickup(Greedy, d)

34 Sequential composition V → θ ________________________________ V → θ Ex: in previous slide:  π1 = diam(z, x, y)?, π’1 = E  θ = {z/d, x/2, y/2}  π2 = pickup(Greedy, z)  π1;π2θ ≡ E; pickup(Greedy, d) ≡ pickup(Greedy, d)

35 Non-deterministic choice V → θ _____________________________ V → θ _____________________________ V → θ

36 Parallel composition V → θ ____________________________________ V → θ (similar rule for π2)

37 Goal execution Let Π = {π 0, …, π i, π i+1, …} ⊆ L g, V = Free(Π) Goal execution V → θ __________________________________________________ V →  There is no θ in the consequence  This is because the mental state is the top level of execution. At this level, various goal are executed in a parallel fashion without communication

38 Computations of an agent program A computation of an agent program is a finite or infinite sequence of configurations,,, … such that, for each i: →

39 5. Comparison with existing APLs AGENT-0:  Only executes basic, primitive actions or skills of agent  Goal revision is restricted to removing infeasible commitments and uses built-in mechanism 3APL allows much more general revision rule AgentSpeak(L):  Quite similar to the proposed language  3APL provides more general and high-level programming construct then AgentSpeak(L)

40 6. Conclusions A transition system is a suitable formalism for specifying the operational semantics of APL An abstract APL is proposed  Includes all the regular programming constructs from imperative programming and logic-programming Future work  Extensions to multi-agent systems with communication  Mechanism for failure recovery  Apply notions of standard concurrency theory (π-calculus)  …


Download ppt "Formal Semantics for an Abstract Agent Programming Language K.V. Hindriks, Ch. Mayer et al. Lecture Notes In Computer Science, Vol. 1365, 1997"

Similar presentations


Ads by Google