Class LocalAgArch

java.lang.Object
jason.architecture.AgArch
jason.infra.local.LocalAgArch
All Implemented Interfaces:
Serializable, Comparable<AgArch>, Runnable
Direct Known Subclasses:
LocalAgArchAsynchronous, LocalAgArchForPool, RunLocalMAS.LocalAgArchSynchronousScheduled

public class LocalAgArch extends AgArch implements Runnable, Serializable
This class provides an agent architecture when using Local infrastructure to run the MAS inside Jason. Each agent has its own thread.

Execution sequence:

  • initAg,
  • setEnvInfraTier,
  • setControlInfraTier,
  • run (perceive, checkMail, act),
  • stopAg.
See Also:
  • Field Details

  • Constructor Details

    • LocalAgArch

      public LocalAgArch()
  • Method Details

    • addMsgListener

      public static void addMsgListener(MsgListener l)
    • removeMsgListener

      public static void removeMsgListener(MsgListener l)
    • createArchs

      public void createArchs(List<String> agArchClasses, String agClass, ClassParameters bbPars, String asSrc, Settings stts) throws Exception
      Creates the user agent architecture, default architecture is jason.architecture.AgArch. The arch will create the agent that then creates the TS.
      Throws:
      Exception
    • createArchs

      public void createArchs(List<String> agArchClasses, Agent ag) throws JasonException
      init the agent architecture based on another agent
      Throws:
      JasonException
    • setMASRunner

      public void setMASRunner(BaseLocalMAS masRunner)
    • stopAg

      public void stopAg()
    • setLogger

      public void setLogger()
    • getLogger

      public Logger getLogger()
    • setAgName

      public void setAgName(String name) throws JasonException
      Throws:
      JasonException
    • getAgName

      public String getAgName()
      Description copied from class: AgArch
      Gets the agent's name
      Overrides:
      getAgName in class AgArch
    • getUserAgArch

      @Deprecated public AgArch getUserAgArch()
      Deprecated.
      use getFirstAgArch instead
    • setEnvInfraTier

      public void setEnvInfraTier(LocalEnvironment env)
    • getEnvInfraTier

      public LocalEnvironment getEnvInfraTier()
    • setControlInfraTier

      public void setControlInfraTier(LocalExecutionControl pControl)
    • getControlInfraTier

      public LocalExecutionControl getControlInfraTier()
    • setThread

      public void setThread(Thread t)
    • getThread

      public Thread getThread()
    • startThread

      public void startThread()
    • isRunning

      public boolean isRunning()
      Description copied from class: AgArch
      Checks whether the agent is running
      Overrides:
      isRunning in class AgArch
    • sense

      protected void sense()
    • deliberate

      protected void deliberate()
    • act

      protected void act()
      the act as step of reasoning cycle
    • reasoningCycle

      protected void reasoningCycle()
    • run

      public void run()
      Specified by:
      run in interface Runnable
    • sleep

      public void sleep()
    • wake

      public void wake()
      Description copied from class: AgArch
      Puts the agent in sleep.
      Overrides:
      wake in class AgArch
    • wakeUpSense

      public void wakeUpSense()
      Overrides:
      wakeUpSense in class AgArch
    • wakeUpDeliberate

      public void wakeUpDeliberate()
      Overrides:
      wakeUpDeliberate in class AgArch
    • wakeUpAct

      public void wakeUpAct()
      Overrides:
      wakeUpAct in class AgArch
    • perceive

      public Collection<Literal> perceive()
      Description copied from class: AgArch
      Gets the agent's perception as a list of Literals. The returned list will be modified by Jason.
      Overrides:
      perceive in class AgArch
    • sendMsg

      public void sendMsg(Message m) throws ReceiverNotFoundException
      Description copied from class: AgArch
      Sends a Jason message
      Overrides:
      sendMsg in class AgArch
      Throws:
      ReceiverNotFoundException
    • receiveMsg

      public void receiveMsg(Message m)
    • broadcast

      public void broadcast(Message m) throws Exception
      Description copied from class: AgArch
      Broadcasts a Jason message
      Overrides:
      broadcast in class AgArch
      Throws:
      Exception
    • checkMail

      public void checkMail()
      Description copied from class: AgArch
      Reads the agent's mailbox and adds messages into the agent's circumstance
      Overrides:
      checkMail in class AgArch
    • getMBox

      public Collection<Message> getMBox()
    • act

      public void act(ActionExec action)
      called by the TS to ask the execution of an action in the environment
      Overrides:
      act in class AgArch
    • canSleep

      public boolean canSleep()
      Description copied from class: AgArch
      Returns true if the agent can enter in sleep mode.
      Overrides:
      canSleep in class AgArch
    • receiveSyncSignal

      public void receiveSyncSignal()
      inform this agent that it can continue, if it is in sync mode and waiting a signal
    • informCycleFinished

      public void informCycleFinished(boolean breakpoint, int cycle)
      Informs the infrastructure tier controller that the agent has finished its reasoning cycle (used in sync mode).

      breakpoint is true in case the agent selected one plan with the "breakpoint" annotation.

    • getRuntimeServices

      public RuntimeServices getRuntimeServices()
      Description copied from class: AgArch
      return agent specific run time services (e.g. jade agents implements its differently for each agent)
      Overrides:
      getRuntimeServices in class AgArch
    • setConf

      public void setConf(RConf conf)
    • getConf

      public RConf getConf()
    • getCycles

      public int getCycles()
    • setCycles

      public void setCycles(int cycles)
    • getCyclesSense

      public int getCyclesSense()
    • setCyclesSense

      public void setCyclesSense(int cyclesSense)
    • getCyclesDeliberate

      public int getCyclesDeliberate()
    • setCyclesDeliberate

      public void setCyclesDeliberate(int cyclesDeliberate)
    • getCyclesAct

      public int getCyclesAct()
    • setCyclesAct

      public void setCyclesAct(int cyclesAct)
    • getStatus

      public Map<String,Object> getStatus()
      Overrides:
      getStatus in class AgArch