public class Cromosoma
extends java.lang.Object
implements java.lang.Comparable
Chromosome structure for algorithm EHS_CHC.
Modifier and Type | Field and Description |
---|---|
double |
cover
covered percentage
|
Constructor and Description |
---|
Cromosoma(boolean[] datos)
Cronstruct a cromosome from a bit array
|
Cromosoma(int size)
Construct a random chromosome of specified size
|
Cromosoma(int size,
Cromosoma a)
Create a copied chromosome
|
Modifier and Type | Method and Description |
---|---|
void |
borrar()
Marks a chromosome for deletion.
|
int |
compareTo(java.lang.Object o1)
Compare to Method
|
int |
differenceAtOne(Cromosoma a)
Test if two chromosome differ in only one gene
|
void |
divergeCHC(double r,
Cromosoma mejor,
double prob)
Reinitializes the chromosome by using CHC diverge procedure
|
boolean |
estaEvaluado()
Tests if the chromosome is already evaluated
|
boolean |
esValido()
Tests if the chromosome is valid
|
void |
evalua(double[][] datos,
int[][] nominal,
boolean[][] missing,
int[] clases,
Hyper[] database,
double[][] distans,
double alfa,
int nClases,
double beta)
Evaluates a chromosome
|
int |
genesActivos()
Count the number of genes set to 1
|
boolean[] |
getBody()
Get the body of a chromosome (all values)
|
double |
getCalidad()
Get the quality of a chromosome
|
boolean |
getGen(int indice)
Get the value of a gene
|
void |
mutacion(double pMutacion1to0,
double pMutacion0to1)
Mutation operator
|
void |
setGen(int indice,
boolean valor)
Set the value of a gene
|
java.lang.String |
toString()
To String Method
|
public Cromosoma(int size)
size
- size of the chromosomepublic Cromosoma(int size, Cromosoma a)
size
- size of the chromosome.a
- chromosomo to copypublic Cromosoma(boolean[] datos)
datos
- bit array given.public boolean getGen(int indice)
indice
- Index of the genepublic boolean[] getBody()
public double getCalidad()
public void setGen(int indice, boolean valor)
indice
- Index of the genevalor
- Value to setpublic void evalua(double[][] datos, int[][] nominal, boolean[][] missing, int[] clases, Hyper[] database, double[][] distans, double alfa, int nClases, double beta)
datos
- Reference to the training setnominal
- Reference to the training set (nominal valued)missing
- Reference to the training set (null values)clases
- Output attribute of each instancedatabase
- Hyper databasedistans
- distances between elementsalfa
- Alpha value of the fitness functionnClases
- Number of classes of the problembeta
- Beta value of the fitness functionpublic void mutacion(double pMutacion1to0, double pMutacion0to1)
pMutacion1to0
- Probability of change 1 to 0pMutacion0to1
- Probability of change 0 to 1public void divergeCHC(double r, Cromosoma mejor, double prob)
r
- R factor of divergemejor
- Best chromosome found so farprob
- Probability of setting a gen to 1public boolean estaEvaluado()
public int genesActivos()
public boolean esValido()
public void borrar()
public int compareTo(java.lang.Object o1)
compareTo
in interface java.lang.Comparable
o1
- Chromosome to comparepublic int differenceAtOne(Cromosoma a)
a
- Chromosome to comparepublic java.lang.String toString()
toString
in class java.lang.Object