edu.udo.cs.ie.cowbots.agent
Class CowbotAgent

Package class diagram package CowbotAgent
java.lang.Object
  extended by Agent
      extended by edu.udo.cs.ie.cowbots.agent.CowbotAgent
All Implemented Interfaces:
ICowbot

public class CowbotAgent
extends Agent
implements ICowbot

cowbots customisation of jason's agent class. this class integrates the cowbot bdi extensions into jason.


Nested Class Summary
(package private)  class CowbotAgent.SimState
           
 
Field Summary
(package private)  java.lang.String agconfBRFCLASS
           
(package private)  boolean agconfMSGsocAcc
           
(package private)  boolean agconfNoDelib
           
(package private)  java.util.List<java.lang.String> agconfNoRevisePrograms
           
(package private)  java.util.List<java.lang.String> agconfPrograms
           
(package private)  java.util.HashMap<java.lang.String,java.lang.String> agconfUserPrograms
           
(package private)  java.lang.String agDir
           
(package private)  java.lang.String agName
           
(package private)  boolean agstateReset
           
(package private)  java.lang.String agTemp
           
(package private)  int agTime
           
(package private)  IActionComponent cowAction
           
(package private)  DeliberationComponent cowDelib
           
(package private)  DesireComponent cowDesGen
           
(package private)  CRevisionComponent cowRevision
           
(package private)  ICowbotUI cowUI
           
(package private)  DLV dlv
           
(package private)  boolean fix_GenerateBeliefChangeEvents
           
(package private)  boolean fix_MessageEvent
           
(package private)  boolean fix_NoMotivation
           
(package private)  boolean fix_UseDefaultSelectEvent
           
(package private)  boolean fix_UseDefaultSelectIntention
           
(package private)  boolean fix_UseDefaultSelectOption
           
(package private)  java.util.List<Literal> initalKnowledge
           
(package private)  java.util.logging.Logger intLog
           
(package private)  java.util.logging.Logger log
           
(package private)  java.lang.String logDir
           
(package private)  boolean loggingEnabled
           
(package private)  boolean optAllInfo
           
(package private)  boolean optDelibNoIntentionRestart
           
(package private)  boolean optProcessMessageInSocAcc
           
(package private)  CowbotAgent.SimState simstate
           
 
Constructor Summary
CowbotAgent()
           
 
Method Summary
 void abolish(Literal bel, Unifier un)
           
 java.util.List<Literal>[] brf(Literal beliefToAdd, Literal beliefToDel, Intention i)
          belief revision function. called by jason for belief addtion or deletion.
 void buf(java.util.List<Literal> percepts)
          belief update function, called whenever an agent perceives information about its environment. whenever new perceptions are avail, the cowbotrevision fetches the environmental update, and the desire generation is invoked to update an agent's desires. at last, a dummy event is fired to force the jason interpreter to step into the event selection, where deliberation takes place.
protected  Event createDummyEvent()
           
 void eventAdded(Event arg0)
           
 IActionComponent getActionSelection()
          this method returns an instance to the action selection
 DeliberationComponent getCowDelib()
           
 DesireComponent getCowDesires()
          returns the desire generator of this cowbot agent
 DLV getDLV()
          getter to access dlv
 IEpistemicState getEpistemicState()
          getter to receive epistemic state
 java.lang.String getLogDirectory()
          returns a path to the agents log directory.
 java.lang.String getTemporaryDirectory()
          returns a path to an agent's local working directory. the path is absolute and ends with an "/".
 ICowbotUI getUI()
          this method returns an instance to a cowbot ui
private  void initAgFromXML(java.lang.String filename, java.lang.String agName)
          this methods loads an agents configuration from an xml file
 void initBDI(Settings stts, java.lang.String agName)
          this method initializes the cowbot extensions. the configuration options are taken from the user settings in the mas2j file.
 void intentionAdded(Intention arg0)
           
 void intentionDropped(Intention arg0)
           
 void intentionResumed(Intention i)
           
 void intentionSuspended(Intention i, java.lang.String reason)
           
protected  void onNewPercepts(java.util.List<Literal> percepts)
          main handler for handling percepts send from an environment
protected  void onSimulationEnd(java.util.List<Literal> per)
          this method handles end of simulation events. the agent is put into a reset-state and won't accept new messages unless it receives a simulation start event.
protected  void onSimulationStart(java.util.List<Literal> percepts)
          this method is used to setup an agent for a simulation. during lifetime of an agent, he may assume that each simulation id is unique. so receiving the same simulation multiple times, he should not reinitialize himself again.
protected  void runDelib()
           
 Event selectEvent(java.util.Queue<Event> events)
           
 Intention selectIntention(java.util.Queue<Intention> intentions)
           
 Message selectMessage(java.util.Queue<Message> messages)
          this method selects a message from an agent's message queue and return it to the transition system. in our implementation. it additionally checks any message if it represents a message with a logical program in that case, the message is handled by the revision system.
 Option selectOption(java.util.List<Option> options)
           
 boolean socAcc(Message m)
          this method is used to let an agent decide if it accepts or rejects an incoming message from other agents. in our implementation, we accept all messages by default. if the message contains a specific header (first literal is messagecontent/1), then the message is stored into the elp belief base. otherwise, the message is passed down to jason's interpreter for further processing.
protected  void syncJasonBB(boolean createEvents)
          this method synchronizes the logical belief set with jason's belief base.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cowRevision

CRevisionComponent cowRevision

cowDesGen

DesireComponent cowDesGen

cowDelib

DeliberationComponent cowDelib

cowAction

IActionComponent cowAction

cowUI

ICowbotUI cowUI

initalKnowledge

java.util.List<Literal> initalKnowledge

dlv

DLV dlv

agTemp

java.lang.String agTemp

agDir

java.lang.String agDir

agName

java.lang.String agName

log

java.util.logging.Logger log

intLog

java.util.logging.Logger intLog

logDir

java.lang.String logDir

fix_GenerateBeliefChangeEvents

boolean fix_GenerateBeliefChangeEvents

fix_UseDefaultSelectIntention

boolean fix_UseDefaultSelectIntention

fix_UseDefaultSelectEvent

boolean fix_UseDefaultSelectEvent

fix_UseDefaultSelectOption

boolean fix_UseDefaultSelectOption

fix_MessageEvent

boolean fix_MessageEvent

fix_NoMotivation

boolean fix_NoMotivation

optProcessMessageInSocAcc

boolean optProcessMessageInSocAcc

optDelibNoIntentionRestart

boolean optDelibNoIntentionRestart

optAllInfo

boolean optAllInfo

agTime

int agTime

loggingEnabled

boolean loggingEnabled

agconfPrograms

java.util.List<java.lang.String> agconfPrograms

agconfNoRevisePrograms

java.util.List<java.lang.String> agconfNoRevisePrograms

agconfUserPrograms

java.util.HashMap<java.lang.String,java.lang.String> agconfUserPrograms

agconfNoDelib

boolean agconfNoDelib

agconfMSGsocAcc

boolean agconfMSGsocAcc

agconfBRFCLASS

java.lang.String agconfBRFCLASS

agstateReset

boolean agstateReset

simstate

CowbotAgent.SimState simstate
Constructor Detail

CowbotAgent

public CowbotAgent()
Method Detail

initBDI

public void initBDI(Settings stts,
                    java.lang.String agName)
             throws java.lang.Exception
this method initializes the cowbot extensions. the configuration options are taken from the user settings in the mas2j file.

Parameters:
stts - user settings
Throws:
java.lang.Exception

initAgFromXML

private void initAgFromXML(java.lang.String filename,
                           java.lang.String agName)
this methods loads an agents configuration from an xml file

Parameters:
string -
agName2 -

buf

public void buf(java.util.List<Literal> percepts)
belief update function, called whenever an agent perceives information about its environment. whenever new perceptions are avail, the cowbotrevision fetches the environmental update, and the desire generation is invoked to update an agent's desires. at last, a dummy event is fired to force the jason interpreter to step into the event selection, where deliberation takes place.


onNewPercepts

protected void onNewPercepts(java.util.List<Literal> percepts)
main handler for handling percepts send from an environment

Parameters:
percepts -

onSimulationStart

protected void onSimulationStart(java.util.List<Literal> percepts)
this method is used to setup an agent for a simulation. during lifetime of an agent, he may assume that each simulation id is unique. so receiving the same simulation multiple times, he should not reinitialize himself again.

Parameters:
percepts -

onSimulationEnd

protected void onSimulationEnd(java.util.List<Literal> per)
this method handles end of simulation events. the agent is put into a reset-state and won't accept new messages unless it receives a simulation start event.

Parameters:
per - percepts containing the end of simulation data

brf

public java.util.List<Literal>[] brf(Literal beliefToAdd,
                                     Literal beliefToDel,
                                     Intention i)
                              throws RevisionFailedException
belief revision function. called by jason for belief addtion or deletion.

Throws:
RevisionFailedException

syncJasonBB

protected void syncJasonBB(boolean createEvents)
this method synchronizes the logical belief set with jason's belief base.


selectEvent

public Event selectEvent(java.util.Queue<Event> events)

selectOption

public Option selectOption(java.util.List<Option> options)

selectIntention

public Intention selectIntention(java.util.Queue<Intention> intentions)

getEpistemicState

public IEpistemicState getEpistemicState()
Description copied from interface: ICowbot
getter to receive epistemic state

Specified by:
getEpistemicState in interface ICowbot
Returns:
instance to an agents epistemic state

socAcc

public boolean socAcc(Message m)
this method is used to let an agent decide if it accepts or rejects an incoming message from other agents. in our implementation, we accept all messages by default. if the message contains a specific header (first literal is messagecontent/1), then the message is stored into the elp belief base. otherwise, the message is passed down to jason's interpreter for further processing.


selectMessage

public Message selectMessage(java.util.Queue<Message> messages)
this method selects a message from an agent's message queue and return it to the transition system. in our implementation. it additionally checks any message if it represents a message with a logical program in that case, the message is handled by the revision system.


getCowDelib

public DeliberationComponent getCowDelib()
Specified by:
getCowDelib in interface ICowbot
Returns:
the cowDelib

getDLV

public DLV getDLV()
Description copied from interface: ICowbot
getter to access dlv

Specified by:
getDLV in interface ICowbot
Returns:
instance to dlv

getActionSelection

public IActionComponent getActionSelection()
Description copied from interface: ICowbot
this method returns an instance to the action selection

Specified by:
getActionSelection in interface ICowbot

getLogDirectory

public java.lang.String getLogDirectory()
Description copied from interface: ICowbot
returns a path to the agents log directory. any kind of logs could be written here. the directory path is absolute and ends with "/"

Specified by:
getLogDirectory in interface ICowbot
Returns:
path to an agent's log directory

getTemporaryDirectory

public java.lang.String getTemporaryDirectory()
Description copied from interface: ICowbot
returns a path to an agent's local working directory. the path is absolute and ends with an "/".

Specified by:
getTemporaryDirectory in interface ICowbot
Returns:
path to an agent's temporary directory

getUI

public ICowbotUI getUI()
Description copied from interface: ICowbot
this method returns an instance to a cowbot ui

Specified by:
getUI in interface ICowbot

eventAdded

public void eventAdded(Event arg0)

intentionAdded

public void intentionAdded(Intention arg0)

intentionSuspended

public void intentionSuspended(Intention i,
                               java.lang.String reason)

intentionResumed

public void intentionResumed(Intention i)

intentionDropped

public void intentionDropped(Intention arg0)

runDelib

protected void runDelib()

createDummyEvent

protected Event createDummyEvent()

abolish

public void abolish(Literal bel,
                    Unifier un)
             throws RevisionFailedException
Throws:
RevisionFailedException

getCowDesires

public DesireComponent getCowDesires()
Description copied from interface: ICowbot
returns the desire generator of this cowbot agent

Specified by:
getCowDesires in interface ICowbot
Returns:
instance to a desire component