artoflife pre0.1.0-dev

org.artoflife.gp.genome.bool
Class BooleanGene

java.lang.Object
  |
  +--org.artoflife.gp.genome.GpTreeNode
        |
        +--org.artoflife.gp.genome.bool.BooleanGene
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class BooleanGene
extends GpTreeNode

Represents a boolean value, mutated with BooleanMutator).

Author:
Steve Meyfroidt
See Also:
Serialized Form

Constructor Summary
BooleanGene()
           
 
Method Summary
 java.lang.Object clone()
          Return a clone of this.
 java.lang.Object evaluate(Phenotype phenotype)
          Evaluate this expression in the context of the passed Phenotype.
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  java.util.List getParameterClasses()
           
 GpTreeNode getParameterGene(int index)
           
 java.lang.Class getReturnClass()
           
 java.lang.Boolean getValue()
           
 void setParameterGene(int index, GpTreeNode gene)
           
 void setValue(java.lang.Boolean value)
           
 java.lang.String toString()
           
 
Methods inherited from class org.artoflife.gp.genome.GpTreeNode
getParameterClass, getParametersLength, getSize, mutate
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BooleanGene

public BooleanGene()
Method Detail

clone

public java.lang.Object clone()
Description copied from class: GpTreeNode
Return a clone of this. Override to deep clone any non-primitive fields in subclasses.

Overrides:
clone in class GpTreeNode

setValue

public void setValue(java.lang.Boolean value)

getValue

public java.lang.Boolean getValue()

evaluate

public java.lang.Object evaluate(Phenotype phenotype)
Description copied from class: GpTreeNode
Evaluate this expression in the context of the passed Phenotype.

Specified by:
evaluate in class GpTreeNode
See Also:
GpTreeNode.evaluate(org.artoflife.gp.Phenotype)

getReturnClass

public java.lang.Class getReturnClass()
Specified by:
getReturnClass in class GpTreeNode
Returns:
the class this gene returns on evaluation
See Also:
GpTreeNode.getReturnClass()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getMutators

protected java.util.SortedMap getMutators()
Description copied from class: GpTreeNode
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. The map needs to look like:
0.1
a GpMutator instance with 10% chance of being used
0.2
a different GpMutator instance with 10% chance of being used
1.0
a GpMutator instance with 80% chance of being used

Load from configuration properties. [getClass().getName()].mutator.class.0 and optionally [getClass().getName()].mutator.probability.0 using: Configuration.getInstance().getInstancesProbabilities(getClass().getName() + ".mutator");

Overrides:
getMutators in class GpTreeNode
Returns:
SortedMap of probability vs mutator class, or null if no mutators for this gene
See Also:
GpTreeNode.getMutators()

getParameterClasses

protected java.util.List getParameterClasses()
Specified by:
getParameterClasses in class GpTreeNode
Returns:
List of the Classes that this gene expects to evaluate against
See Also:
GpTreeNode.getParameterClasses()

getParameterGene

public GpTreeNode getParameterGene(int index)
Specified by:
getParameterGene in class GpTreeNode
Returns:
the gene at the passed index, may be null
See Also:
GpTreeNode.getParameterGene(int)

setParameterGene

public void setParameterGene(int index,
                             GpTreeNode gene)
Specified by:
setParameterGene in class GpTreeNode
Parameters:
index - the index of the gene to replace
gene - the gene to replace with
See Also:
GpTreeNode.setParameterGene(int, GpTreeNode)

artoflife pre0.1.0-dev

Copyright © 2002 the Art Of Life team. All Rights Reserved.