Jack agent language
Download
1 / 24

JACK Agent Language - PowerPoint PPT Presentation


  • 61 Views
  • Uploaded on

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

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' JACK Agent Language' - kevin-blake


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

Main concepts
Main Concepts

  • Agent

  • Event

  • Plan

  • Database

  • Capability

  • Class

  • Interface


Jack programming style
JACK Programming Style

planExamplePlan extends Plan {

#sends eventMogulEventmsg;

body()

{

@send(“Mogul”,msg.hello(3,true));

if (@subtask( …))

@send( … );

}

JACK keywords

Java


Jack programming concepts

event

plan

database

JACK Programming Concepts

event

agent

plan

database

capability

“has”

“uses”


Programming elements
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;

}


Declarations for agents
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


Belief structure declarations
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> ) ;


Behaviour declarations
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> ;


  • Other declarations
    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


  • Declarations for events
    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


    Event occurrences
    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> ) ;


    Declarations for plans
    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>


    Special for plans
    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


    Bdi plan selection
    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


    Declarations
    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> ;


    Plan processing
    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


    Declarations for databases
    Declarations for Databases

    • #key field <Type> <name> ;

    • #value field <Type> <name> ;

    • #indexed query <name> ( <proto> ) ;

    • #linear query <name> ( <proto> ) ;

    • callbacks (newfact, addfact, ... )


    Field declarations
    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


    Declarations for capabilities
    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> } ;


    Capability structure
    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


    Reasoning method
    Reasoning Method

    #reasoning method fooBar(int x,logical String y)

    {

    <Java statement> ;

    <JACK statement> ;

    <logical statement> ; // boolean, Cursor, FSM

    ...

    }


    Jack statements
    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> )


    Logical statements
    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


    Logical conditions
    Logical Conditions

    • if, while, etc.

    • boolean, Cursor, or FSM

      • can be negated

    • boolean and Cursor only in compound conditions

      • Java connectives: && ||


    ad