public class CromCAN
extends java.lang.Object
Defines the structure and manage the contents of a canonical rule. This implementation uses only integer values to store the gens.
Constructor and Description |
---|
CromCAN(int length)
Creates new instance of chromosome, no initialization
|
Modifier and Type | Method and Description |
---|---|
int |
getCromElem(int pos)
Retuns the value of the gene indicated
|
int |
getCromLength()
Retuns the length of the chromosome
|
void |
initCromBsd(TableVar Variables,
float porcVar)
Biased Random initialization of an existing chromosome
The random inicializacion is biased by generating
chromosomes with a maximum number or participating variables
and for an indicated % of the population (the rest is random)
|
void |
initCromRnd(TableVar Variables)
Random initialization of an existing chromosome
|
void |
print(java.lang.String nFile)
Prints the chromosome genes
|
void |
setCromElem(int pos,
int value)
Sets the value of the indicated gene of the chromosome
|
public CromCAN(int length)
Creates new instance of chromosome, no initialization
length
- Length of the chromosomepublic void initCromRnd(TableVar Variables)
Random initialization of an existing chromosome
Variables
- contents the characteristics of the variablespublic void initCromBsd(TableVar Variables, float porcVar)
Biased Random initialization of an existing chromosome The random inicializacion is biased by generating chromosomes with a maximum number or participating variables and for an indicated % of the population (the rest is random)
Variables
- contents the type of the variable, and the number of labels.porcVar
- percentage of variables to appear in the biased initializationpublic int getCromElem(int pos)
Retuns the value of the gene indicated
pos
- Position of the variable in the chromosomepublic void setCromElem(int pos, int value)
Sets the value of the indicated gene of the chromosome
pos
- Position of the variable in the chromosomevalue
- Value of the variablepublic int getCromLength()
Retuns the length of the chromosome
public void print(java.lang.String nFile)
Prints the chromosome genes
nFile
- File to write the chromosome