br.pucrio.inf.les.bdijade.core
Class BDIAgent

java.lang.Object
  extended by jade.core.Agent
      extended by br.pucrio.inf.les.bdijade.core.BDIAgent
All Implemented Interfaces:
jade.core.TimerListener, java.io.Serializable, java.lang.Runnable

public class BDIAgent
extends jade.core.Agent

This class is an extension of Agent that has a current set of goals, which are selected to become intentions, i.e. to tried to be achieve by means of the selection and execution of plans. It also have a set of Capability. It has a behavior that runs the BDI-interpreter. This agent also have a MsgReceiver behavior to receive all messages that the agent current plans can process.

Author:
ingrid
See Also:
Serialized Form

Nested Class Summary
(package private)  class BDIAgent.BDIInterpreter
          This class is a CyclicBehaviour that runs during all the BDIAgent life in order to provide the reasoning engine.
 
Nested classes/interfaces inherited from class jade.core.Agent
jade.core.Agent.Interrupted
 
Field Summary
private  BDIAgent.BDIInterpreter bdiInterpreter
           
private  BeliefRevisionStrategy beliefRevisionStrategy
           
 java.util.Set<Capability> capabilities
           
private  DeliberationFunction deliberationFunction
           
private  java.util.List<Intention> intentions
           
private  OptionGenerationFunction optionGenerationFunction
           
private  PlanSelectionStrategy planSelectionStrategy
           
private static long serialVersionUID
           
 
Fields inherited from class jade.core.Agent
AP_ACTIVE, AP_DELETED, AP_IDLE, AP_INITIATED, AP_MAX, AP_MIN, AP_SUSPENDED, AP_WAITING, D_ACTIVE, D_MAX, D_MIN, D_RETIRED, D_SUSPENDED, D_UNKNOWN, MSG_QUEUE_CLASS
 
Constructor Summary
BDIAgent()
          Default constructor.
 
Method Summary
 void addCapability(Capability capability)
          Adds a capability to this agent.
 void addGoal(Goal goal)
          Adds a new goal to this agent to be achieved.
 void addGoal(Goal goal, GoalListener goalListener)
          Adds a new goal to this agent to be achieved and adds a listener to observe its end.
 java.util.Collection<Belief<?>> getAllBeliefs()
          Returns a collection of all beliefs from all capabilities of this agent.
 java.util.Set<Goal> getAllGoals()
          Gets all goals of this agent.
 BeliefRevisionStrategy getBeliefRevisionStrategy()
           
 java.util.Set<Capability> getCapabilities()
           
 DeliberationFunction getDeliberationFunction()
           
 java.util.Set<Intention> getIntentions()
           
 OptionGenerationFunction getOptionGenerationFunction()
           
 PlanSelectionStrategy getPlanSelectionStrategy()
           
protected  void init()
          This method initializes the BDI agent.
 boolean removeCapability(Capability capability)
          Removes a capability from this agent.
 void setBeliefRevisionStrategy(BeliefRevisionStrategy beliefRevisionStrategy)
           
 void setDeliberationFunction(DeliberationFunction deliberationFunction)
           
 void setNoLongerDesired(Goal goal)
          Sets a goal to be no longer desired.
 void setOptionGenerationFunction(OptionGenerationFunction optionGenerationFunction)
           
 void setPlanSelectionStrategy(PlanSelectionStrategy planSelectionStrategy)
           
protected  void setup()
          Initializes the BDI agent.
protected  void takeDown()
           
 
Methods inherited from class jade.core.Agent
addBehaviour, afterClone, afterMove, beforeClone, beforeMove, blockingReceive, blockingReceive, blockingReceive, blockingReceive, changeStateTo, clean, createMessageQueue, doActivate, doClone, doDelete, doMove, doSuspend, doTimeOut, doWait, doWait, doWake, getAgentState, getAID, getAMS, getArguments, getBootProperties, getContainerController, getContentManager, getCurQueueSize, getDefaultDF, getHap, getHelper, getLocalName, getName, getO2AObject, getProperty, getQueueSize, getState, here, isRestarting, join, notifyChangeBehaviourState, notifyRestarted, postMessage, putBack, putO2AObject, receive, receive, removeBehaviour, removeTimer, restartLater, restore, restoreBufferedState, run, send, setArguments, setEnabledO2ACommunication, setGenerateBehaviourEvents, setO2AManager, setQueueSize, waitUntilStarted, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

bdiInterpreter

private final BDIAgent.BDIInterpreter bdiInterpreter

beliefRevisionStrategy

private BeliefRevisionStrategy beliefRevisionStrategy

capabilities

public final java.util.Set<Capability> capabilities

deliberationFunction

private DeliberationFunction deliberationFunction

intentions

private final java.util.List<Intention> intentions

optionGenerationFunction

private OptionGenerationFunction optionGenerationFunction

planSelectionStrategy

private PlanSelectionStrategy planSelectionStrategy
Constructor Detail

BDIAgent

public BDIAgent()
Default constructor.

Method Detail

addCapability

public void addCapability(Capability capability)
Adds a capability to this agent.

Parameters:
capability - capability to be added.

addGoal

public void addGoal(Goal goal)
Adds a new goal to this agent to be achieved.

Parameters:
goal - the goal to be achieved.

addGoal

public void addGoal(Goal goal,
                    GoalListener goalListener)
Adds a new goal to this agent to be achieved and adds a listener to observe its end.

Parameters:
goal - the goal to be achieved.
goalListener - the listener to be notified.

getAllBeliefs

public java.util.Collection<Belief<?>> getAllBeliefs()
Returns a collection of all beliefs from all capabilities of this agent. It may have two equivalent beliefs, i.e. beliefs with the same name.

Returns:
the collection of all beliefs of this agent.

getAllGoals

public java.util.Set<Goal> getAllGoals()
Gets all goals of this agent. This goals are the ones in the goal set and the ones that are trying to be achieve in intentions.

Returns:
the set of goals.

getBeliefRevisionStrategy

public BeliefRevisionStrategy getBeliefRevisionStrategy()
Returns:
the beliefRevisionStrategy

getCapabilities

public java.util.Set<Capability> getCapabilities()
Returns:
the capabilities

getDeliberationFunction

public DeliberationFunction getDeliberationFunction()
Returns:
the deliberationFunction

getIntentions

public java.util.Set<Intention> getIntentions()
Returns:
the intentions

getOptionGenerationFunction

public OptionGenerationFunction getOptionGenerationFunction()
Returns:
the optionGenerationFunction

getPlanSelectionStrategy

public PlanSelectionStrategy getPlanSelectionStrategy()
Returns:
the planSelectionStrategy

init

protected void init()
This method initializes the BDI agent. It is invoked by the setup() method.


removeCapability

public boolean removeCapability(Capability capability)
Removes a capability from this agent.

Parameters:
capability - capability to be removed.
Returns:
true if the capability exists and was removed.

setBeliefRevisionStrategy

public void setBeliefRevisionStrategy(BeliefRevisionStrategy beliefRevisionStrategy)
Parameters:
beliefRevisionStrategy - the beliefRevisionStrategy to set

setDeliberationFunction

public void setDeliberationFunction(DeliberationFunction deliberationFunction)
Parameters:
deliberationFunction - the deliberationFunction to set

setNoLongerDesired

public void setNoLongerDesired(Goal goal)
Sets a goal to be no longer desired.

Parameters:
goal - the goal to be no longer desired.

setOptionGenerationFunction

public void setOptionGenerationFunction(OptionGenerationFunction optionGenerationFunction)
Parameters:
optionGenerationFunction - the optionGenerationFunction to set

setPlanSelectionStrategy

public void setPlanSelectionStrategy(PlanSelectionStrategy planSelectionStrategy)
Parameters:
planSelectionStrategy - the planSelectionStrategy to set

setup

protected final void setup()
Initializes the BDI agent. It adds the behavior to handle message received and can be processed by capabilities and the BDIAgent.BDIInterpreter behavior as well..

Overrides:
setup in class jade.core.Agent
See Also:
Agent.setup()

takeDown

protected void takeDown()
Overrides:
takeDown in class jade.core.Agent
See Also:
Agent.takeDown()