|
artoflife pre0.1.0-dev | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.artoflife.gp.genome.GpTreeNode | +--org.artoflife.gp.genome.FunctionGene
A gene that that returns a certain type and acts on a list of typed parameters.
Field Summary | |
protected java.util.List |
parameterGenes
List of GpTreeNode s used as parameters for this
to use when evaluating the return value. |
Constructor Summary | |
FunctionGene()
Create with all null parameter genes so use GeneFactory#getGeneTree(Class)
to make a functional gene. |
Method Summary | |
java.lang.Object |
clone()
Override to clone the parameter list. |
java.lang.Object |
evaluate(Phenotype phenotype)
Evaluate the gene across the parameters in the context of a Phenotype. |
protected abstract java.lang.Object |
evaluate(Phenotype phenotype,
java.util.List parameters)
|
protected static boolean |
getBooleanParameter(java.util.List parameters,
int index)
Convenience to return either the boolean value of a parameter or false if the parameter is missing. |
protected static double |
getDoubleParameter(java.util.List parameters,
int index)
Convenience to return either the double value of a parameter or 0.0d if the parameter is missing. |
protected static float |
getFloatParameter(java.util.List parameters,
int index)
Convenience to return either the float value of a parameter or 0.0f if the parameter is missing. |
protected java.util.SortedMap |
getMutators()
Provides a SortedMap of GpMutator s with their
probabilities (Doubles between 0.0 and 1.0)
so that #mutate(float)
can choose one to do a mutation. |
protected abstract java.util.List |
getParameterClasses()
|
GpTreeNode |
getParameterGene(int index)
|
protected void |
initParameterGenes()
|
void |
setParameterGene(int index,
GpTreeNode gene)
|
java.lang.String |
toString()
|
Methods inherited from class org.artoflife.gp.genome.GpTreeNode |
getParameterClass, getParametersLength, getReturnClass, getSize, mutate |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected java.util.List parameterGenes
GpTreeNode
s used as parameters for this
to use when evaluating the return value.
Constructor Detail |
public FunctionGene()
GeneFactory#getGeneTree(Class)
to make a functional gene.
Method Detail |
protected void initParameterGenes()
protected abstract java.util.List getParameterClasses()
getParameterClasses
in class GpTreeNode
public java.lang.Object evaluate(Phenotype phenotype)
evaluate
in class GpTreeNode
protected abstract java.lang.Object evaluate(Phenotype phenotype, java.util.List parameters)
public GpTreeNode getParameterGene(int index)
getParameterGene
in class GpTreeNode
java.lang.IndexOutOfBoundsException
- for index out of rangepublic void setParameterGene(int index, GpTreeNode gene)
setParameterGene
in class GpTreeNode
index
- the index of the gene to replacegene
- the gene to replace with, may be null
java.lang.IndexOutOfBoundsException
- for index out of rangepublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.Object clone()
clone
in class GpTreeNode
protected java.util.SortedMap getMutators()
GpTreeNode
GpMutator
s with their
probabilities (Doubles between 0.0 and 1.0)
so that #mutate(float)
can choose one to do a mutation. The map
needs to look like:
Load from configuration properties.
[getClass().getName()].mutator.class.0
and optionally
[getClass().getName()].mutator.probability.0
using:
Configuration.getInstance().getInstancesProbabilities(getClass().getName() + ".mutator");
getMutators
in class GpTreeNode
GpTreeNode.getMutators()
protected static boolean getBooleanParameter(java.util.List parameters, int index)
parameters
- the List of parametersindex
- which parameter?
protected static float getFloatParameter(java.util.List parameters, int index)
parameters
- the List of parametersindex
- which parameter?
protected static double getDoubleParameter(java.util.List parameters, int index)
parameters
- the List of parametersindex
- which parameter?
|
artoflife pre0.1.0-dev | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |