net.sourceforge.jabm.strategy
Interface Strategy

All Superinterfaces:
java.lang.Cloneable, EventListener
All Known Subinterfaces:
ImitatingStrategy
All Known Implementing Classes:
AbstractRlStrategy, AbstractStrategy, RlStrategy, RlStrategyWithImitation, RlStrategyWithState

public interface Strategy
extends EventListener, java.lang.Cloneable

Classes implementing this interface define strategies for agents. A strategy encapsulates the behaviour of the agent. Different agents of the same type may be configured with heterogenous behaviours, and a single agent can switch between several different behaviours during the course of a simulation. Since the outcome of following a specific behaviour can depend on the actions of other agents we use the term strategy from game-theory to refer to behaviours.

 

Method Summary
 java.lang.Object clone()
           
 void execute(java.util.List<Agent> otherAgents)
          Execute the behaviour defined by this strategy.
 Agent getAgent()
           
 void setAgent(Agent agent)
          Configure the agent associated with this strategy.
 void subscribeToEvents(EventScheduler scheduler)
          A Strategy should subscribe to any events it wants to receive by calling the addListener method in the EventScheduler class.
 void unsubscribeFromEvents()
          The strategy should call EventScheduler.removeListener() to unsubscribe from events when this method is called.
 
Methods inherited from interface net.sourceforge.jabm.event.EventListener
eventOccurred
 

Method Detail

setAgent

void setAgent(Agent agent)
Configure the agent associated with this strategy.


getAgent

Agent getAgent()

subscribeToEvents

void subscribeToEvents(EventScheduler scheduler)
A Strategy should subscribe to any events it wants to receive by calling the addListener method in the EventScheduler class.

Parameters:
scheduler - The EventScheduler on which to listen.

execute

void execute(java.util.List<Agent> otherAgents)
Execute the behaviour defined by this strategy.

Parameters:
otherAgents - The other agents with which the agent associated with this strategy is interacting.

unsubscribeFromEvents

void unsubscribeFromEvents()
The strategy should call EventScheduler.removeListener() to unsubscribe from events when this method is called. This hook is used to clean-up, for example when the strategy is disposed of.


clone

java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Throws:
java.lang.CloneNotSupportedException