public class Chromosome
extends java.lang.Object
implements java.lang.Comparable
It is used for representing and handling a Chromosome throughout the evolutionary learning
Modifier and Type | Field and Description |
---|---|
int |
nAnts |
Constructor and Description |
---|
Chromosome(Gene[] genes)
It creates a new chromosome by setting up its genes
|
Modifier and Type | Method and Description |
---|---|
void |
addCoveredTID(int tid)
It adds a dataset records to the list of records being covered by a chromosome
|
int |
compareTo(java.lang.Object chr)
It compares a chromosome with another one in order to accomplish ordering later.
|
Chromosome |
copy()
It allows to clone correctly a chromosome
|
boolean |
equals(Chromosome chr)
It indicates whether some other chromosome is "equal to" this one
|
void |
forceConsistency()
It checks whether a chromosome always contains at least one antecedent gene as well as at least one consequent gene.
|
double |
getAntecedentSupport() |
double |
getConsequentSupport() |
java.util.ArrayList<java.lang.Integer> |
getCoveredTIDs()
It indicates the dataset records which have been covered by a chromosome
|
double |
getFitness()
It returns the fitness of a chromosome
|
Gene |
getGene(int i)
It returns the "i-th" gene of a chromosome
|
Gene[] |
getGenes()
It returns the genes of a chromosome
|
java.util.ArrayList<java.lang.Integer> |
getIndexOfAntecedentGenes()
It indicates the genes which act as antecedents within a chromosome
|
java.util.ArrayList<java.lang.Integer> |
getIndexOfConsequentGenes()
It indicates the genes which act as consequents within a chromosome
|
java.util.ArrayList<java.lang.Integer> |
getIndexOfInvolvedGenes()
It indicates the genes which are involved to form an association rule later
|
java.util.ArrayList<java.lang.Integer> |
getIndexOfNotInvolvedGenes()
It indicates the genes which are excluded to form an association rule later
|
int |
getnAnts() |
double |
getRuleCF() |
double |
getRuleConfidence()
It returns the confidence of the association rule represented by a chromosome
|
double |
getRuleConv() |
double |
getRuleLift() |
double |
getRuleNetconf() |
double |
getRuleSupport()
It returns the support of the association rule represented by a chromosome
|
double |
getRuleYulesQ() |
boolean |
isSubChromo(Chromosome chromo2) |
void |
setAntecedentSupport(double antecedentSupport) |
void |
setConsequentSupport(double consequentSupport) |
void |
setFitness(double fitness)
It sets the fitness for a chromosome
|
void |
setnAnts(int ants) |
void |
setRuleCF(double ruleCF) |
void |
setRuleConfidence(double ruleConfidence)
It sets the confidence of the association rule represented by a chromosome
|
void |
setRuleConv(double ruleConv) |
void |
setRuleLift(double ruleLift) |
void |
setRuleNetconf(double ruleNetconf) |
void |
setRuleSupport(double ruleSupport)
It sets the support of the association rule represented by a chromosome
|
void |
setRuleYulesQ(double ruleYulesQ) |
java.lang.String |
toString()
It returns a 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 Chromosome copy()
It allows to clone correctly a chromosome
public void setFitness(double fitness)
It sets the fitness for a chromosome
fitness
- The fitness value of the chromosomepublic double getFitness()
It returns the fitness of a chromosome
public void setRuleSupport(double ruleSupport)
It sets the support of the association rule represented by a chromosome
ruleSupport
- The value representing the rule supportpublic double getRuleSupport()
It returns the support of the association rule represented by a chromosome
public void setRuleConfidence(double ruleConfidence)
It sets the confidence of the association rule represented by a chromosome
ruleConfidence
- The value representing the rule confidencepublic double getRuleConfidence()
It returns the confidence of the association rule represented by a chromosome
public Gene[] getGenes()
It returns the genes of a chromosome
public Gene getGene(int i)
It returns the "i-th" gene of a chromosome
i
- The index of the genepublic java.util.ArrayList<java.lang.Integer> getIndexOfInvolvedGenes()
It indicates the genes which are involved to form an association rule later
public java.util.ArrayList<java.lang.Integer> getIndexOfNotInvolvedGenes()
It indicates the genes which are excluded to form an association rule later
public java.util.ArrayList<java.lang.Integer> getIndexOfAntecedentGenes()
It indicates the genes which act as antecedents within a chromosome
public java.util.ArrayList<java.lang.Integer> getIndexOfConsequentGenes()
It indicates the genes which act as consequents within a chromosome
public void addCoveredTID(int tid)
It adds a dataset records to the list of records being covered by a chromosome
tid
- The ID of the covered record in the datasetpublic java.util.ArrayList<java.lang.Integer> getCoveredTIDs()
It indicates the dataset records which have been covered by a chromosome
public void forceConsistency()
It checks whether a chromosome always contains at least one antecedent gene as well as at least one consequent gene. If not, it forces this constraint by randomly altering some of its genes
public int compareTo(java.lang.Object chr)
It compares a chromosome with another one in order to accomplish ordering 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
obj
- The object to be comparedpublic boolean equals(Chromosome chr)
It indicates whether some other chromosome is "equal to" this one
obj
- The reference object with which to comparepublic java.lang.String toString()
It returns a string representation of a chromosome
toString
in class java.lang.Object
public double getRuleLift()
public void setRuleLift(double ruleLift)
public double getRuleCF()
public void setRuleCF(double ruleCF)
public double getRuleConv()
public void setRuleConv(double ruleConv)
public double getRuleNetconf()
public void setRuleNetconf(double ruleNetconf)
public double getAntecedentSupport()
public void setAntecedentSupport(double antecedentSupport)
public double getConsequentSupport()
public void setConsequentSupport(double consequentSupport)
public double getRuleYulesQ()
public void setRuleYulesQ(double ruleYulesQ)
public int getnAnts()
public void setnAnts(int ants)
public boolean isSubChromo(Chromosome chromo2)