public class Chromosome
extends java.lang.Object
Defines the structure and manage the contents of a rule This implementation uses only integer values to store the gens. So, variables values must be discretized (if they are continuous) or translated into integers (if they are enumerated) Uses Keel defined Random
Constructor and Description |
---|
Chromosome(int length,
TypeVar[] datos_var)
Creates new instance of chromosome, no initialization
|
Modifier and Type | Method and Description |
---|---|
int |
getCromElem(int pos,
int elem)
Retuns the value of the position of the gene indicated
|
int |
getCromGeneLength(int pos)
Retuns the gene lenght of the chromosome
|
int |
getCromLength()
Retuns the gene lenght of the chromosome
|
void |
InitCromEmp()
Empty initialization of an existing chromosome
We denote that the variable does not take part by setting
the value to n_etiq (valid class are from 0 to n_etiq-1)
|
void |
Print(java.lang.String nFile)
Prints the chromosome genes
|
void |
setCromElem(int pos,
int elem,
int value)
Sets the value of the indicated position of the gene of the chromosome
|
public Chromosome(int length, TypeVar[] datos_var)
Creates new instance of chromosome, no initialization
datos_var
- Contents the type of the variable, and the number of labels.length
- Length of the chromosomepublic void InitCromEmp()
Empty initialization of an existing chromosome We denote that the variable does not take part by setting the value to n_etiq (valid class are from 0 to n_etiq-1)
public int getCromElem(int pos, int elem)
Retuns the value of the position of the gene indicated
pos
- The position indicates the variableelem
- The position of the gene of the variablepublic void setCromElem(int pos, int elem, int value)
Sets the value of the indicated position of the gene of the chromosome
pos
- The position indicates the variableelem
- The position of the gene of the variablevalue
- The value to insert in the genepublic int getCromLength()
Retuns the gene lenght of the chromosome
public int getCromGeneLength(int pos)
Retuns the gene lenght of the chromosome
pos
- The position indicates the variablepublic void Print(java.lang.String nFile)
Prints the chromosome genes
nFile
- Fichero to write the chromosome