xcseco
Class XClassifierSet

java.lang.Object
  |
  +--xcseco.XClassifierSet
All Implemented Interfaces:
java.io.Serializable

public class XClassifierSet
extends java.lang.Object
implements java.io.Serializable

This class handles the different sets of classifiers. It stores each set in an array. The array is initialized to a sufficient large size so that no changes in the size of the array will be necessary. The class provides constructors for constructing

It executes a GA in a set and updates classifier parameters of a set. Moreover, it provides all necessary different sums and averages of parameters in the set. Finally, it handles addition, deletion and subsumption of classifiers.

Since:
JDK1.1
Version:
XCSJava 1.0
Author:
Martin V. Butz
See Also:
Serialized Form

Constructor Summary
XClassifierSet(int numberOfActions)
          Creates a new, empty population initializing the population array to the maximal population size plus the number of possible actions.
XClassifierSet(java.lang.String state, XClassifierSet pop, int time, int numberOfActions)
          Constructs a match set out of the population.
XClassifierSet(XClassifierSet matchSet, int action)
          Constructs an action set out of the given match set.
 
Method Summary
 void confirmClassifiersInSet()
          Updates the numerositySum of the set and deletes all classifiers with numerosity 0.
 XClassifier elementAt(int i)
          Returns the classifier at the specified position.
 int getNumerositySum()
          Returns the number of micro-classifiers in the set.
 int getSize()
          Returns the number of macro-classifiers in the set.
 void printSet()
          Prints the classifier set to the control panel.
 void printSet(java.io.PrintWriter pW)
          Prints the classifier set to the specified print writer (which usually refers to a file).
 void runGA(int time, java.lang.String state, int numberOfActions)
          The Genetic Discovery in XCS takes place here.
 void updateSet(double maxPrediction, double reward)
          Updates all parameters in the current set (should be the action set).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XClassifierSet

public XClassifierSet(int numberOfActions)
Creates a new, empty population initializing the population array to the maximal population size plus the number of possible actions.
Parameters:
numberOfActions - The number of actions possible in the problem.
See Also:
XCSConstants.maxPopSize

XClassifierSet

public XClassifierSet(java.lang.String state,
                      XClassifierSet pop,
                      int time,
                      int numberOfActions)
Constructs a match set out of the population. After the creation, it is checked if the match set covers all possible actions in the environment. If one or more actions are not present, covering occurs, generating the missing action(s). If maximal population size is reached when covering, deletion occurs.
Parameters:
state - The current situation/problem instance.
time - The actual number of instances the XCS learned from so far.
numberOfActions - The number of actions possible in the environment.
See Also:
XClassifier.XClassifier(double,int,String,int), XCSConstants.maxPopSize, #deleteFromPopulation

XClassifierSet

public XClassifierSet(XClassifierSet matchSet,
                      int action)
Constructs an action set out of the given match set.
Parameters:
matchSet - The current match set
action - The chosen action for the action set.
Method Detail

updateSet

public void updateSet(double maxPrediction,
                      double reward)
Updates all parameters in the current set (should be the action set). Essentially, reinforcement Learning as well as the fitness evaluation takes place in this set. Moreover, the prediction error and the action set size estimate is updated. Also, action set subsumption takes place if selected. As in the algorithmic description, the fitness is updated after prediction and prediction error. However, in order to be more conservative the prediction error is updated before the prediction.
Parameters:
maxPrediction - The maximum prediction value in the successive prediction array (should be set to zero in single step environments).
reward - The actual resulting reward after the execution of an action.
See Also:
XCSConstants.gamma, XClassifier.increaseExperience(), XClassifier.updatePreError(double), XClassifier.updatePrediction(double), XClassifier.updateActionSetSize(double), #updateFitnessSet, XCSConstants.doActionSetSubsumption, #doActionSetSubsumption

runGA

public void runGA(int time,
                  java.lang.String state,
                  int numberOfActions)
The Genetic Discovery in XCS takes place here. If a GA takes place, two classifiers are selected by roulette wheel selection, possibly crossed and mutated and then inserted.
Parameters:
time - The actual number of instances the XCS learned from so far.
state - The current situation/problem instance.
numberOfActions - The number of actions possible in the environment.
See Also:
XCSConstants.theta_GA, #selectXClassifierRW, XClassifier.twoPointCrossover(xcseco.XClassifier), XClassifier.applyMutation(java.lang.String, int), XCSConstants.predictionErrorReduction, XCSConstants.fitnessReduction, #insertDiscoveredXClassifiers

confirmClassifiersInSet

public void confirmClassifiersInSet()
Updates the numerositySum of the set and deletes all classifiers with numerosity 0.

getNumerositySum

public int getNumerositySum()
Returns the number of micro-classifiers in the set.

elementAt

public XClassifier elementAt(int i)
Returns the classifier at the specified position.

getSize

public int getSize()
Returns the number of macro-classifiers in the set.

printSet

public void printSet()
Prints the classifier set to the control panel.

printSet

public void printSet(java.io.PrintWriter pW)
Prints the classifier set to the specified print writer (which usually refers to a file).
Parameters:
pW - The print writer that normally refers to a file writer.