|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.ObjectsimuLCS.ClassifierSet
simuLCS.ZClassifierSet
Implements the main functions of our ZCS. A few lines of code (roulette Wheel, creation of the Match Set using covering) below draw inspiration from the freely available XCSJava by Martin V. Butz
| Field Summary | |
private static int |
maxPopSize
|
| Fields inherited from class simuLCS.ClassifierSet |
classifiers, isSorted, template |
| Constructor Summary | |
ZClassifierSet(Template t)
Creates a new, empty population. |
|
ZClassifierSet(Template t,
boolean isSort)
Creates an empty set that can be ranked if isSort = true |
|
ZClassifierSet(Template t,
int initialSize)
Creates a Set with initialSize random classifiers |
|
ZClassifierSet(Template t,
int initialSize,
ZClassifier init)
Creates a ZClassifierSet with initialSize copies of
the classifier init. |
|
| Method Summary | |
private void |
addClassifierMaintainingSize(ZClassifier classifier)
Adds a classifier to the set. |
ClassifierSet |
getActionSet()
By convention, the default Action Set is generated with a Roulette Wheel |
private double |
getAverageStrength()
|
private ZClassifier |
getIdenticalClassifier(ZClassifier newCl)
Looks for an identical classifier in the population. |
ZClassifierSet |
getMatchSet(java.lang.String state,
ZClassifierSet pop)
Constructs a match set out of the population. |
ZClassifierSet |
getRandomActionSet(int nbOfClassifiers)
Constructs a random action set out of the given match set. |
ZClassifierSet |
getRWActionSet(int nbOfClassifiers)
Get an Action Set from the current set, by selecting nbOfClassifiers
using the Roulette Wheel |
private double |
getSumStrength()
|
ZClassifier[] |
giveBestClassifiers(int nbFromTop)
Returns an array with the classifier ranked according to their strength |
private boolean |
isActionCovered(java.lang.String act)
Returns true if the specified action is covered in this set. |
void |
printBestInSet(int i)
Prints to the console the i best classifiers of the population |
private boolean |
removeClassifier(ZClassifier classifier)
Removes the specified classifier from the population. |
private boolean |
removeClassifierRW()
Remove a classifier using probability proportional to the inverse of their strengths (inverse Roulette wheel) |
void |
runGA(int timeSteps,
java.lang.String state,
ZClassifierSet pop)
The Genetic Algorithm for the ZCS. |
private ZClassifier |
selectClassifierRW()
Selects one classifier using roulette wheel selection according to the fitnesses of the classifiers. |
void |
updateSet(double reward,
double maxReward)
Updates the Set, with the technique we designed |
| Methods inherited from class simuLCS.ClassifierSet |
addClassifier, addClassifierSet, contains, getClassifiers, getIterator, getMatchSet, getSize, getTemplate, removeClassifier, setTemplate, toString |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
private static final int maxPopSize
| Constructor Detail |
public ZClassifierSet(Template t)
ClassifierSet
public ZClassifierSet(Template t,
boolean isSort)
isSort = true
t - isSort -
public ZClassifierSet(Template t,
int initialSize)
initialSize random classifiers
t - initialSize -
public ZClassifierSet(Template t,
int initialSize,
ZClassifier init)
initialSize copies of
the classifier init.
| Method Detail |
public ZClassifierSet getMatchSet(java.lang.String state,
ZClassifierSet pop)
Set implementation.
state - the situation that shoud satisfy the conditions of the classifierspop - the Population in which the new classifiers should be insertedpublic ZClassifierSet getRandomActionSet(int nbOfClassifiers)
nbOfClassifiers - the number of classifiers to selectpublic ClassifierSet getActionSet()
getActionSet in class ClassifierSetClassifierSet.getActionSet()public ZClassifierSet getRWActionSet(int nbOfClassifiers)
nbOfClassifiers
using the Roulette Wheel
nbOfClassifiers -
public void updateSet(double reward,
double maxReward)
reward - maxReward - private double getAverageStrength()
private double getSumStrength()
private boolean isActionCovered(java.lang.String act)
public void runGA(int timeSteps,
java.lang.String state,
ZClassifierSet pop)
private ZClassifier selectClassifierRW()
private ZClassifier getIdenticalClassifier(ZClassifier newCl)
newCl - The new classifier.
private void addClassifierMaintainingSize(ZClassifier classifier)
private boolean removeClassifierRW()
private boolean removeClassifier(ZClassifier classifier)
public ZClassifier[] giveBestClassifiers(int nbFromTop)
nbFromTop -
public void printBestInSet(int i)
i best classifiers of the population
i -
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||