net.sourceforge.jabm.strategy
Class RlStrategyWithState

java.lang.Object
  extended by net.sourceforge.jabm.strategy.AbstractStrategy
      extended by net.sourceforge.jabm.strategy.AbstractRlStrategy
          extended by net.sourceforge.jabm.strategy.RlStrategyWithState
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, EventListener, Taggable, Strategy, org.springframework.beans.factory.InitializingBean

public abstract class RlStrategyWithState
extends AbstractRlStrategy
implements java.io.Serializable, org.springframework.beans.factory.InitializingBean, Taggable

See Also:
Serialized Form
 

Field Summary
protected  MDPLearner learner
           
 
Fields inherited from class net.sourceforge.jabm.strategy.AbstractRlStrategy
actions, currentStrategy, initialPropensities, strategyFactory
 
Fields inherited from class net.sourceforge.jabm.strategy.AbstractStrategy
agent, scheduler
 
Constructor Summary
RlStrategyWithState()
           
RlStrategyWithState(Agent agent, org.springframework.beans.factory.ObjectFactory<Strategy> strategyFactory, MDPLearner learner)
           
RlStrategyWithState(org.springframework.beans.factory.ObjectFactory<Strategy> strategyFactory, MDPLearner learner)
           
 
Method Summary
 void afterPropertiesSet()
           
 Strategy clone()
           
 void execute(java.util.List<Agent> otherAgents)
          Execute the behaviour defined by this strategy.
 double[] getInitialPropensities()
           
 MDPLearner getLearner()
           
 int getNumberOfActions()
           
abstract  int getState()
           
 org.springframework.beans.factory.ObjectFactory<Strategy> getStrategyFactory()
           
 java.lang.String getTag()
           
 void setAgent(Agent agent)
          Configure the agent associated with this strategy.
 void setInitialPropensities(double[] initialPropensities)
           
 void setLearner(MDPLearner learner)
           
 void setStrategyFactory(org.springframework.beans.factory.ObjectFactory<Strategy> strategyFactory)
           
 void setTag(java.lang.String tag)
           
 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 class net.sourceforge.jabm.strategy.AbstractRlStrategy
initialise
 
Methods inherited from class net.sourceforge.jabm.strategy.AbstractStrategy
eventOccurred, fireEvent, getAgent, getScheduler, onSimulationFinished, setScheduler, subscribeToEvents
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

learner

protected MDPLearner learner
Constructor Detail

RlStrategyWithState

public RlStrategyWithState(Agent agent,
                           org.springframework.beans.factory.ObjectFactory<Strategy> strategyFactory,
                           MDPLearner learner)

RlStrategyWithState

public RlStrategyWithState(org.springframework.beans.factory.ObjectFactory<Strategy> strategyFactory,
                           MDPLearner learner)

RlStrategyWithState

public RlStrategyWithState()
Method Detail

subscribeToEvents

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

Specified by:
subscribeToEvents in interface Strategy
Overrides:
subscribeToEvents in class AbstractStrategy
Parameters:
scheduler - The EventScheduler on which to listen.

execute

public void execute(java.util.List<Agent> otherAgents)
Description copied from interface: Strategy
Execute the behaviour defined by this strategy.

Specified by:
execute in interface Strategy
Overrides:
execute in class AbstractStrategy
Parameters:
otherAgents - The other agents with which the agent associated with this strategy is interacting.

getLearner

public MDPLearner getLearner()

setLearner

public void setLearner(MDPLearner learner)

setAgent

public void setAgent(Agent agent)
Description copied from interface: Strategy
Configure the agent associated with this strategy.

Specified by:
setAgent in interface Strategy
Overrides:
setAgent in class AbstractStrategy

clone

public Strategy clone()
               throws java.lang.CloneNotSupportedException
Specified by:
clone in interface Strategy
Overrides:
clone in class AbstractStrategy
Throws:
java.lang.CloneNotSupportedException

unsubscribeFromEvents

public void unsubscribeFromEvents()
Description copied from interface: Strategy
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.

Specified by:
unsubscribeFromEvents in interface Strategy
Overrides:
unsubscribeFromEvents in class AbstractRlStrategy

getStrategyFactory

public org.springframework.beans.factory.ObjectFactory<Strategy> getStrategyFactory()
Overrides:
getStrategyFactory in class AbstractRlStrategy

setStrategyFactory

public void setStrategyFactory(org.springframework.beans.factory.ObjectFactory<Strategy> strategyFactory)
Overrides:
setStrategyFactory in class AbstractRlStrategy

getInitialPropensities

public double[] getInitialPropensities()
Overrides:
getInitialPropensities in class AbstractRlStrategy

setInitialPropensities

public void setInitialPropensities(double[] initialPropensities)

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
java.lang.Exception

getTag

public java.lang.String getTag()
Specified by:
getTag in interface Taggable

setTag

public void setTag(java.lang.String tag)
Specified by:
setTag in interface Taggable

getNumberOfActions

public int getNumberOfActions()
Specified by:
getNumberOfActions in class AbstractRlStrategy

getState

public abstract int getState()