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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
act()
the act as step of reasoning cyclevoid
act
(ActionExec action) called by the TS to ask the execution of an action in the environmentstatic void
void
Broadcasts a Jason messageboolean
canSleep()
Returns true if the agent can enter in sleep mode.void
Reads the agent's mailbox and adds messages into the agent's circumstancevoid
createArchs
(List<String> agArchClasses, Agent ag) init the agent architecture based on another agentvoid
createArchs
(List<String> agArchClasses, String agClass, ClassParameters bbPars, String asSrc, Settings stts) Creates the user agent architecture, default architecture is jason.architecture.AgArch.protected void
Gets the agent's namegetConf()
int
int
int
int
getMBox()
return agent specific run time services (e.g.Deprecated.use getFirstAgArch insteadvoid
informCycleFinished
(boolean breakpoint, int cycle) Informs the infrastructure tier controller that the agent has finished its reasoning cycle (used in sync mode).boolean
Checks whether the agent is runningperceive()
Gets the agent's perception as a list of Literals.protected void
void
void
inform this agent that it can continue, if it is in sync mode and waiting a signalstatic void
void
run()
void
Sends a Jason messageprotected void
sense()
void
void
void
setControlInfraTier
(LocalExecutionControl pControl) void
setCycles
(int cycles) void
setCyclesAct
(int cyclesAct) void
setCyclesDeliberate
(int cyclesDeliberate) void
setCyclesSense
(int cyclesSense) void
void
void
setMASRunner
(BaseLocalMAS masRunner) void
void
sleep()
void
void
stopAg()
void
wake()
Puts the agent in sleep.void
void
void
Methods 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:AgArch
Gets 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:AgArch
Checks 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:AgArch
Puts the agent in sleep. -
wakeUpSense
public void wakeUpSense()- Overrides:
wakeUpSense
in classAgArch
-
wakeUpDeliberate
public void wakeUpDeliberate()- Overrides:
wakeUpDeliberate
in classAgArch
-
wakeUpAct
public void wakeUpAct() -
perceive
Description copied from class:AgArch
Gets the agent's perception as a list of Literals. The returned list will be modified by Jason. -
sendMsg
Description copied from class:AgArch
Sends a Jason message- Overrides:
sendMsg
in classAgArch
- Throws:
ReceiverNotFoundException
-
receiveMsg
-
broadcast
Description copied from class:AgArch
Broadcasts a Jason message -
checkMail
public void checkMail()Description copied from class:AgArch
Reads 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:AgArch
Returns 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:AgArch
return agent specific run time services (e.g. jade agents implements its differently for each agent)- Overrides:
getRuntimeServices
in 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
-