Package jason.infra.local
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
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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidact()the act as step of reasoning cyclevoidact(ActionExec action) called by the TS to ask the execution of an action in the environmentstatic voidvoidBroadcasts a Jason messagebooleancanSleep()Returns true if the agent can enter in sleep mode.voidReads the agent's mailbox and adds messages into the agent's circumstancevoidcreateArchs(List<String> agArchClasses, Agent ag) init the agent architecture based on another agentvoidcreateArchs(List<String> agArchClasses, String agClass, ClassParameters bbPars, String asSrc, Settings stts) Creates the user agent architecture, default architecture is jason.architecture.AgArch.protected voidGets the agent's namegetConf()intintintintgetMBox()return agent specific run time services (e.g.Deprecated.use getFirstAgArch insteadvoidinformCycleFinished(boolean breakpoint, int cycle) Informs the infrastructure tier controller that the agent has finished its reasoning cycle (used in sync mode).booleanChecks whether the agent is runningperceive()Gets the agent's perception as a list of Literals.protected voidvoidvoidinform this agent that it can continue, if it is in sync mode and waiting a signalstatic voidvoidrun()voidSends a Jason messageprotected voidsense()voidvoidvoidsetControlInfraTier(LocalExecutionControl pControl) voidsetCycles(int cycles) voidsetCyclesAct(int cyclesAct) voidsetCyclesDeliberate(int cyclesDeliberate) voidsetCyclesSense(int cyclesSense) voidvoidvoidsetMASRunner(BaseLocalMAS masRunner) voidvoidsleep()voidvoidstopAg()voidwake()Puts the agent in sleep.voidvoidvoidMethods inherited from class jason.architecture.AgArch
actionExecuted, compareTo, createCustomArchs, equals, getAgArchClassesChain, getCycleNumber, getFirstAgArch, getNextAgArch, getTS, hashCode, incCycleNumber, init, insertAgArch, reasoningCycleFinished, reasoningCycleStarting, setCycleNumber, setTS, stop, toString
-
Field Details
-
infraEnv
-
logger
-
MAX_SLEEP
public static final int MAX_SLEEP- See Also:
-
-
Constructor Details
-
LocalAgArch
public LocalAgArch()
-
-
Method Details
-
addMsgListener
-
removeMsgListener
-
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
init the agent architecture based on another agent- Throws:
JasonException
-
setMASRunner
-
stopAg
public void stopAg() -
setLogger
public void setLogger() -
getLogger
-
setAgName
- Throws:
JasonException
-
getAgName
Description copied from class:AgArchGets the agent's name -
getUserAgArch
Deprecated.use getFirstAgArch instead -
setEnvInfraTier
-
getEnvInfraTier
-
setControlInfraTier
-
getControlInfraTier
-
setThread
-
getThread
-
startThread
public void startThread() -
isRunning
public boolean isRunning()Description copied from class:AgArchChecks whether the agent is running -
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() -
sleep
public void sleep() -
wake
public void wake()Description copied from class:AgArchPuts the agent in sleep. -
wakeUpSense
public void wakeUpSense()- Overrides:
wakeUpSensein classAgArch
-
wakeUpDeliberate
public void wakeUpDeliberate()- Overrides:
wakeUpDeliberatein classAgArch
-
wakeUpAct
public void wakeUpAct() -
perceive
Description copied from class:AgArchGets the agent's perception as a list of Literals. The returned list will be modified by Jason. -
sendMsg
Description copied from class:AgArchSends a Jason message- Overrides:
sendMsgin classAgArch- Throws:
ReceiverNotFoundException
-
receiveMsg
-
broadcast
Description copied from class:AgArchBroadcasts a Jason message -
checkMail
public void checkMail()Description copied from class:AgArchReads the agent's mailbox and adds messages into the agent's circumstance -
getMBox
-
act
called by the TS to ask the execution of an action in the environment -
canSleep
public boolean canSleep()Description copied from class:AgArchReturns true if the agent can enter in sleep mode. -
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
Description copied from class:AgArchreturn agent specific run time services (e.g. jade agents implements its differently for each agent)- Overrides:
getRuntimeServicesin classAgArch
-
setConf
-
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
-