MACS
Class ConditionCoveringManager

java.lang.Object
  |
  +--MACS.ConditionCoveringManager

final class ConditionCoveringManager
extends java.lang.Object

The ConditionCoveringManager class is in charge of adding new classifiers when no one matches the last situation experienced. The difficulty consists in setting the added classifier to the good level of generality. The only method called from outside is run().

Author:
Olivier Sigaud and Pierre Gérard.

Field Summary
private  MACS.ClassifierSystem classifierSystem
           
static boolean DEBUG
           
 
Constructor Summary
protected ConditionCoveringManager(MACS.ClassifierSystem cs)
           
 
Method Summary
private  Classifier.Perception buildCoveringCondition(Classifier.Perception lastPerception, MACS.AnticipatoryClassifierList classifierList)
          This method builds a general condition part for a new classifier that will be added in the system to cover the last transition.
private static MACS.PerceptionList generalizeByLevels(MACS.PerceptionList L1, MACS.PerceptionList L2, MACS.AnticipatoryClassifierList classifierList, int level)
          This method generates recursively a list of condition parts more general than those of the list it receives, checking that no condition in the list is in conflict with those of the classifierList
private  Classifier.Perception generalizeEvenMore(Classifier.Perception condition, MACS.AnticipatoryClassifierList classifierList)
          This method generalizes a condition part as much as possible to build a covering classifier.
private  boolean isTakenIntoAccount(MACS.AnticipatoryClassifierList classifierList, Classifier.Perception perception)
          This method checks whether the given Perception is matched by the condition part of any member of the classifierList, given that this list contains classifier whose action and effect part match the last action and the current situation.
protected  void run(Classifier.Perception lastPerception, Classifier.Action lastAction, Classifier.Perception currentPerception)
          The main method of the condition covering process.
private  MACS.AnticipatoryClassifierList[] splitClassifierSystemIntoConcernedSubsets(Classifier.Action lastAction, Classifier.Perception currentPerception)
          This method scatters the model of Transitions into subsets For each classifier, if the classifier matches the current perception/action couple, it is put into a set whose index corresponds to its first specialized symbol.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static boolean DEBUG

classifierSystem

private MACS.ClassifierSystem classifierSystem
Constructor Detail

ConditionCoveringManager

protected ConditionCoveringManager(MACS.ClassifierSystem cs)
Parameters:
cs -
Method Detail

splitClassifierSystemIntoConcernedSubsets

private MACS.AnticipatoryClassifierList[] splitClassifierSystemIntoConcernedSubsets(Classifier.Action lastAction,
                                                                                    Classifier.Perception currentPerception)
This method scatters the model of Transitions into subsets For each classifier, if the classifier matches the current perception/action couple, it is put into a set whose index corresponds to its first specialized symbol. This method should disappear : MACS should make one model per attribute, so that no scattering is necessary...

Parameters:
lastAction -
currentPerception -
Returns:
MACS.AnticipatoryClassifierList[]

isTakenIntoAccount

private boolean isTakenIntoAccount(MACS.AnticipatoryClassifierList classifierList,
                                   Classifier.Perception perception)
This method checks whether the given Perception is matched by the condition part of any member of the classifierList, given that this list contains classifier whose action and effect part match the last action and the current situation.

Parameters:
classifierList - the list among which we look for a matcher
perception - the perception to be matched by the group
Returns:
boolean true if one matches.

generalizeByLevels

private static MACS.PerceptionList generalizeByLevels(MACS.PerceptionList L1,
                                                      MACS.PerceptionList L2,
                                                      MACS.AnticipatoryClassifierList classifierList,
                                                      int level)
This method generates recursively a list of condition parts more general than those of the list it receives, checking that no condition in the list is in conflict with those of the classifierList

Parameters:
L1 - the initial list of conditions to be genralized
L2 - a list of more general conditions than those in L1
classifierList - the list of similar classifiers matching the action and the effect, but not the last perception
Returns:
MACS.PerceptionList

generalizeEvenMore

private Classifier.Perception generalizeEvenMore(Classifier.Perception condition,
                                                 MACS.AnticipatoryClassifierList classifierList)
This method generalizes a condition part as much as possible to build a covering classifier. The process still needs to be understood.

Parameters:
condition - a tentative condition part matching the last perception that should be generalized further
Returns:
Classifier.Perception one of the more general condition parts needed to build a new classifier

buildCoveringCondition

private Classifier.Perception buildCoveringCondition(Classifier.Perception lastPerception,
                                                     MACS.AnticipatoryClassifierList classifierList)
This method builds a general condition part for a new classifier that will be added in the system to cover the last transition. From each classifier of the classifierList, we build a new condition part which matches the last perception, and we generalize it as much as possible. Among all such conditions, we keep all that are maximally general, and we keep one at random among them. This one is generalized further before being returned.

Parameters:
lastPerception - the perception to be covered
classifierList - the list of similar classifiers matching the action and the effect, but not the last perception
Returns:
Classifier.Perception the general condition part needed to build a new classifier

run

protected void run(Classifier.Perception lastPerception,
                   Classifier.Action lastAction,
                   Classifier.Perception currentPerception)
The main method of the condition covering process. First, the classifiers matching the last action and whose effect part matches the current perception is split into sets corresponding to the specific attributes in the effect part. Then, in each such set, we check if the lastPerception is matched. If it is not, we build a new classifier matching this transition, whose condition part is as general as possible. This last step is acheived by buildCoveringCondition() (see above).

Parameters:
lastPerception - the previous perception of the agent
lastAction - the previous action of the agent
currentPerception - the current perception of the agent