public class Population
extends java.lang.Object
This class represents the population of chromosomes in the CORE algorithm. It is composed by a set of subpopulations (many as number of different classes in the data set)
Constructor and Description |
---|
Population()
Constructor which initializes the memory allocations.
|
Modifier and Type | Method and Description |
---|---|
void |
addRule(int _class,
Chromosome rule)
Adds a rule to the specified subpopulation
|
void |
evaluate(InstanceSet ISet)
Evaluates all this population with a given data set.
|
int |
getMu(int _class)
Gets the mu value of one subpopulation
|
int |
getNumGenes(int _class)
Gets the number of genes of one subpopulation
|
int |
getNumRules(int _class)
Gets the number of rules of the specified subpopulation
|
Chromosome |
getRule(int globalIndex)
Gets one rule using its global index, that is, the index across all subpopulations
|
Chromosome |
getRule(int _class,
int index)
Gets the indicated rule
|
void |
mutate(int _class,
int chrom,
int gen)
Mutates a chromosome in a specified subpopulation
|
void |
removeRule(int _class,
Chromosome r)
Removes one rule of the specified subpopulation
|
void |
setEvaluated(int _class,
int chrom,
boolean evaluated)
Sets the evaluation status of one rule in a specific subpopulation
|
void |
setMu(int _class,
int newMu)
Sets the new mu value for one subpopulation
|
public Population()
Constructor which initializes the memory allocations.
public Chromosome getRule(int _class, int index)
Gets the indicated rule
_class
- class of the subpopulation which the rule belongs toindex
- index of the rule in the proper subpopulationpublic Chromosome getRule(int globalIndex)
Gets one rule using its global index, that is, the index across all subpopulations
globalIndex
- global index of the rulepublic void addRule(int _class, Chromosome rule)
Adds a rule to the specified subpopulation
_class
- the class which identifies the subpopulationrule
- the rule to be addedpublic int getNumGenes(int _class)
Gets the number of genes of one subpopulation
_class
- the class which identifies the subpopulationpublic int getNumRules(int _class)
Gets the number of rules of the specified subpopulation
_class
- the class which identifies the subpopulationpublic int getMu(int _class)
Gets the mu value of one subpopulation
_class
- the class which identifies the subpopulationpublic void setMu(int _class, int newMu)
Sets the new mu value for one subpopulation
_class
- the class which identifies the subpopulationnewMu
- the new mu value for mutationpublic void mutate(int _class, int chrom, int gen)
Mutates a chromosome in a specified subpopulation
_class
- the class which identifies the subpopulationchrom
- the index of the chromosome to be mutatedgen
- the gene of the chromosome to be mutatedpublic void setEvaluated(int _class, int chrom, boolean evaluated)
Sets the evaluation status of one rule in a specific subpopulation
_class
- the class which identifies the subpopulationchrom
- the chromosome (rule) to be changedevaluated
- the new evaluation status of the rulepublic void removeRule(int _class, Chromosome r)
Removes one rule of the specified subpopulation
_class
- the class which identifies the subpopulationr
- the rule to be deletedpublic void evaluate(InstanceSet ISet)
Evaluates all this population with a given data set. Stores the obtained fitness in each rule, updating the previous one, and setting the evaluated status of the rules to True.
ISet
- the data set to evaluate with