public class CromosomaBinario extends Cromosoma
fitness, rep, tamCromosoma
Constructor and Description |
---|
CromosomaBinario(int tama)
Creates a new instance of CromosomaBinario
|
Modifier and Type | Method and Description |
---|---|
void |
cambiarGen(int nuevoValorGen,
int posGen)
modifies the ith value of a gene
|
void |
cruzar(Cromosoma padre2,
Cromosoma hijo1,
Cromosoma hijo2)
crossover operator.
|
boolean |
cruzarHUX(Cromosoma padre2,
Cromosoma hijo1,
Cromosoma hijo2,
int umbral)
uniform crossover operator (HUX)
If parents are very similar, the crossover operator doesn't apply
|
boolean[] |
devolverFeaturesVector()
returns a boolean array needed for Leaving One Out, Cross Validation and other methods used in
Feature Selection Algorithm
|
int |
devolverGen(int i)
return the ith gene of chromosome
|
void |
initPlantilla(Cromosoma crPlantilla,
double ratio)
this method is used in CHC method.
|
void |
initRand()
random initialization of a chromosome (two values: 0 or 1)
|
void |
mutar()
binary mutation operator in one point
|
java.lang.String |
print()
it prints a chromosome, gene by gene
|
copy, devolverTamCromosoma, getFitness, isEqual, setFitness
public CromosomaBinario(int tama)
tama
- is the length of the chromosomepublic void initRand()
public void initPlantilla(Cromosoma crPlantilla, double ratio)
initPlantilla
in class Cromosoma
crPlantilla
- is a chromosome templateratio
- is the ratio of random initializationpublic int devolverGen(int i)
devolverGen
in class Cromosoma
i
- is the ith positionpublic void cambiarGen(int nuevoValorGen, int posGen)
cambiarGen
in class Cromosoma
nuevoValorGen
- the new value for the geneposGen
- the position what we want to change (0..tamCromsoma-1)public void cruzar(Cromosoma padre2, Cromosoma hijo1, Cromosoma hijo2)
public boolean cruzarHUX(Cromosoma padre2, Cromosoma hijo1, Cromosoma hijo2, int umbral)
public void mutar()
public java.lang.String print()
public boolean[] devolverFeaturesVector()
devolverFeaturesVector
in class Cromosoma