clarion.system
Class HiddenRuleCollection

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<java.lang.Object,java.util.HashMap<java.lang.Integer,AbstractRule>>
          extended by clarion.system.HiddenRuleCollection
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.Object,java.util.HashMap<java.lang.Integer,AbstractRule>>

public class HiddenRuleCollection
extends java.util.HashMap<java.lang.Object,java.util.HashMap<java.lang.Integer,AbstractRule>>

This class implements a hidden rule collection within CLARION. It extends the HashMap class. This class is used exclusively within a rule collection for tracking child rules and rule variations.

Usage:

The hidden rule collection acts as a container for rules that are not explicitly accessible by a CLARION agent. That is, the rules contained within a hidden rule collection can't be used for action decision making.

Rules that are normally stored in the hidden rule collection include:

The hidden rule collection itself is a somewhat more simplified version of a rule collection in that it does not need to track (or generate) things like rule variations, child rules, or collection-wide match statistics. In addition, it doesn't have to worry about correctly placing newly added rules within the collection by determining if the rule should be in the collection or within the child collection.

Conceptually speaking, rules contained within a hidden rule collection really only exist "abstractly." It is important to reiterate that rules contained within this collection are NOT accessible to the CLARION agent for any purposes other than rule refinement.

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

Field Summary
private static long serialVersionUID
           
 
Constructor Summary
HiddenRuleCollection()
          Initializes a rule collection.
HiddenRuleCollection(java.util.Collection<? extends AbstractRule> rules)
          Initializes a rule collection with the collection of rules specified.
 
Method Summary
 boolean contains(AbstractRule rule)
          Checks to see if the collection contains the specified rule.
 void discountMatchStatistics(double Discount)
          Discounts the positive and negative match statistics for all rules in the rule collection.
 AbstractRule get(GeneralizedConditionChunk cond, AbstractAction act)
          Gets a rule in the collection that matches the specified condition and action.
 java.util.Collection<AbstractRule> getRules()
          Gets all of the rules in the rule collection.
 void put(AbstractRule R)
          Puts a rule into the rule collection.
 java.util.HashMap<java.lang.Integer,AbstractRule> put(java.lang.Object key, java.util.HashMap<java.lang.Integer,AbstractRule> map)
          This method does nothing.
 void putAll(java.util.Collection<? extends AbstractRule> R)
          Puts a collection of rules into the rule collection.
 void putAll(java.util.Map<? extends java.lang.Object,? extends java.util.HashMap<java.lang.Integer,AbstractRule>> map)
          This method does nothing.
 AbstractRule remove(GeneralizedConditionChunk cond, AbstractAction act)
          Removes the rule from this rule collection with the specified condition and action.
 java.util.HashMap<java.lang.Integer,AbstractRule> remove(java.lang.Object key)
          This method does nothing.
 int size()
          Returns the number of rules in the rule collection.
 java.lang.String toString()
           
 void updateMatchStatistics(DimensionValueCollection CurrentInput, AbstractAction ChosenAction, double feedback, AbstractMatchCalculator MatchCalculator, long TimeStamp)
          Updates the positive or negative match statistics based on the information specified.
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

serialVersionUID

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

HiddenRuleCollection

public HiddenRuleCollection()
Initializes a rule collection.


HiddenRuleCollection

public HiddenRuleCollection(java.util.Collection<? extends AbstractRule> rules)
Initializes a rule collection with the collection of rules specified.

Parameters:
rules - The rules for the collection.
Method Detail

get

public AbstractRule get(GeneralizedConditionChunk cond,
                        AbstractAction act)
Gets a rule in the collection that matches the specified condition and action. If the collection does not contain a rule with the specified condition and action, this method returns null.

Parameters:
cond - The condition of the rule to get.
act - The action of the rules to get.
Returns:
A rules with the specified condition and action.

contains

public boolean contains(AbstractRule rule)
Checks to see if the collection contains the specified rule.

Parameters:
rule - The rule object you wish to check for within this collection.
Returns:
True if the collection contains the rule specified, otherwise false.

put

public java.util.HashMap<java.lang.Integer,AbstractRule> put(java.lang.Object key,
                                                             java.util.HashMap<java.lang.Integer,AbstractRule> map)
This method does nothing. It has been overridden from HashMap to return null without performing an operation. Instead, use the overloaded put method that takes in an abstract rule as a parameter.

Specified by:
put in interface java.util.Map<java.lang.Object,java.util.HashMap<java.lang.Integer,AbstractRule>>
Overrides:
put in class java.util.HashMap<java.lang.Object,java.util.HashMap<java.lang.Integer,AbstractRule>>
Parameters:
key -
map -
Returns:
null

putAll

public void putAll(java.util.Map<? extends java.lang.Object,? extends java.util.HashMap<java.lang.Integer,AbstractRule>> map)
This method does nothing. It has been overridden from HashMap return without performing an operation. Instead, use the overloaded putAll method that takes in a collection of abstract rules.

Specified by:
putAll in interface java.util.Map<java.lang.Object,java.util.HashMap<java.lang.Integer,AbstractRule>>
Overrides:
putAll in class java.util.HashMap<java.lang.Object,java.util.HashMap<java.lang.Integer,AbstractRule>>
Parameters:
map -

remove

public java.util.HashMap<java.lang.Integer,AbstractRule> remove(java.lang.Object key)
This method does nothing. It has been overridden from HashMap to return null without performing an operation. Instead, use the overloaded remove method that takes in a condition and action.

Specified by:
remove in interface java.util.Map<java.lang.Object,java.util.HashMap<java.lang.Integer,AbstractRule>>
Overrides:
remove in class java.util.HashMap<java.lang.Object,java.util.HashMap<java.lang.Integer,AbstractRule>>
Parameters:
key -
Returns:
null

put

public void put(AbstractRule R)
Puts a rule into the rule collection. If the specified rule is equal to any rules currently in the collection, the rule will NOT be added. In addition, this method also removes all of the rule variations from the specified rule (if the rule is refineable) since it is not necessary to track variations for rules that are not in the rule store.

Parameters:
R - The rule to add.

putAll

public void putAll(java.util.Collection<? extends AbstractRule> R)
Puts a collection of rules into the rule collection. If a rule in the specified collection is equal to any rules currently in this collection, the rule will NOT be added.

Parameters:
R - The rules to put in the collection.

remove

public AbstractRule remove(GeneralizedConditionChunk cond,
                           AbstractAction act)
Removes the rule from this rule collection with the specified condition and action. If the rule collection does not contain a rule with the specified condition and action, this method returns null.

Parameters:
cond - The condition of the rule you want to remove.
act - The action of the rule you want to remove.
Returns:
The rule that was removed. If no rule was found in the collection, then null.

getRules

public java.util.Collection<AbstractRule> getRules()
Gets all of the rules in the rule collection.

Returns:
A collection containing the rules in the rule collection.

discountMatchStatistics

public void discountMatchStatistics(double Discount)
Discounts the positive and negative match statistics for all rules in the rule collection.

Parameters:
Discount - The discount factor to be applied to the match statistics of the rules.

updateMatchStatistics

public void updateMatchStatistics(DimensionValueCollection CurrentInput,
                                  AbstractAction ChosenAction,
                                  double feedback,
                                  AbstractMatchCalculator MatchCalculator,
                                  long TimeStamp)
Updates the positive or negative match statistics based on the information specified.

Parameters:
CurrentInput - The current input.
ChosenAction - The chosen action.
feedback - The feedback.
TimeStamp - The current time stamp.

size

public int size()
Returns the number of rules in the rule collection.

Specified by:
size in interface java.util.Map<java.lang.Object,java.util.HashMap<java.lang.Integer,AbstractRule>>
Overrides:
size in class java.util.HashMap<java.lang.Object,java.util.HashMap<java.lang.Integer,AbstractRule>>

toString

public java.lang.String toString()
Overrides:
toString in class java.util.AbstractMap<java.lang.Object,java.util.HashMap<java.lang.Integer,AbstractRule>>