1 / 24

JACK Agent Language

JACK Agent Language. JAL. Main Concepts. Agent Event Plan Database Capability Class Interface. JACK Programming Style. plan ExamplePlan extends Plan { … # sends event MogulEvent msg ; … body () { @ send (“Mogul”, msg . hello (3,true));

kevin-blake
Download Presentation

JACK Agent Language

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. JACK Agent Language JAL

  2. Main Concepts • Agent • Event • Plan • Database • Capability • Class • Interface

  3. JACK Programming Style planExamplePlan extends Plan { … #sends eventMogulEventmsg; … body() { @send(“Mogul”,msg.hello(3,true)); if (@subtask( …)) @send( … ); } JACK keywords Java

  4. event plan database JACK Programming Concepts event agent plan database capability “has” “uses”

  5. Programming Elements plan EvaluateBid extends Plan { event RequestBid extends MessageEvent { capability Bidder extends Capability { capability Client extends Capability { agent ClientBidder extends Agent { #has capability Client t; #has capability Bidder b; … }

  6. Declarations for Agents • #private database <Type> <ref> ( <args> ) ; • #agent database <Type> <ref> ( <args> ) ; • #shared database <Type> <ref> ( <args> ) ; • #private data <Type> <ref> ( <args> ) ; • #agent data <Type> <ref> ( <args> ) ; • #shared data <Type> <ref> ( <args> ) ; • #handles event <Type> ; • #sends event <Type> { <ref> } ; • #posts event <Type> { <ref> } ; • #uses plan <Type> ; • #has capability <Type> <ref> ; • #uses taskManager <Type> ( <arg> ) ; • aos.jack.jak.agent.Agent • constructor and other methods

  7. Belief Structure Declarations • Declares JACK databases and other data objects that are to be used in plans. • private = each agent instance operates its own data • agent = agents of same type (in a core image) share the data • shared = all agents (in a core image) share the data • #private database <Type> <ref> ( <args> ) ; • #private data <Type> <ref> ( <args> ) ; • #agent database <Type> <ref> ( <args> ) ; • #agent data <Type> <ref> ( <args> ) ; • #shared database <Type> <ref> ( <args> ) ; • #shared data <Type> <ref> ( <args> ) ;

  8. Behaviour Declarations • Declares which events the agent handles, sends and posts (at “top level”) • #handles event <Type> ; • #sends event <Type> { <ref> } ; • #posts event <Type> { <ref> } ; • Declares which plans the agent uses (at “top level”) • #uses plan <Type> ;

  9. Other Declarations • Declares which capabilities the agent has (at “top level”) • #has capability <Type> <ref> ; • Declares which task scheduling policy the agent uses • #uses taskManager <Type> ( <arg> ) ; • Declares its identity etc. • constructor method • other methods • Base class • aos.jack.jak.agent.Agent

  10. Declarations for Events • data members • #posted as <name> ( <pars> ) <body> • #set behavior <Attr> <value> ; • #use behavior <Type> ( <arg> ) ; • aos.jack.jak.event.* • Event • MessageEvent, TracedMessageEvent • BDIGoalEvent, BDIFactEvent • BDIMessageEvent, BDITracedMessageEvent • PlanChoice • other methods

  11. Event Occurrences • Declares the polymorphic range through data members • data members • Events are constructed via their posting methods called on sentinels • #posted as <name> ( <pars> ) <body> • Base type define event handling behaviour • Event • MessageEvent, TracedMessageEvent • BDIGoalEvent, BDIFactEvent • BDIMessageEvent, BDITracedMessageEvent • PlanChoice • BDI* events can be varied in behaviour details • #set behavior <Attr> <value> ; • #use behavior <Type> ( <arg> ) ;

  12. Declarations for Plans • #handles event <Type> <ref> ; • #chooses for event <Type> ... ; • #reads database <Type> <ref> ; • #modifies database <Type> <ref> ; • #posts event <Type> <ref> ; • #sends event <Type> <ref> ; • #uses interface <Type> <ref> ; • #uses agent implementing <Type> <ref> ; • #reasoning method <name> ( <pars> ) <body>

  13. Special for Plans • static boolean relevant( .. ) .. • context() .. • body() • #reasoning method pass( ) <body> • #reasoning method fail( ) <body> • logical variables • aos.jack.jak.plan.PlanInstanceInfo getInstanceInfo() • aos.jack.jak.logic.Signature • aos.jack.jak.plan.Plan

  14. BDI* Plan Selection • Plan type relevance • “#handles event ..” for potential relevance • “relevant(..)” method for actual relevance • Plan instance generation • “context()” query for alternative plan level logical variable bindings • the Signature of a plan instance • Plan instance selection • order as mentioned in agent or its capabilities • “getInstanceInfo().rank()” • PlanChoice handling

  15. Declarations • Events posted and sent • #posts event <Type> <ref> ; • #sends event <Type> <ref> ; • JACK databases used • #reads database <Type> <ref> ; • #modifies database <Type> <ref> ; • Java objects used • #reads data <Type> <ref> ; • #modifies data <Type> <ref> ; • Further access to enclosing capabilities and agent • #uses interface <Type> <ref> ; • #uses agent implementing <Type> <ref> ;

  16. Plan Processing • JACK reasoning methods - translated to FSM’s • body() • #reasoning method <name> ( <pars> ) <body> • #reasoning method pass( ) <body> • #reasoning method fail( ) <body> • Java methods called within plan steps • A plan succeeds, fails or throws exception

  17. Declarations for Databases • #key field <Type> <name> ; • #value field <Type> <name> ; • #indexed query <name> ( <proto> ) ; • #linear query <name> ( <proto> ) ; • callbacks (newfact, addfact, ... )

  18. Field Declarations • Declare which fields • #key field <Type> <name> ; • #value field <Type> <name> ; • Scalar types + String only (extended in v2.0) • Tuples must differ in some key field (positive facts) • Declare which queries to support • #indexed query <name> ( <proto> ) ; • #linear query <name> ( <proto> ) ; • Declare which modifications to capture in callbacks • newfact, addfact, delfact, endfact, modfact, moddb • Java methods and members

  19. Declarations for Capabilities • Most Agent declarations, plus • #imported database <Type> <ref> ( <args> ) ; • #exported database <Type> <ref> ( <args> ) ; • #imported data <Type> <ref> ( <args> ) ; • #exported data <Type> <ref> ( <args> ) ; • #shared data <Type> <ref> ( <args> ) ; • #handles external event <Type> ; • #posts external event <Type> { <ref> } ;

  20. Capability Structure capability A #has capability B b; #has capability C c; #handles event EX; #handles event EY; #handles external event EX; #handles event EY; #posts event EY eyp; #uses plan PlanB; #posts external event EX; #handles external event EY; #posts event EY eyp; #uses plan PlanC; capability B capability C

  21. Reasoning Method #reasoning method fooBar(int x,logical String y) { <Java statement> ; <JACK statement> ; <logical statement> ; // boolean, Cursor, FSM ... }

  22. JACK Statements • Posting events • @subtask( <FSM> ) @post( <FSM> ) • @achieve( <cond> , <FSM> ) @test( <cond> , <FSM> ) • @insist( <cond> , <FSM> ) @determine( <cond> , <FSM> ) • Temporal statements • @wait_for( <cond> , <cond> } • @maintain( <cond> , <FSM> ) • @sleep( <time> ) • Messaging • @send( <name> , <message> ) • @reply( <message> , <message> )

  23. Logical Statements • boolean valued statement • succeeds if true, fails if false • can be negated • Cursor valued statement • succeeds if binding is found, fails otherwise • can be negated - “negation as failure” for ClosedWorld • FSM valued statement • succeeds of the FSM processing succeeds, fails otherwise • can be negated

  24. Logical Conditions • if, while, etc. • boolean, Cursor, or FSM • can be negated • boolean and Cursor only in compound conditions • Java connectives: && ||

More Related