Package jason.control

Class ExecutionControl

java.lang.Object
jason.control.ExecutionControl
Direct Known Subclasses:
ExecutionControlGUI

public class ExecutionControl extends Object
Base class for the user implementation of execution control.

This default implementation synchronise agents execution, i.e., each agent will perform its next reasoning cycle only when all agents have finished its reasoning cycle.

Execution sequence:

  • setExecutionControlInfraTier,
  • init,
  • (receivedFinishedCycle)*,
  • stop.
  • Field Details

  • Constructor Details

    • ExecutionControl

      public ExecutionControl()
  • Method Details

    • getCycleTimeout

      protected int getCycleTimeout()
      returns the maximum number of milliseconds of a cycle
    • startNewCycle

      protected void startNewCycle()
    • updateNumberOfAgents

      public void updateNumberOfAgents()
      Updates the number of agents in the MAS, this default implementation, considers all agents in the MAS as actors .
    • getNbAgs

      public int getNbAgs()
      Returns the number of agents in the MAS (used to test the end of a cycle)
    • setNbAgs

      public void setNbAgs(int n)
      Set the number of agents
    • receiveFinishedCycle

      public void receiveFinishedCycle(String agName, boolean breakpoint, int cycle)
      Called when the agent agName has finished its reasoning cycle. breakpoint is true in case the agent selected one plan with "breakpoint" annotation.
    • testEndCycle

      protected boolean testEndCycle(Set<String> finishedAgs)
      Returns true when a new cycle can start, it normally holds when all agents are in the finishedAgs set.
      Parameters:
      finishedAgs - the set of agents' name that already finished the current cycle
    • setExecutionControlInfraTier

      public void setExecutionControlInfraTier(ExecutionControlInfraTier jasonControl)
    • getExecutionControlInfraTier

      public ExecutionControlInfraTier getExecutionControlInfraTier()
    • init

      public void init(String[] args)
      This method is called when setExecutionControlInfraTier was already called
    • stop

      public void stop()
      This method is called when MAS execution is being finished
    • allAgsFinished

      protected void allAgsFinished()
      Called when all agents have finished the current cycle
    • isRunning

      public boolean isRunning()
    • getCycleNumber

      public int getCycleNumber()
    • setRunningCycle

      public void setRunningCycle(boolean rc)
    • toString

      public String toString()
      Overrides:
      toString in class Object