|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--XClassifierSetManager
This class handles the different sets of classifiers for the manager (identical as XClassifierSet for agents). 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
| Field Summary | |
private int |
cllSize
The actual number of macro-classifiers in the list (which is in fact equal to the number of entries in the array). |
private XClassifierManager[] |
clSet
The classifier list (in form of an array) |
private static XCSConstantsManager |
cons
The cons parameter is necessary for all kinds of calculations in the set. |
private int |
nbAnswers
number of answers collected during the communication process |
private int |
numerositySum
The Sum of the numerosity in one set is always kept up to date! |
private XClassifierSetManager |
parentSet
Each set keeps a reference to the parent set out of which it was generated. |
| Constructor Summary | |
XClassifierSetManager(int numberOfActions)
Creates a new, empty population initializing the population array to the maximal population size plus the number of possible actions. |
|
XClassifierSetManager(int numberOfActions,
int conLength)
A new random population |
|
XClassifierSetManager(java.lang.String state,
XClassifierSetManager pop,
int numberOfActions)
Constructs a match set out of the population. |
|
XClassifierSetManager(java.lang.String state,
XClassifierSetManager pop,
int numberOfActions,
AgentsPopulations wholePop,
int time)
Constructs a match set out of the population. |
|
XClassifierSetManager(java.lang.String state,
XClassifierSetManager pop,
int time,
int numberOfActions)
Constructs a match set out of the population. |
|
XClassifierSetManager(XClassifierSetManager matchSet,
int action)
Constructs an action set out of the given match set. |
|
XClassifierSetManager(XCSConstants cons)
Construct the list of classifier candidate for answering a question |
|
| Method Summary | |
private void |
addClassifier(XClassifierManager classifier)
Adds a classifier to the set and increases the numerositySum value accordingly. |
private void |
addValues(XClassifierManager cl)
Increases the numerositySum value with the numerosity of the classifier. |
void |
addXClassifierToPopulation(XClassifierManager cl)
Adds the classifier to the population and checks if an identical classifier exists. |
private double |
computeDispersion()
Computes the dispersion of classifiers in the population, that is the sum of variances along the X axis and variance along Y axis |
private double |
computeVariance(int[] listCoord)
Computes variance along one dimension (X or Y) |
void |
confirmClassifiersInSet()
Updates the numerositySum of the set and deletes all classifiers with numerosity 0. |
private int |
containsClassifier(XClassifierManager cl)
Returns the position of the classifier in the set if it is present and -1 otherwise. |
private int |
decode(char[] binary,
int size)
Turns a binary string into an integer |
XClassifierManager |
deleteFromPopulation()
Deletes one classifier in the population. |
private void |
doActionSetSubsumption()
Executes action set subsumption. |
XClassifierManager |
elementAt(int i)
Returns the classifier at the specified position. |
double |
getActionSetSizeSum()
Returns the sum of the fitnesses of all classifiers in the set. |
XClassifierManager[] |
getAnswerSet()
returns the array of answering classifiers |
double |
getAverageExperience()
Returns the average experience of the classifier set |
double |
getAverageFitness()
Returns the average Fitness of the classifier set |
double |
getAveragePerformance()
Returns the average performance of the classifier set |
double |
getAveragePredictionError()
Returns the average error of the classifier set |
XClassifierManager[] |
getClSet()
|
int |
getCollAnsSize()
returns the number of answers in the array used to pass the answers from one agent to another |
private double |
getExperienceSum()
Returns the sum of experiences in the population of classifiers |
double |
getFitnessSum()
Returns the sum of the fitnesses of all classifiers in the set. |
private XClassifierManager |
getIdenticalClassifier(XClassifierManager newCl)
Looks for an identical classifier in the population. |
int |
getNumerositySum()
Return the numerosity of the population of classifiers of one agent |
private double |
getPredictionErrorSum()
Returns the sum of errors in the population of classifiers |
private double |
getPredictionSum()
Returns the sum of the prediction values of all classifiers in the set. |
int |
getSize()
Returns the number of macro-classifiers in the set. |
double |
getTimeStampAverage()
Returns the average of the time stamps in the set. |
private double |
getTimeStampSum()
Returns the sum of the time stamps of all classifiers in the set. |
private void |
increaseNumerositySum(int nr)
Increases recursively all numerositySum values in the set and all parent sets. |
void |
increaseSize()
update the size of the array of answers collected |
private void |
insertDiscoveredXClassifiersManager(XClassifierManager cl1,
XClassifierManager cl2,
XClassifierManager cl1P,
XClassifierManager cl2P)
Inserts both discovered classifiers keeping the maximal size of the population and possibly doing GA subsumption. |
private boolean |
isActionCovered(int action)
Returns if the specified action is covered in this set. |
void |
printCharacteristics(java.io.PrintWriter pW)
print characteristics into a file |
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). |
private boolean |
removeClassifier(int pos)
Removes the (possible macro-) classifier at the specified array position from the population. |
private boolean |
removeClassifier(XClassifierManager classifier)
Removes the specified (possible macro-) classifier from the population. |
void |
runGAManager(int time,
java.lang.String state,
int numberOfActions)
The Genetic Discovery in XCS takes place here. |
private XClassifierManager |
selectXClassifierRW(double fitSum)
Selects one classifier using roulette wheel selection according to the fitnesses of the classifiers. |
private void |
setTimeStamps(int time)
Sets the time stamp of all classifiers in the set to the current time. |
private void |
subsumeXClassifier(XClassifierManager cl)
Tries to subsume a classifier in the current set. |
private void |
subsumeXClassifier(XClassifierManager cl,
XClassifierManager cl1P,
XClassifierManager cl2P)
Tries to subsume a classifier in the parents. |
boolean |
testFitness(double averFit)
Tests if the fitness of a classifier is above the average performance of the population of classifiers |
boolean |
testPerformance(double averPerf)
Tests if the performance of a classifier is above the average performance of the population of classifiers |
private void |
updateFitnessSet()
Special function for updating the fitnesses of the classifiers in the set. |
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 |
| Field Detail |
private static XCSConstantsManager cons
XCSConstantsManager.XCSConstantsManager()private int numerositySum
private XClassifierSetManager parentSet
private XClassifierManager[] clSet
private int cllSize
private int nbAnswers
| Constructor Detail |
public XClassifierSetManager(int numberOfActions)
numberOfActions - The number of actions possible in the problemXCSConstantsManager.maxPopSize
public XClassifierSetManager(int numberOfActions,
int conLength)
numberOfActions - The number of actions possible in the problemconLength - The length of the condition part of classifiersXCSConstantsManager.maxPopSize,
XClassifierManager.XClassifierManager(double, int, int, int)
public XClassifierSetManager(java.lang.String state,
XClassifierSetManager pop,
int numberOfActions)
state - The current situation/problem instance.numberOfActions - The number of actions possible in the environment.XClassifierManager.XClassifierManager(double,int,String,int),
XCSConstantsManager.maxPopSize,
XClassifierManager#match(XClassifierManager),
addClassifier(XClassifierManager)
public XClassifierSetManager(java.lang.String state,
XClassifierSetManager pop,
int numberOfActions,
AgentsPopulations wholePop,
int time)
state - The current situation/problem instance.numberOfActions - The number of actions possible in the environment.wholePop - The total population of agentstime - The actual number of instances the XCS learned from so far.XClassifierManager.XClassifierManager(double,int,String,int),
XCSConstantsManager.maxPopSize,
Agent.getCloseState(String, AgentsPopulations),
addClassifier(XClassifierManager)
public XClassifierSetManager(java.lang.String state,
XClassifierSetManager pop,
int time,
int numberOfActions)
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.XClassifierManager.XClassifierManager(double,int,String,int),
XCSConstantsManager.maxPopSize,
XClassifierManager.match(String),
addClassifier(XClassifierManager),
deleteFromPopulation()
public XClassifierSetManager(XClassifierSetManager matchSet,
int action)
matchSet - The current match setaction - The chosen action for the action set.public XClassifierSetManager(XCSConstants cons)
cons - The set of constants used in the XCSXCSConstantsManager.maxPopSize| Method Detail |
public int getCollAnsSize()
public XClassifierManager[] getAnswerSet()
public void increaseSize()
private int containsClassifier(XClassifierManager cl)
cl - the considered classifierprivate boolean isActionCovered(int action)
action - The action of interest
public void updateSet(double maxPrediction,
double reward)
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.XCSConstantsManager.gamma,
XClassifierManager.increaseExperience(),
XClassifierManager.updatePreError(double),
XClassifierManager.updatePrediction(double),
XClassifierManager#updateActionSetSize(int),
updateFitnessSet(),
XCSConstantsManager.doActionSetSubsumption,
doActionSetSubsumption()private void updateFitnessSet()
XClassifierManager.updateFitness(double, double)
public void runGAManager(int time,
java.lang.String state,
int numberOfActions)
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.XCSConstantsManager.theta_GA,
selectXClassifierRW(double),
XClassifierManager.twoPointCrossover(XClassifierManager),
XClassifierManager.applyMutation(java.lang.String, int),
XCSConstantsManager.predictionErrorReduction,
XCSConstantsManager.fitnessReduction,
#insertDiscoveredXClassifiersprivate XClassifierManager selectXClassifierRW(double fitSum)
fitSum - the sum of the fitness of the classifiers in the setXCSConstantsManager.drand()
private void insertDiscoveredXClassifiersManager(XClassifierManager cl1,
XClassifierManager cl2,
XClassifierManager cl1P,
XClassifierManager cl2P)
cl1 - The first classifier generated by the GA.cl2 - The second classifier generated by the GA.cl1P - The first parent of the two new classifiers.cl2P - The second classifier of the two new classifiers.XCSConstantsManager.doGASubsumption,
subsumeXClassifier(XClassifierManager, XClassifierManager, XClassifierManager),
addXClassifierToPopulation(XClassifierManager),
XCSConstantsManager.maxPopSize,
deleteFromPopulation()
private void subsumeXClassifier(XClassifierManager cl,
XClassifierManager cl1P,
XClassifierManager cl2P)
cl - the newly generated classifier to be subsumedcl1P - the first parent of the classifiercl2P - the second parent of the classifiersubsumeXClassifier(XClassifierManager)private void subsumeXClassifier(XClassifierManager cl)
cl - The classifier that may be subsumed.addXClassifierToPopulation(XClassifierManager)private void doActionSetSubsumption()
XClassifierManager.isSubsumer(),
XClassifierManager.isMoreGeneral(XClassifierManager)public void addXClassifierToPopulation(XClassifierManager cl)
cl - The to be added classifier.getIdenticalClassifier(XClassifierManager)public int getNumerositySum()
private XClassifierManager getIdenticalClassifier(XClassifierManager newCl)
newCl - The new classifier.
public XClassifierManager deleteFromPopulation()
XClassifierManager.getDelProp(double, double)public void confirmClassifiersInSet()
private void setTimeStamps(int time)
time - The actual number of instances the XCS learned from so far.private void addClassifier(XClassifierManager classifier)
classifier - The to be added classifier.private void addValues(XClassifierManager cl)
cl - the considered classifierprivate void increaseNumerositySum(int nr)
nr - the number by which numerosity should be increasedprivate boolean removeClassifier(XClassifierManager classifier)
classifier - the considered classifierprivate boolean removeClassifier(int pos)
pos - the position of the classifier to be removed in the population arrayprivate double getPredictionSum()
XClassifierManager.getPrediction(),
XClassifierManager.getNumerosity()private double getExperienceSum()
XClassifierManager.getExperience(),
XClassifierManager.getNumerosity()private double getPredictionErrorSum()
XClassifierManager.getPredictionError(),
XClassifierManager.getNumerosity()public double getFitnessSum()
XClassifierManager.getFitness()public double getActionSetSizeSum()
XClassifierManager#get()private double getTimeStampSum()
XClassifierManager.getTimeStamp(),
XClassifierManager.getNumerosity()public XClassifierManager elementAt(int i)
i - The position specifiedpublic int getSize()
public double getTimeStampAverage()
public void printSet()
XClassifierManager.printXClassifier()public void printSet(java.io.PrintWriter pW)
pW - The print writer that normally refers to a file writer.XClassifierManager.printXClassifier(PrintWriter)public double getAveragePerformance()
public double getAverageFitness()
public double getAverageExperience()
public double getAveragePredictionError()
public boolean testPerformance(double averPerf)
averPerf - The average performance of the populationpublic boolean testFitness(double averFit)
averFit - The average fitness of the populationprivate double computeDispersion()
decode(char[], int),
computeVariance(int[])
private int decode(char[] binary,
int size)
binary - The binary stringsize - The length of the stringprivate double computeVariance(int[] listCoord)
listCoord - The list of coordinates of which variance is computedpublic void printCharacteristics(java.io.PrintWriter pW)
pW - The print writer that normally refers to a file writercomputeDispersion()public XClassifierManager[] getClSet()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||