edu.memphis.ccrg.lida.actionselection
Class BasicActionSelection

java.lang.Object
  extended by edu.memphis.ccrg.lida.framework.initialization.InitializableImpl
      extended by edu.memphis.ccrg.lida.framework.FrameworkModuleImpl
          extended by edu.memphis.ccrg.lida.actionselection.BasicActionSelection
All Implemented Interfaces:
ActionSelection, FrameworkModule, FullyInitializable, Initializable, ModuleListener, BroadcastListener, ProceduralMemoryListener

public class BasicActionSelection
extends FrameworkModuleImpl
implements ActionSelection, ProceduralMemoryListener, BroadcastListener

Rudimentary action selection that selects the behavior with the highest activation. The new BehaviorNetwork implementation is more sophisticated that this one and is preferable.

Author:
Ryan J. McCall

Field Summary
 
Fields inherited from class edu.memphis.ccrg.lida.framework.FrameworkModuleImpl
taskSpawner
 
Constructor Summary
BasicActionSelection()
          Default constructor
 
Method Summary
 void addActionSelectionListener(ActionSelectionListener listener)
          Adds specified ActionSelectionListener.
 void addListener(ModuleListener listener)
          Override this method to add a listener to the module
 void addPreafferenceListener(PreafferenceListener listener)
          Adds specified PreafferenceListener
 void decayModule(long ticks)
          Decay only this Module.
 java.util.Collection<Behavior> getBehaviors()
          Returns a view of the behaviors currently in ActionSelection
 java.lang.Object getModuleContent(java.lang.Object... params)
          Intended to be called from the GUI.
(package private)  double getThreshold()
          Gets candidate threshold.
 void init()
          Will set parameters with the following names:

actionSelection.refractoryperiodTicks refractory period of action selection
actionSelection.candidateThreshold threshold to be considered for selection
actionSelection.removalThreshold threshold for elements to remain active in the action selection module
actionSelection.backgroundTaskTicksPerRun frequency of possible action selection
actionSelection.behaviorDecayStrategy decay strategy of behaviors in this module
actionSelection.thresholdDecayRate decay rate of candidate threshold

If any parameter is not specified its default value will be used.
 void learn(Coalition coalition)
          A place-holder method to remind implementing classes that they should implement learning.
 void receiveBehavior(Behavior b)
          Receive a Behavior
 void receiveBroadcast(Coalition coalition)
          Listener must receive a broadcast of a the winning Coalition This method should return as possible in order to not delay the rest of the broadcasting.
 Behavior selectBehavior(java.util.Collection<Behavior> behaviors, double candidateThreshold)
          Selects a behavior (containing an action) for execution.
 
Methods inherited from class edu.memphis.ccrg.lida.framework.FrameworkModuleImpl
addSubModule, containsSubmodule, containsSubmodule, getAssistingTaskSpawner, getModuleName, getSubmodule, getSubmodule, getSubmodules, setAssistingTaskSpawner, setAssociatedModule, setModuleName, taskManagerDecayModule, toString
 
Methods inherited from class edu.memphis.ccrg.lida.framework.initialization.InitializableImpl
containsParameter, getParam, getParameters, init
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.memphis.ccrg.lida.framework.FrameworkModule
addSubModule, containsSubmodule, containsSubmodule, getAssistingTaskSpawner, getModuleName, getSubmodule, getSubmodule, getSubmodules, setAssistingTaskSpawner, setModuleName, taskManagerDecayModule
 
Methods inherited from interface edu.memphis.ccrg.lida.framework.initialization.FullyInitializable
setAssociatedModule
 
Methods inherited from interface edu.memphis.ccrg.lida.framework.initialization.Initializable
containsParameter, getParam, getParameters, init
 

Constructor Detail

BasicActionSelection

public BasicActionSelection()
Default constructor

Method Detail

init

public void init()
Will set parameters with the following names:

actionSelection.refractoryperiodTicks refractory period of action selection
actionSelection.candidateThreshold threshold to be considered for selection
actionSelection.removalThreshold threshold for elements to remain active in the action selection module
actionSelection.backgroundTaskTicksPerRun frequency of possible action selection
actionSelection.behaviorDecayStrategy decay strategy of behaviors in this module
actionSelection.thresholdDecayRate decay rate of candidate threshold

If any parameter is not specified its default value will be used.

Specified by:
init in interface Initializable
Overrides:
init in class InitializableImpl
See Also:
Initializable

addListener

public void addListener(ModuleListener listener)
Description copied from class: FrameworkModuleImpl
Override this method to add a listener to the module

Specified by:
addListener in interface FrameworkModule
Overrides:
addListener in class FrameworkModuleImpl
Parameters:
listener - - listener of this FrameworkModule

addActionSelectionListener

public void addActionSelectionListener(ActionSelectionListener listener)
Description copied from interface: ActionSelection
Adds specified ActionSelectionListener.

Specified by:
addActionSelectionListener in interface ActionSelection
Parameters:
listener - a module that receives selected actions from ActionSelection

receiveBehavior

public void receiveBehavior(Behavior b)
Description copied from interface: ProceduralMemoryListener
Receive a Behavior

Specified by:
receiveBehavior in interface ProceduralMemoryListener
Parameters:
b - - a stream, a partial order, of behaviors

getBehaviors

public java.util.Collection<Behavior> getBehaviors()
Description copied from interface: ActionSelection
Returns a view of the behaviors currently in ActionSelection

Specified by:
getBehaviors in interface ActionSelection
Returns:
a Collection of Behavior objects

getThreshold

double getThreshold()
Gets candidate threshold. This method is intended for testing only.

Returns:
activation required to be a candidate for selection

selectBehavior

public Behavior selectBehavior(java.util.Collection<Behavior> behaviors,
                               double candidateThreshold)
Description copied from interface: ActionSelection
Selects a behavior (containing an action) for execution.

Specified by:
selectBehavior in interface ActionSelection
Parameters:
behaviors - Collection of behaviors currently available in the module
candidateThreshold - threshold for a behavior to be a candidate
Returns:
winning Behavior or null if none was chosen

getModuleContent

public java.lang.Object getModuleContent(java.lang.Object... params)
Description copied from class: FrameworkModuleImpl
Intended to be called from the GUI. Override this method to return particular module content based on params.

Specified by:
getModuleContent in interface FrameworkModule
Overrides:
getModuleContent in class FrameworkModuleImpl
Parameters:
params - parameters specifying what content will be returned
Returns:
Parameter-specified content of this module.

addPreafferenceListener

public void addPreafferenceListener(PreafferenceListener listener)
Description copied from interface: ActionSelection
Adds specified PreafferenceListener

Specified by:
addPreafferenceListener in interface ActionSelection
Parameters:
listener - a module that receives preafference from ActionSelection

learn

public void learn(Coalition coalition)
Description copied from interface: BroadcastListener
A place-holder method to remind implementing classes that they should implement learning. LIDA theory says receivers of the broadcast should learn from it. This method will not be called directly by the GlobalWorkspace and thus it should be managed by the receiving module.

Specified by:
learn in interface BroadcastListener
Parameters:
coalition - the Coalition that won the most recent competition for consciousness

receiveBroadcast

public void receiveBroadcast(Coalition coalition)
Description copied from interface: BroadcastListener
Listener must receive a broadcast of a the winning Coalition This method should return as possible in order to not delay the rest of the broadcasting.

Specified by:
receiveBroadcast in interface BroadcastListener
Parameters:
coalition - the Coalition that won the most recent competition for consciousness

decayModule

public void decayModule(long ticks)
Description copied from interface: FrameworkModule
Decay only this Module.

Specified by:
decayModule in interface FrameworkModule
Parameters:
ticks - number of ticks to decay.