public class Individual
extends java.lang.Object
Defines an individual, composed by a cromosome. Includes variables to store the size, the fitness, and if the individual is evaluated or not
Constructor and Description |
---|
Individual(int length,
TypeVar[] datos_v)
Creates new instance of Individual
|
Modifier and Type | Method and Description |
---|---|
Result |
CalcInd(float[] GI,
int total_class)
Evaluate the individual
|
boolean |
EqualTo(Individual a)
Returns if the indicated individual is equal to another individual
|
int |
getCromElem(int pos,
int elem)
Returns the indicated value of the gene of the Chromosome
|
Chromosome |
getIndivCrom()
Returns the hole Chromosome
|
boolean |
getIndivEvaluated()
Returns if the individual has been evaluated
|
float |
getIndivPerf()
Returns the fitness of the individual
|
int |
getIndivSize()
Returns the size of the Chromosome
|
java.lang.String |
getNameClass()
Returns the string with the name of the class of the individual
|
int |
getNumClass()
Returns the number of the class of the individual
|
int |
getNumVar()
Returns the number of variables of the rule (including the consequent)
|
int |
getTotalClass()
Returns the number of the class of the invividual
|
void |
InitIndEmp()
Empty initialization of the individual.
|
void |
Print(java.lang.String nFile)
Method to Print the contents of the individual
|
void |
setCromElem(int pos,
int elem,
int val)
Sets the value of the indicated value of the gene of the Chromosome
|
void |
setIndivEvaluated(boolean val)
Sets state of the individual
|
void |
setIndivPerf(float perf)
Sets the fitness of the individual
|
void |
setNameClass(java.lang.String val)
Sets the value of the name of the class of the individual
|
void |
setNumClass(int val)
Sets the number of the class of the individual
|
void |
setNumVar(int num)
Sets the number of variables of the rule (including the consequent)
|
void |
setTotalClass(int val)
Sets the number of the class of the individual
|
public Individual(int length, TypeVar[] datos_v)
Creates new instance of Individual
length
- Length of the chromosome for the individualdatos_v
- Contents the type of the variable, and the number of labels.public void InitIndEmp()
Empty initialization of the individual. Performed by init_crom method
public int getIndivSize()
Returns the size of the Chromosome
public Chromosome getIndivCrom()
Returns the hole Chromosome
public int getCromElem(int pos, int elem)
Returns the indicated value of the gene of the Chromosome
pos
- Position of the variable in the Chromosomeelem
- Position of the gen of the variablepublic void setCromElem(int pos, int elem, int val)
Sets the value of the indicated value of the gene of the Chromosome
pos
- Position of the variable in the Chromosomeelem
- Position of the gen of the variablepublic int getNumVar()
Returns the number of variables of the rule (including the consequent)
public void setNumVar(int num)
Sets the number of variables of the rule (including the consequent)
num
- Sets the number of variables of the Chromosomepublic int getNumClass()
Returns the number of the class of the individual
public void setNumClass(int val)
Sets the number of the class of the individual
val
- Sets the number of classespublic java.lang.String getNameClass()
Returns the string with the name of the class of the individual
public void setNameClass(java.lang.String val)
Sets the value of the name of the class of the individual
val
- Value to introduce in the name of the classpublic int getTotalClass()
Returns the number of the class of the invividual
public void setTotalClass(int val)
Sets the number of the class of the individual
val
- Number of total classes of the individualpublic boolean getIndivEvaluated()
Returns if the individual has been evaluated
public void setIndivEvaluated(boolean val)
Sets state of the individual
val
- Boolean value with the state of evaluatedpublic float getIndivPerf()
Returns the fitness of the individual
public void setIndivPerf(float perf)
Sets the fitness of the individual
perf
- Value to introduce in the fitnees of the individualpublic boolean EqualTo(Individual a)
Returns if the indicated individual is equal to another individual
a
- Individual to comparepublic Result CalcInd(float[] GI, int total_class)
Evaluate the individual
GI
- Gain Info arraytotal_class
- Total number of examples of the classpublic void Print(java.lang.String nFile)
Method to Print the contents of the individual
nFile
- Files to write the individual