public class CromDNF
extends java.lang.Object
Defines the structure and manage the contents of a DNF rule. This implementation uses only binary values to store the possible values of the variable.
Constructor and Description |
---|
CromDNF(int length,
TableVar Variables)
Creates new instance of chromosome, no initialization
|
Modifier and Type | Method and Description |
---|---|
int |
getCromElemGene(int pos,
int elem)
Retuns the value of the gene indicated
|
int |
getCromGeneLength(int pos)
Retuns the gene lenght of the chromosome
|
int |
getCromLength()
Retuns the length of the chromosome
|
void |
initCromBsd(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()
Random initialization of an existing chromosome
|
java.lang.String |
print()
Gets the chromosome genes
|
void |
print(java.lang.String nFile)
Prints the chromosome genes
|
void |
setCromElemGene(int pos,
int elem,
int value)
Sets the value of the indicated gene of the chromosome
|
public CromDNF(int length, TableVar Variables)
Creates new instance of chromosome, no initialization
length
- Length of the chromosomeVariables
- Variables table.public void initCromRnd()
Random initialization of an existing chromosome
public void initCromBsd(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)
porcVar
- percentage of variables to appear in the biased initializationpublic int getCromElemGene(int pos, int elem)
Retuns the value of the gene indicated
pos
- Position of the variable in the chromosomeelem
- Position of the gene of the variablepublic void setCromElemGene(int pos, int elem, int value)
Sets the value of the indicated gene of the chromosome
pos
- Position of the variable in the chromosomeelem
- Position of the gene of the variablevalue
- Value of the genepublic int getCromLength()
Retuns the length of the chromosome
public int getCromGeneLength(int pos)
pos
- gene's position.public void print(java.lang.String nFile)
Prints the chromosome genes
nFile
- Files to write the chromosomepublic java.lang.String print()
Gets the chromosome genes