public abstract class EvolveGenes
extends java.lang.Object
Chromosome
, but gets passed the gene lists
from the chromosome and applies the evolution mechanism to create a new one. While
the gene data is stored as a MetricDataset
, these classes get passed the
data list only. This can be a ArrayList
of MetricValue
objects, or
the data objects directly.Modifier and Type | Field and Description |
---|---|
protected java.util.ArrayList<java.lang.String> |
evolveTypes
The different ways that a crossover or mutation can be performed.
|
protected java.lang.String |
geneType
The type of object that represents a gene.
|
Constructor and Description |
---|
EvolveGenes(java.lang.String thisGeneType,
java.util.ArrayList<java.lang.String> thisEvolveTypes)
Create a new instance of EvolveGenes.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addEvolveType(java.lang.String thisEvolveType)
Ad a new evolution type to the list.
|
abstract boolean |
areSame(java.util.ArrayList<?> geneList1,
java.util.ArrayList<?> geneList2)
Return true if the two sets of genes are the same.
|
void |
clearEvolveTypes()
Clear the list of evolution types that determine how a mutation is performed.
|
protected abstract java.util.ArrayList<?> |
crossover(java.util.ArrayList<?> geneList1,
java.util.ArrayList<?> geneList2)
Generate a crossover between this gene list and the variable passed in.
|
java.util.ArrayList<?> |
evolveGenes(java.util.ArrayList<?> geneList1,
java.util.ArrayList<?> geneList2)
Combine the two sets of genes to create a new list.
|
static EvolveGenes |
getEvolveGeneType(EvolveInfo evolveInfo)
Return an appropriate gene evolution object based on the gene type
(probably the dataset type) and set of evolution requirements.
|
java.util.ArrayList<java.lang.String> |
getEvolveTypes()
Get the list of different ways that a evolutions can be performed.
|
protected abstract java.util.ArrayList<?> |
mutate(java.util.ArrayList<?> geneList1,
java.util.ArrayList<?> geneList2)
Generate a mutation between this gene list and the variable passed in.
|
protected java.lang.String geneType
protected java.util.ArrayList<java.lang.String> evolveTypes
public EvolveGenes(java.lang.String thisGeneType, java.util.ArrayList<java.lang.String> thisEvolveTypes)
thisGeneType
- the type of gene as the object classname.thisEvolveTypes
- the different ways that a crossover or mutation can be performed.public abstract boolean areSame(java.util.ArrayList<?> geneList1, java.util.ArrayList<?> geneList2) throws java.lang.Exception
geneList1
- the first list of consider.geneList2
- the second list to consider.java.lang.Exception
- any error.protected abstract java.util.ArrayList<?> crossover(java.util.ArrayList<?> geneList1, java.util.ArrayList<?> geneList2) throws java.lang.Exception
geneList1
- the first list of consider.geneList2
- the second list to consider.java.lang.Exception
- any error.protected abstract java.util.ArrayList<?> mutate(java.util.ArrayList<?> geneList1, java.util.ArrayList<?> geneList2) throws java.lang.Exception
geneList1
- the first list of consider.geneList2
- the second list to consider.java.lang.Exception
- any error.public java.util.ArrayList<?> evolveGenes(java.util.ArrayList<?> geneList1, java.util.ArrayList<?> geneList2) throws java.lang.Exception
geneList1
- the first list of consider.geneList2
- th second list to consider.java.lang.Exception
- any error.public void clearEvolveTypes()
public boolean addEvolveType(java.lang.String thisEvolveType)
thisEvolveType
- a type of evolution that can be performed.public java.util.ArrayList<java.lang.String> getEvolveTypes()
public static EvolveGenes getEvolveGeneType(EvolveInfo evolveInfo)
evolveInfo
- a full description of the evolution process.