public class Chromosome
extends java.lang.Object
implements java.lang.Comparable
Constructor and Description |
---|
Chromosome(Gene[] genes)
It creates a new chromosome by setting up its genes
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(java.lang.Object chr)
It compares a chromosome with another one in order to accomplish ordering (NOT ascending) later.
|
double |
getFitness()
It returns the fitness of a chromosome
|
Gene[] |
getGenes()
It returns the genes of a chromosome
|
int |
getNumOneFrequentItemsets()
It returns the number of 1-frequent itemsets of a chromosome
|
double |
getSuitability()
It returns the suitability of a chromosome
|
void |
setFitness(double fitness)
It sets the fitness for a chromosome
|
void |
setNumOneFrequentItemsets(int numOneFrequentItemsets)
It sets the number of 1-Frequent Itemsets for a chromosome
|
void |
setSuitability(double suitability)
It sets the suitability for a chromosome
|
java.lang.String |
toString()
It returns a raw string representation of a chromosome
|
public Chromosome(Gene[] genes)
It creates a new chromosome by setting up its genes
genes
- The array of genes that the chromosome must handlepublic Gene[] getGenes()
It returns the genes of a chromosome
public double getFitness()
It returns the fitness of a chromosome
public void setFitness(double fitness)
It sets the fitness for a chromosome
fitness
- The fitness value of the chromosomepublic double getSuitability()
It returns the suitability of a chromosome
public void setSuitability(double suitability)
It sets the suitability for a chromosome
suitability
- The suitability value of the chromosomepublic int getNumOneFrequentItemsets()
It returns the number of 1-frequent itemsets of a chromosome
public void setNumOneFrequentItemsets(int numOneFrequentItemsets)
It sets the number of 1-Frequent Itemsets for a chromosome
numOneFrequentItemsets
- The number of 1-Frequent Itemsets of the chromosomepublic int compareTo(java.lang.Object chr)
It compares a chromosome with another one in order to accomplish ordering (NOT ascending) later. The comparison is achieved by only considering fitness values. For this reason, note that this method provides a natural ordering that is inconsistent with equals
compareTo
in interface java.lang.Comparable
chr
- The object to be comparedpublic java.lang.String toString()
It returns a raw string representation of a chromosome
toString
in class java.lang.Object