Behaviours
When concerning the job done by
agents it is basically carried out within “behaviours”. Behaviours are created by extending the jade.core.behaviours.Behaviour
class. If you want to make the agent execute a task then you should create an
instance of the corresponding Behaviour subclass and call the addBehaviour()
method of the Agent class. Each Behaviour subclass must implement following
methods.
- public void action(): what the behaviour actually does
- public boolean done(): Whether the behaviour is finished or not
- “One shot” behaviours.
The class is jade.core.behaviours.OneShotBehaviour
. This completes immediately and the action() method is executed only once. Their
done() method simply returns true.
- “Cyclic” behaviours.
The class is jade.core.behaviours.CyclicBehaviour.
This never completes and their action() method executes the same operation each
time it is invoked. Their done() method simply returns false.
- “Complex” behaviours.
This completes when a given
condition is met. Embed a state and
execute in their action() method, different operation depending on their state.
No comments:
Post a Comment