edu.memphis.ccrg.lida.actionselection.behaviornetwork
Class BehaviorNetwork

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.behaviornetwork.BehaviorNetwork
All Implemented Interfaces:
ActionSelection, FrameworkModule, FullyInitializable, Initializable, ModuleListener, ProceduralMemoryListener

public class BehaviorNetwork
extends FrameworkModuleImpl
implements ActionSelection, ProceduralMemoryListener

A Behavior Network implementation of ActionSelection based on the ideas of Maes' original. This implementation is integrated into the framework, operating asynchronously and also taking the conscious broadcast as input. Maes' called the input "environment".

Author:
Ryan J. McCall, Javier Snaider

Field Summary
 
Fields inherited from class edu.memphis.ccrg.lida.framework.FrameworkModuleImpl
taskSpawner
 
Constructor Summary
BehaviorNetwork()
          Default constructor
 
Method Summary
 void addActionSelectionListener(ActionSelectionListener l)
          Adds specified ActionSelectionListener.
 void addListener(ModuleListener l)
          Override this method to add a listener to the module
 void addPreafferenceListener(PreafferenceListener l)
          Adds specified PreafferenceListener
(package private)  void attemptActionSelection()
          Tries to select one behavior to be executed.
 void decayModule(long t)
          Decay only this Module.
 java.util.Collection<Behavior> getBehaviors()
          Returns a view of the behaviors currently in ActionSelection
(package private)  double getCandidateThreshold()
          Gets candidate threshold.
 java.lang.Object getModuleContent(java.lang.Object... params)
          Intended to be called from the GUI.
 void init()
          This module can initialize the following parameters:

actionselection.broadcastExcitationFactor - double, the percentage of the activation that broadcast elements send to behaviors whose context and/or result intersect with said elements
actionselection.successorExcitationFactor - double, the percentage of the activation that behaviors receive from their successors
actionselection.predecessorExcitationFactor - double, the percentage of activation that behaviors receive from their predecessors
actionselection.conflictorExcitationFactor - double, the percent of activation behaviors receive from conflicting behaviors
actionselection.contextSatisfactionThreshold - double, amount of activation a context condition must have to be satisfied
actionselection.initialCandidateThreshold - double, the initial value for candidate threshold.
(package private)  void passActivationAmongBehaviors()
          Intended for testing only.
(package private)  void passActivationFromSchemes()
          Intended for testing only.
 void receiveBehavior(Behavior b)
          Receive a Behavior
 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

BehaviorNetwork

public BehaviorNetwork()
Default constructor

Method Detail

init

public void init()
This module can initialize the following parameters:

actionselection.broadcastExcitationFactor - double, the percentage of the activation that broadcast elements send to behaviors whose context and/or result intersect with said elements
actionselection.successorExcitationFactor - double, the percentage of the activation that behaviors receive from their successors
actionselection.predecessorExcitationFactor - double, the percentage of activation that behaviors receive from their predecessors
actionselection.conflictorExcitationFactor - double, the percent of activation behaviors receive from conflicting behaviors
actionselection.contextSatisfactionThreshold - double, amount of activation a context condition must have to be satisfied
actionselection.initialCandidateThreshold - double, the initial value for candidate threshold. candidate threshold is reset to this initial value after every action selection
actionselection.candidateThresholdDecayName - string, factory name of the DecayStrategy used to decay the candidate threshold. actionselection.behaviorDecayName - string, factory name of the DecayStrategy used to decay all behaviors. If default LinearDecayStrategy is used its slope determine the amount the selection threshold will be reduced in each cycle.

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

addListener

public void addListener(ModuleListener l)
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:
l - - listener of this FrameworkModule

addActionSelectionListener

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

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

addPreafferenceListener

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

Specified by:
addPreafferenceListener in interface ActionSelection
Parameters:
l - a module that receives preafference 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

passActivationFromSchemes

void passActivationFromSchemes()
Intended for testing only. Passes activation from Schemes to Behaviors.


passActivationAmongBehaviors

void passActivationAmongBehaviors()
Intended for testing only. Passes activation from successors to predecessors and vice versa also to conflictors. This implementation is different to the original Maes' code. Here the activation is updated directly and the new value is used to compute the passing activation.


attemptActionSelection

void attemptActionSelection()
Tries to select one behavior to be executed. The chosen behavior's action is executed, its activation is set to 0.0 and the candidate threshold is reset. If no behavior is selected, the candidate threshold is reduced.


selectBehavior

public Behavior selectBehavior(java.util.Collection<Behavior> behaviors,
                               double candidateThreshold)
Selects a behavior (containing an action) for execution. This implementation picks a behavior over candidate threshold and that has maximum activation (alpha) among all behaviors. If there is a tie then one behavior is selection randomly.

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

decayModule

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

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

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

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.

getCandidateThreshold

double getCandidateThreshold()
Gets candidate threshold.

Returns:
the current threshold a behavior must have to be a candidate for selection