clarion.system
Class GeneralizedConditionChunk

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<K,V>
          extended by java.util.LinkedHashMap<java.lang.Object,Dimension>
              extended by clarion.system.DimensionValueCollection
                  extended by clarion.system.GeneralizedConditionChunk
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.Object,Dimension>

public class GeneralizedConditionChunk
extends DimensionValueCollection

This class implements a generalized condition chunk within CLARION. It extends the DimensionValueCollection class.

Usage:

A condition usually contains the same dimension-value pairs as (or a same set of) the input nodes of an implicit module and generally has the same structure as the bottom level to which it is related (or from which it was extracted).

Values within a dimension in a condition are OR linked; whereas dimensions themselves are AND linked. This means that multiple values within the same dimension can have activations greater than 0. This is different than the sensory input (or a dimension-value collection in general), which can only have at most 1 activated value for any dimension.

Note that while we refer to the condition of a rule as a "chunk", it is not the same as a chunk as defined by the CLARION theory (as well as the AbstractChunk class within this library). The condition chunk is a specialized kind of chunk in that it does not have an ID, and it has special methods for calculating its strength when compared to another dimension-value collection (usually the current input).

Version:
6.0.4
Author:
Nick Wilson
See Also:
Serialized Form

Field Summary
private static long serialVersionUID
           
 
Constructor Summary
GeneralizedConditionChunk()
          Initializes a condition.
GeneralizedConditionChunk(java.util.Collection<? extends Dimension> dims)
          Initializes a condition with the collection of dimensions specified.
GeneralizedConditionChunk(java.util.Map<? extends java.lang.Object,? extends Dimension> map)
          Initializes the condition with the map of dimensions.
 
Method Summary
 boolean checkMatchAll()
           
 GeneralizedConditionChunk clone()
          Clones the condition (including all of it's dimensions).
 boolean covers(GeneralizedConditionChunk cond)
          Checks to see if the specified condition is covered by this condition.
 double getStrength(java.util.Collection<? extends Dimension> CurrentInput)
          Gets the strength of the condition based on the current input.
 double getWeight()
          Gets the weight of the condition.
 int hashCode()
          This method uses a special hash function based on the activations of the values within the condition.
 
Methods inherited from class clarion.system.DimensionValueCollection
containsKeys, equals, getNumDVPairs, getValueCollection, put, putAll, size, toString
 
Methods inherited from class java.util.LinkedHashMap
clear, containsValue, get, removeEldestEntry
 
Methods inherited from class java.util.HashMap
containsKey, entrySet, isEmpty, keySet, remove, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
containsKey, entrySet, isEmpty, keySet, remove, values
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

GeneralizedConditionChunk

public GeneralizedConditionChunk()
Initializes a condition.


GeneralizedConditionChunk

public GeneralizedConditionChunk(java.util.Collection<? extends Dimension> dims)
Initializes a condition with the collection of dimensions specified.

Parameters:
dims - The dimensions for the collection.

GeneralizedConditionChunk

public GeneralizedConditionChunk(java.util.Map<? extends java.lang.Object,? extends Dimension> map)
Initializes the condition with the map of dimensions.

Parameters:
map - The map of dimensions for the collection.
Method Detail

getWeight

public double getWeight()
Gets the weight of the condition. By default this is 1/n where n is the number of dimensions.

Returns:
The weight of the weight

getStrength

public double getStrength(java.util.Collection<? extends Dimension> CurrentInput)
Gets the strength of the condition based on the current input.

Parameters:
CurrentInput - The current input.
Returns:
The strength of the condition.

covers

public boolean covers(GeneralizedConditionChunk cond)
Checks to see if the specified condition is covered by this condition.

Parameters:
cond - The condition to check against this condition.
Returns:
True if this condition covers the specified condition, otherwise false.

checkMatchAll

public boolean checkMatchAll()

hashCode

public int hashCode()
This method uses a special hash function based on the activations of the values within the condition. The hash is created by summing the hashes of all the values within the condition multiplied by the activation of those values. Written mathematically, it looks like:
Hash = Sum(ValueHash * ValueActivation)

If the condition is empty (i.e. it has no dimension-value pairs, which is an option in fixed rules), this method will return the default system hash code.

Specified by:
hashCode in interface java.util.Map<java.lang.Object,Dimension>
Overrides:
hashCode in class DimensionValueCollection
Returns:
The hash code for the condition.

clone

public GeneralizedConditionChunk clone()
Clones the condition (including all of it's dimensions).

Overrides:
clone in class DimensionValueCollection
Returns:
A copy of the condition.