edu.memphis.ccrg.lida.proceduralmemory
Class SchemeImpl

java.lang.Object
  extended by edu.memphis.ccrg.lida.framework.initialization.InitializableImpl
      extended by edu.memphis.ccrg.lida.framework.shared.activation.ActivatibleImpl
          extended by edu.memphis.ccrg.lida.framework.shared.activation.LearnableImpl
              extended by edu.memphis.ccrg.lida.proceduralmemory.SchemeImpl
All Implemented Interfaces:
Initializable, Activatible, Learnable, ProceduralUnit, Scheme

public class SchemeImpl
extends LearnableImpl
implements Scheme

Default implementation of Scheme.

Author:
Ryan J. McCall, Javier Snaider

Field Summary
 
Fields inherited from interface edu.memphis.ccrg.lida.framework.shared.activation.Learnable
DEFAULT_BASE_LEVEL_ACTIVATION, DEFAULT_LEARNABLE_REMOVAL_THRESHOLD
 
Fields inherited from interface edu.memphis.ccrg.lida.framework.shared.activation.Activatible
DEFAULT_ACTIVATIBLE_REMOVAL_THRESHOLD, DEFAULT_ACTIVATION
 
Constructor Summary
SchemeImpl()
          Constructs a new scheme with default values
SchemeImpl(int id)
          Deprecated. 
SchemeImpl(java.lang.String label, Action a)
          Deprecated. 
 
Method Summary
 void actionExecuted()
          Called when Scheme's action is executed Scheme should update the number of times its action has been executed in order to calculate reliability.
 void actionSuccessful()
          Called when Scheme's action produces expected result.
 boolean addCondition(Condition c, ProceduralMemoryImpl.ConditionType type)
          Adds the context condition.
 void decayBaseLevelActivation(long ticks)
          decay the Base Level activation using the decay strategy.
 boolean equals(java.lang.Object o)
           
 Action getAction()
          Gets action.
 double getActivation()
          Returns the current activation of this activatible
 java.util.Collection<Condition> getAddingList()
          Gets adding list.
(package private) static double getAddingListWeight()
           
protected  double getAverageAddingListNetDesirability()
          Gets the average net desirability of this unit's adding list
protected  double getAverageContextActivation()
          Gets the average activation of this unit's context conditions.
(package private)  Condition getContextCondition(java.lang.Object id)
          Gets context condition specified by id
 java.util.Collection<Condition> getContextConditions()
          Gets context conditions.
(package private) static double getContextWeight()
           
 java.util.Collection<Condition> getDeletingList()
          Gets deleting list.
 int getId()
          Gets scheme's id.
 java.lang.String getLabel()
          Gets the label.
 int getNumExecutions()
          Gets the number of executions
 double getReliability()
          Returns reliability
(package private) static double getReliabilityThreshold()
          Gets reliabilityThreshold
 int hashCode()
           
 boolean isInnate()
           
 boolean isReliable()
           
 void setAction(Action a)
          Sets action
(package private) static void setAddingListWeight(double w)
           
(package private) static void setContextWeight(double w)
           
 void setId(int id)
          Sets unique identifier for Scheme.
 void setInnate(boolean in)
          Sets innate
 void setLabel(java.lang.String label)
          Sets Scheme's label
(package private)  void setProceduralMemory(ProceduralMemoryImpl pm)
          Sets the ProceduralMemoryImpl to which this SchemeImpl belongs.
(package private) static void setReliabilityThreshold(double t)
          Sets reliabilityThreshold
 java.lang.String toString()
           
 
Methods inherited from class edu.memphis.ccrg.lida.framework.shared.activation.LearnableImpl
decay, getBaseLevelActivation, getBaseLevelDecayStrategy, getBaseLevelExciteStrategy, getLearnableRemovalThreshold, getTotalActivation, getTotalActivationStrategy, init, isRemovable, reinforceBaseLevelActivation, setBaseLevelActivation, setBaseLevelDecayStrategy, setBaseLevelExciteStrategy, setBaseLevelRemovalThreshold, setTotalActivationStrategy
 
Methods inherited from class edu.memphis.ccrg.lida.framework.shared.activation.ActivatibleImpl
excite, getActivatibleRemovalThreshold, getDecayStrategy, getExciteStrategy, setActivatibleRemovalThreshold, setActivation, setDecayStrategy, setExciteStrategy
 
Methods inherited from class edu.memphis.ccrg.lida.framework.initialization.InitializableImpl
containsParameter, getParam, getParameters, init
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.memphis.ccrg.lida.framework.shared.activation.Learnable
getBaseLevelActivation, getBaseLevelDecayStrategy, getBaseLevelExciteStrategy, getLearnableRemovalThreshold, getTotalActivationStrategy, reinforceBaseLevelActivation, setBaseLevelActivation, setBaseLevelDecayStrategy, setBaseLevelExciteStrategy, setBaseLevelRemovalThreshold, setTotalActivationStrategy
 
Methods inherited from interface edu.memphis.ccrg.lida.framework.shared.activation.Activatible
decay, excite, getActivatibleRemovalThreshold, getDecayStrategy, getExciteStrategy, getTotalActivation, isRemovable, setActivatibleRemovalThreshold, setActivation, setDecayStrategy, setExciteStrategy
 
Methods inherited from interface edu.memphis.ccrg.lida.framework.initialization.Initializable
containsParameter, getParam, getParameters, init, init
 

Constructor Detail

SchemeImpl

SchemeImpl()
Constructs a new scheme with default values


SchemeImpl

@Deprecated
SchemeImpl(java.lang.String label,
                      Action a)
Deprecated. 

Intended for testing only

Parameters:
label - String
a - Action

SchemeImpl

@Deprecated
SchemeImpl(int id)
Deprecated. 

Intended for testing only

Parameters:
id - Scheme's id
Method Detail

setProceduralMemory

void setProceduralMemory(ProceduralMemoryImpl pm)
Sets the ProceduralMemoryImpl to which this SchemeImpl belongs.

Parameters:
pm - a ProceduralMemoryImpl
See Also:
ProceduralMemoryImpl.getNewScheme(Action)

setContextWeight

static void setContextWeight(double w)
Parameters:
w - the contextWeight to set

getContextWeight

static double getContextWeight()
Returns:
the contextWeight

setAddingListWeight

static void setAddingListWeight(double w)
Parameters:
w - the addingListWeight to set

getAddingListWeight

static double getAddingListWeight()
Returns:
the addingListWeight

setId

public void setId(int id)
Description copied from interface: ProceduralUnit
Sets unique identifier for Scheme. Should be used by ElementFactory only.

Specified by:
setId in interface ProceduralUnit
Parameters:
id - unique identifier for this scheme

getId

public int getId()
Description copied from interface: ProceduralUnit
Gets scheme's id.

Specified by:
getId in interface ProceduralUnit
Returns:
unique identifier for this scheme

actionExecuted

public void actionExecuted()
Description copied from interface: Scheme
Called when Scheme's action is executed Scheme should update the number of times its action has been executed in order to calculate reliability.

Specified by:
actionExecuted in interface Scheme

actionSuccessful

public void actionSuccessful()
Description copied from interface: Scheme
Called when Scheme's action produces expected result.

Specified by:
actionSuccessful in interface Scheme

getReliability

public double getReliability()
Description copied from interface: Scheme
Returns reliability

Specified by:
getReliability in interface Scheme
Returns:
frequency that result is observed after scheme's Action is taken.

isReliable

public boolean isReliable()
Specified by:
isReliable in interface Scheme
Returns:
true if reliability is over threshold

setInnate

public void setInnate(boolean in)
Description copied from interface: Scheme
Sets innate

Specified by:
setInnate in interface Scheme
Parameters:
in - whether this Scheme is hard-wired and cannot be decayed.

isInnate

public boolean isInnate()
Specified by:
isInnate in interface Scheme
Returns:
true if this scheme should not be decayed.

getAverageContextActivation

protected double getAverageContextActivation()
Gets the average activation of this unit's context conditions.

Returns:
average activation of unit's context

getAverageAddingListNetDesirability

protected double getAverageAddingListNetDesirability()
Gets the average net desirability of this unit's adding list

Returns:
average net desirability of this unit's adding list

decayBaseLevelActivation

public void decayBaseLevelActivation(long ticks)
Description copied from interface: Learnable
decay the Base Level activation using the decay strategy. The decay depends on the time since the last decaying. It is indicated by the parameter ticks.

Specified by:
decayBaseLevelActivation in interface Learnable
Overrides:
decayBaseLevelActivation in class LearnableImpl
Parameters:
ticks - the number of ticks to decay

getActivation

public double getActivation()
Description copied from interface: Activatible
Returns the current activation of this activatible

Specified by:
getActivation in interface Activatible
Overrides:
getActivation in class ActivatibleImpl
Returns:
the current activation.

getNumExecutions

public int getNumExecutions()
Description copied from interface: Scheme
Gets the number of executions

Specified by:
getNumExecutions in interface Scheme
Returns:
how many times this scheme's action has been executed

getReliabilityThreshold

static double getReliabilityThreshold()
Gets reliabilityThreshold

Returns:
threshold of reliability

setReliabilityThreshold

static void setReliabilityThreshold(double t)
Sets reliabilityThreshold

Parameters:
t - threshold of reliability

addCondition

public boolean addCondition(Condition c,
                            ProceduralMemoryImpl.ConditionType type)
Description copied from interface: Scheme
Adds the context condition.

Specified by:
addCondition in interface Scheme
Parameters:
c - the condition
type - the usage type of the condition
Returns:
true, if successful
See Also:
ProceduralMemoryImpl.ConditionType

setAction

public void setAction(Action a)
Description copied from interface: Scheme
Sets action

Specified by:
setAction in interface Scheme
Parameters:
a - Action this unit contains

getContextConditions

public java.util.Collection<Condition> getContextConditions()
Description copied from interface: ProceduralUnit
Gets context conditions.

Specified by:
getContextConditions in interface ProceduralUnit
Returns:
the context's conditions

getAddingList

public java.util.Collection<Condition> getAddingList()
Description copied from interface: ProceduralUnit
Gets adding list.

Specified by:
getAddingList in interface ProceduralUnit
Returns:
the adding list

getDeletingList

public java.util.Collection<Condition> getDeletingList()
Description copied from interface: ProceduralUnit
Gets deleting list.

Specified by:
getDeletingList in interface ProceduralUnit
Returns:
the deleting list

getAction

public Action getAction()
Description copied from interface: ProceduralUnit
Gets action.

Specified by:
getAction in interface ProceduralUnit
Returns:
the Action this unit contains

getLabel

public java.lang.String getLabel()
Description copied from interface: ProceduralUnit
Gets the label.

Specified by:
getLabel in interface ProceduralUnit
Returns:
label of the unit

setLabel

public void setLabel(java.lang.String label)
Description copied from interface: ProceduralUnit
Sets Scheme's label

Specified by:
setLabel in interface ProceduralUnit
Parameters:
label - a String

getContextCondition

Condition getContextCondition(java.lang.Object id)
Gets context condition specified by id

Parameters:
id - condition id
Returns:
a Condition or null

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object