Class AbstractDedaleAgent

java.lang.Object
jade.core.Agent
agent.AbstractDeltaAgent
eu.su.mas.dedale.mas.AbstractDedaleAgent
All Implemented Interfaces:
agent.A2oInterface, jade.core.TimerListener, jade.util.leap.Serializable, java.io.Serializable, java.lang.Runnable
Direct Known Subclasses:
ControlledAgent, DummyCollectorAgent, DummyMovingAgent, DummyTankerAgent, DummyWumpusShift, DummyWumpusShift2, ExploreCoopAgent, ExploreSoloAgent

public class AbstractDedaleAgent
extends agent.AbstractDeltaAgent
 Any agent willing to interact with a the DEDALE environment must extend this class it offers :
 
  • the API to move and act in the env, either it is distributed or not
  • the management of the communication reach
  • the deployment of the agent
Author:
Cédric Herpson.
See Also:
Serialized Form
  • Nested Class Summary

    Nested classes/interfaces inherited from class jade.core.Agent

    jade.core.Agent.Interrupted
  • Field Summary

    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

    Constructors 
    Constructor Description
    AbstractDedaleAgent()  
    AbstractDedaleAgent​(EntityType e, EntityCharacteristics ec, java.lang.String environmentName)  
  • Method Summary

    Modifier and Type Method Description
    boolean closeLock()
    Close all the safes present on the current position.
    void deployMe()
    Used to get a ref of this environment from the genericSharableObject table to realEnv, as well as the agents characteristics obtained through the configurationFile This methods is silently called by the agent when discussing with the gateKeeper.
    void dropOff()
    Drop the treasure on the current position, if allowed (depending of the agent's type) and elements already on the current location (one type of treasure per node)
    boolean emptyMyBackPack​(java.lang.String agentSiloName)  
    java.util.List<dataStructures.tuple.Couple<Observation,​java.lang.Integer>> getBackPackFreeSpace()  
    Location getCurrentPosition()  
    java.util.Set<dataStructures.tuple.Couple<Observation,​java.lang.Integer>> getMyExpertise()  
    Observation getMyTreasureType()  
    static java.lang.Object[] loadEntityCaracteristics​(java.lang.String agentName, java.lang.String instanceConfigurationEntitiesFullPath)
    Search and load the characteristics of one agent.
    boolean moveTo​(Location myDestination)
    This method should be the last method called in your behaviour.
    java.util.List<dataStructures.tuple.Couple<Location,​java.util.List<dataStructures.tuple.Couple<Observation,​java.lang.Integer>>>> observe()  
    boolean openLock​(Observation o)
    This methods automatically aggregates the surrounding connected agents expertise
    int pick()  
    void sendMessage​(jade.lang.acl.ACLMessage msg)
    This method MUST be used instead of the final method JADE.core.Agent.send() in order for the platform to control the reach of the communications.
    boolean throwGrenade​(Location locationId)
    Throw a grenade to a given location.

    Methods inherited from class agent.AbstractDeltaAgent

    addAbility, addSharableObject, getKnowledge, getKnowledge, getSharableObject, removeSharableObject, setKnowledge

    Methods inherited from class jade.core.Agent

    addBehaviour, blockingReceive, blockingReceive, blockingReceive, blockingReceive, changeStateTo, clean, doActivate, doClone, doDelete, doMove, doSuspend, doTimeOut, doWait, doWait, doWake, getAgentState, getAID, getAID, getAMS, getArguments, getBehavioursCnt, getBootProperties, getContainerController, getContentManager, getCurQueueSize, getDefaultDF, getExecutedBehavioursCnt, getGenerateBehaviourEvents, getGenerateMessageEvents, getHap, getHelper, getLocalName, getName, getO2AInterface, getO2AObject, getPostedMessagesCnt, getProperty, getQueueSize, getReceivedMessagesCnt, getSentMessagesCnt, getState, here, isAlive, isRestarting, join, notifyChangeBehaviourState, notifyRestarted, postMessage, putBack, putO2AObject, receive, receive, receive, registerO2AInterface, removeBehaviour, removeTimer, restartLater, restoreBufferedState, restoreFields, run, send, setArguments, setEnabledO2ACommunication, setGenerateBehaviourEvents, setGenerateMessageEvents, setO2AManager, setQueueSize, waitUntilStarted, write

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • getCurrentPosition

      public Location getCurrentPosition()
      Returns:
      The agent's current position, null if the agent is not in the environment
    • observe

      public java.util.List<dataStructures.tuple.Couple<Location,​java.util.List<dataStructures.tuple.Couple<Observation,​java.lang.Integer>>>> observe()
      Returns:
      The available observations from the agent's current position.

      A list of observed position (PositionID), and for each one is associated its list of observations under the form (ObservationType, Value)) . Null if there is a malfunction

      Example : {

      Position1; [(Observation1,Value1);(Obseration2,Value2)],

      Position2; [(Observation1,Value1);(Obseration2,Value2)],

      ..}

      See Also:
      for the list of Observation components
    • moveTo

      public boolean moveTo​(Location myDestination)
      This method should be the last method called in your behaviour.

      The agent can die if he moves too carelessly.

      Parameters:
      myDestination - the targeted nodeId
      Returns:
      true if the move is legit and triggered, false otherwise
    • pick

      public int pick()
      Returns:
      the amount of wealth that the agent was able to pick. 0 if there is no treasure at this place, or if the agent cannot grab it ( backPack full, not authorized,...)
    • openLock

      public boolean openLock​(Observation o)
      This methods automatically aggregates the surrounding connected agents expertise
      Parameters:
      o - The type of treasure to open (Observation.Gold, Observation.Diamond, Observation.Any).
      Returns:
      true is the lock is open, false otherwise
    • closeLock

      public boolean closeLock()
      Close all the safes present on the current position.
      Returns:
      true if at least one chest with a lock was on the agent position (all chest on the position are now locked)
    • getBackPackFreeSpace

      public java.util.List<dataStructures.tuple.Couple<Observation,​java.lang.Integer>> getBackPackFreeSpace()
      Returns:
      The available carrying capacity of the agent according to its type. As an agent can carry several type of resources, its a list of Couple
    • getMyTreasureType

      public Observation getMyTreasureType()
      Returns:
      The type of treasure that the agent is able to pick
    • getMyExpertise

      public java.util.Set<dataStructures.tuple.Couple<Observation,​java.lang.Integer>> getMyExpertise()
      Returns:
      The expertise of the agent as a set of Couple(Observation,Integer)
    • emptyMyBackPack

      public boolean emptyMyBackPack​(java.lang.String agentSiloName)
      Parameters:
      agentSiloName - name of the Tanker agent to receive the backpack's content
      Returns:
      true if you're agent was allowed to realize the transfer, false otherwise
    • throwGrenade

      public boolean throwGrenade​(Location locationId)
      Throw a grenade to a given location.
      Parameters:
      locationId - the Id of the room the entity is aiming at
      Returns:
      true if done, false otherwise (the location as to far,..) The consequences of this action, if any, will be seen in the environment
    • dropOff

      public void dropOff()
      Drop the treasure on the current position, if allowed (depending of the agent's type) and elements already on the current location (one type of treasure per node)
    • sendMessage

      public void sendMessage​(jade.lang.acl.ACLMessage msg)
      This method MUST be used instead of the final method JADE.core.Agent.send() in order for the platform to control the reach of the communications.
      Parameters:
      msg - the message to send
    • deployMe

      public void deployMe()
      Used to get a ref of this environment from the genericSharableObject table to realEnv, as well as the agents characteristics obtained through the configurationFile This methods is silently called by the agent when discussing with the gateKeeper. The end-user should NOT call it.
    • loadEntityCaracteristics

      public static java.lang.Object[] loadEntityCaracteristics​(java.lang.String agentName, java.lang.String instanceConfigurationEntitiesFullPath)
      Search and load the characteristics of one agent.
      Parameters:
      agentName - localname of the agent
      instanceConfigurationEntitiesFullPath - file describing the agent characteristics
      Returns:
      The entity characteristics as an object tabular