|
||||||||||
| 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 GpTreeNodes 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 GpMutators 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
GpTreeNodes 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 GpTreeNodepublic 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 GpTreeNodejava.lang.IndexOutOfBoundsException - for index out of range
public void setParameterGene(int index,
GpTreeNode gene)
setParameterGene in class GpTreeNodeindex - 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.Objectpublic java.lang.Object clone()
clone in class GpTreeNodeprotected java.util.SortedMap getMutators()
GpTreeNodeGpMutators 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 GpTreeNodeGpTreeNode.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 | |||||||||