|
JGAP | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jgap.gp.CommandGene
org.jgap.gp.function.SubProgram
public class SubProgram
A connector for independent subprograms (subtrees). Each subtree except the last one must have a memory- or stack-modifying command (such as push or store), otherwise there is no connection between the subtrees (which would be useless bloating).
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.jgap.gp.CommandGene |
---|
CommandGene.COMMAND_TYPE |
Field Summary |
---|
Fields inherited from class org.jgap.gp.CommandGene |
---|
BooleanClass, CharacterClass, DELTA, DoubleClass, FloatClass, IntegerClass, LongClass, nodeIndex, VoidClass |
Constructor Summary | |
---|---|
SubProgram(GPConfiguration a_conf,
java.lang.Class[] a_types)
|
|
SubProgram(GPConfiguration a_conf,
java.lang.Class[] a_types,
boolean a_mutateable)
|
|
SubProgram(GPConfiguration a_conf,
java.lang.Class[] a_types,
int a_subReturnType,
int[] a_subChildTypes)
|
|
SubProgram(GPConfiguration a_conf,
java.lang.Class[] a_types,
int a_subReturnType,
int[] a_subChildTypes,
boolean a_mutateable)
|
|
SubProgram(GPConfiguration a_conf,
int a_arity,
java.lang.Class a_types)
Collage constructor: Create a sub program that has a_arity elements of the same type a_types. |
|
SubProgram(GPConfiguration a_conf,
int a_arity,
java.lang.Class a_types,
boolean a_mutateable)
Collage constructor: Create a sub program that has a_arity elements of the same type a_types. |
|
SubProgram(GPConfiguration a_conf,
int a_arity,
java.lang.Class a_types,
int a_minArity,
int a_maxArity,
boolean a_mutateable)
|
Method Summary | |
---|---|
CommandGene |
applyMutation()
|
CommandGene |
applyMutation(int index,
double a_percentage)
Mutates a CommandGene. |
java.lang.Object |
clone()
|
int |
compareTo(java.lang.Object a_other)
The compareTo-method. |
boolean |
equals(java.lang.Object a_other)
The equals-method. |
double |
execute_double(ProgramChromosome c,
int n,
java.lang.Object[] args)
Executes this node as a double. |
float |
execute_float(ProgramChromosome c,
int n,
java.lang.Object[] args)
Executes this node as a float. |
int |
execute_int(ProgramChromosome c,
int n,
java.lang.Object[] args)
Executes this node as an integer. |
long |
execute_long(ProgramChromosome c,
int n,
java.lang.Object[] args)
Executes this node as a long. |
java.lang.Object |
execute_object(ProgramChromosome c,
int n,
java.lang.Object[] args)
Executes this node as an object. |
void |
execute_void(ProgramChromosome c,
int n,
java.lang.Object[] args)
Executes this node, returning nothing. |
java.lang.Class |
getChildType(IGPProgram a_ind,
int a_chromNum)
Gets the type of node allowed from the given child number. |
java.lang.String |
getName()
|
boolean |
isValid(ProgramChromosome a_program)
Subclasses capable of validating programs should overwrite this method. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SubProgram(GPConfiguration a_conf, java.lang.Class[] a_types) throws InvalidConfigurationException
InvalidConfigurationException
public SubProgram(GPConfiguration a_conf, int a_arity, java.lang.Class a_types) throws InvalidConfigurationException
a_conf
- the configuration to usea_arity
- number of children in the collagea_types
- uniform type of all children
InvalidConfigurationException
public SubProgram(GPConfiguration a_conf, int a_arity, java.lang.Class a_types, boolean a_mutateable) throws InvalidConfigurationException
a_conf
- the configuration to usea_arity
- number of children in the collagea_types
- uniform type of all childrena_mutateable
- true: allow mutation of the sub program, i.e., the
number of children (=arity) may be varied automatically during evolution
InvalidConfigurationException
public SubProgram(GPConfiguration a_conf, int a_arity, java.lang.Class a_types, int a_minArity, int a_maxArity, boolean a_mutateable) throws InvalidConfigurationException
InvalidConfigurationException
public SubProgram(GPConfiguration a_conf, java.lang.Class[] a_types, boolean a_mutateable) throws InvalidConfigurationException
InvalidConfigurationException
public SubProgram(GPConfiguration a_conf, java.lang.Class[] a_types, int a_subReturnType, int[] a_subChildTypes) throws InvalidConfigurationException
InvalidConfigurationException
public SubProgram(GPConfiguration a_conf, java.lang.Class[] a_types, int a_subReturnType, int[] a_subChildTypes, boolean a_mutateable) throws InvalidConfigurationException
InvalidConfigurationException
Method Detail |
---|
public java.lang.String toString()
toString
in class CommandGene
public java.lang.String getName()
getName
in class CommandGene
public int execute_int(ProgramChromosome c, int n, java.lang.Object[] args)
CommandGene
execute_int
in class CommandGene
c
- ignored heren
- ignored hereargs
- ignored here
public void execute_void(ProgramChromosome c, int n, java.lang.Object[] args)
CommandGene
execute_void
in class CommandGene
c
- ignored heren
- ignored hereargs
- ignored herepublic long execute_long(ProgramChromosome c, int n, java.lang.Object[] args)
CommandGene
execute_long
in class CommandGene
c
- ignored heren
- ignored hereargs
- ignored here
public float execute_float(ProgramChromosome c, int n, java.lang.Object[] args)
CommandGene
execute_float
in class CommandGene
c
- ignored heren
- ignored hereargs
- ignored here
public double execute_double(ProgramChromosome c, int n, java.lang.Object[] args)
CommandGene
execute_double
in class CommandGene
c
- ignored heren
- ignored hereargs
- ignored here
public java.lang.Object execute_object(ProgramChromosome c, int n, java.lang.Object[] args)
CommandGene
execute_object
in class CommandGene
c
- ignored heren
- ignored hereargs
- ignored here
public boolean isValid(ProgramChromosome a_program)
CommandGene
isValid
in class CommandGene
a_program
- the ProgramChromosome to validate
public java.lang.Class getChildType(IGPProgram a_ind, int a_chromNum)
CommandGene
getChildType
in class CommandGene
a_ind
- the individual the child belongs toa_chromNum
- the chromosome number
public int compareTo(java.lang.Object a_other)
compareTo
in interface java.lang.Comparable
compareTo
in class CommandGene
a_other
- the other object to compare
public boolean equals(java.lang.Object a_other)
equals
in class CommandGene
a_other
- the other object to compare
public java.lang.Object clone()
clone
in interface ICloneable
clone
in class java.lang.Object
public CommandGene applyMutation(int index, double a_percentage) throws InvalidConfigurationException
IMutateable
applyMutation
in interface IMutateable
index
- references the part of a multipart object, normally not
relevanta_percentage
- the mutation rate (0.0 to 1.0)
InvalidConfigurationException
public CommandGene applyMutation() throws InvalidConfigurationException
InvalidConfigurationException
|
JGAP | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |