public abstract class Chromosome extends EvaluateGenData
EvolveGenes
object is created, which is passed two gene
lists that it uses to create a new one. The new gene list is then added to a
copy of this chromosome to create a new one. The evolve
method is used to
create a new set of genes. This is derived from EvaluateGenData
and so also stores
the evaluation function used to compare gene lists. Gene lists are stored as
MetricDataset
objects, with each value stored as a MetricValue
.Modifier and Type | Field and Description |
---|---|
protected org.ai_heuristic.eval.metric.MetricDataset |
compareDataset
A problem dataset to compare to this chromosome.
|
protected EvolveGenes |
evolveGenes
This is used to combine gene lists to create a new one.
|
evalFunction, evalSeed, name
Constructor and Description |
---|
Chromosome(java.lang.String thisName,
org.ai_heuristic.eval.metric.MetricDataset thisGeneList,
org.ai_heuristic.functs.Function evalFunction,
EvolveGenes thisMutateGenes)
Create a new instance of Chromosome.
|
Modifier and Type | Method and Description |
---|---|
protected Chromosome |
cloneChromosomeLight(java.lang.String newName,
org.ai_heuristic.eval.metric.MetricDataset newGeneList)
Clone this chromosome to create light copy with other values.
|
abstract org.ai_heuristic.eval.metric.ReplySet |
evaluateFitness()
Evaluate the fitness of this chromosome.
|
abstract Chromosome |
evolve(Chromosome thisChromosome)
Generate a new chromosome by combining this chromosome and the variable passed in.
|
static Chromosome |
getChromosome(java.lang.String chromosomeType,
java.lang.String chromosomeID,
org.ai_heuristic.eval.metric.MetricDataset genesList,
org.ai_heuristic.functs.Function evalFunction,
EvolveGenes evolveGenes)
Create and return the appropriate chromosome for the specified chromosome
type.
|
EvolveGenes |
getEvolveGenes()
Get the object used to create new gene lists.
|
boolean |
sameAs(Chromosome compareTo)
Return true if the genes in this chromosome are the same as the genes
in the chromosome passed in.
|
void |
setCompareDataset(org.ai_heuristic.eval.metric.MetricDataset thisCompareDataset)
Set the other problem dataset to compare with this chromosome.
|
void |
setEvolveGenes(EvolveGenes thisEvolveGenes)
Set the object used to evolve gene lists to create a new one.
|
void |
setName(java.lang.String thisName)
Set the chromosome name.
|
evaluate, getEvalSeed, getName, setEvaluationFunction
protected org.ai_heuristic.eval.metric.MetricDataset compareDataset
protected EvolveGenes evolveGenes
public Chromosome(java.lang.String thisName, org.ai_heuristic.eval.metric.MetricDataset thisGeneList, org.ai_heuristic.functs.Function evalFunction, EvolveGenes thisMutateGenes)
thisName
- the id or name of the chromosome.thisGeneList
- the list of genes that define this chromosome. This is
then the evaluation seed of the parent EvaluateGenData
class.evalFunction
- the evaluation function to use.thisMutateGenes
- the definition of how this chromosome will evolveGenes.public abstract org.ai_heuristic.eval.metric.ReplySet evaluateFitness() throws java.lang.Exception
java.lang.Exception
- any error.public abstract Chromosome evolve(Chromosome thisChromosome) throws java.lang.Exception
thisChromosome
- the chromosome to combine with.java.lang.Exception
- any error.public boolean sameAs(Chromosome compareTo) throws java.lang.Exception
EvolveGenes
areSame
method
to make the comparison.compareTo
- the chromosome to compare this chromosome with.java.lang.Exception
- any error.public void setName(java.lang.String thisName)
thisName
- the chromosome name.public void setCompareDataset(org.ai_heuristic.eval.metric.MetricDataset thisCompareDataset)
thisCompareDataset
- the problem dataset.public void setEvolveGenes(EvolveGenes thisEvolveGenes)
thisEvolveGenes
- the object used to evolve genes through mutations and crossovers.public EvolveGenes getEvolveGenes()
protected Chromosome cloneChromosomeLight(java.lang.String newName, org.ai_heuristic.eval.metric.MetricDataset newGeneList) throws java.lang.Exception
newName
- the new chromosome name.newGeneList
- the gene pool for the new chromosome.java.lang.Exception
- any error.public static Chromosome getChromosome(java.lang.String chromosomeType, java.lang.String chromosomeID, org.ai_heuristic.eval.metric.MetricDataset genesList, org.ai_heuristic.functs.Function evalFunction, EvolveGenes evolveGenes) throws java.lang.Exception
chromosomeType
- the type of chromosome to create.chromosomeID
- the id or name of the chromosome.genesList
- the list of genes that define this chromosome. This is
then the evaluation seed of the parent EvaluateGenData
class.evalFunction
- the evaluation function to use.evolveGenes
- the definition of how this chromosome will evolve genes.java.lang.Exception
- any error.