|
JGAP | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jgap.gp.GPProgramBase
org.jgap.gp.impl.GPProgram
public class GPProgram
A GP program contains 1..n ProgramChromosome's.
| Constructor Summary | |
|---|---|
GPProgram()
Default constructor, only for dynamic instantiation. |
|
GPProgram(GPConfiguration a_conf,
java.lang.Class[] a_types,
java.lang.Class[][] a_argTypes,
CommandGene[][] a_nodeSets,
int[] a_minDepths,
int[] a_maxDepths,
int a_maxNodes)
Master constructor. |
|
GPProgram(GPConfiguration a_conf,
int a_numChromosomes)
Sort of minimalistic constructor. |
|
GPProgram(IGPProgram a_prog)
Constructor to initialize a GPProgram with values of another GPProgram. |
|
| Method Summary | |
|---|---|
java.lang.Object |
clone()
|
int |
compareTo(java.lang.Object a_other)
Compares the given program to this program. |
protected java.lang.String |
decode(java.lang.String a_string)
|
protected java.lang.String |
encode(java.lang.String a_string)
|
boolean |
execute_boolean(int a_chromosomeNum,
java.lang.Object[] a_args)
Executes the given chromosome as a boolean function. |
double |
execute_double(int a_chromosomeNum,
java.lang.Object[] a_args)
Executes the given chromosome as a double function. |
float |
execute_float(int a_chromosomeNum,
java.lang.Object[] a_args)
Executes the given chromosome as a float function. |
int |
execute_int(int a_chromosomeNum,
java.lang.Object[] a_args)
Executes the given chromosome as an integer function. |
java.lang.Object |
execute_object(int a_chromosomeNum,
java.lang.Object[] a_args)
Executes the given chromosome as an object function. |
void |
execute_void(int a_chromosomeNum,
java.lang.Object[] a_args)
Executes the given chromosome as an object function. |
java.lang.String |
getBusinessKey()
|
ProgramChromosome |
getChromosome(int a_index)
|
int |
getCommandOfClass(int a_chromosomeNum,
java.lang.Class a_class)
Searches for a chromosome that has the given class and returns its index. |
java.lang.String |
getPersistentRepresentation()
|
void |
growOrFull(java.lang.Class[][] a_argTypes,
CommandGene[][] a_nodeSets)
Initialize this program by using given chromosomes. |
void |
growOrFull(int a_depth,
boolean a_grow,
int a_maxNodes,
boolean[] a_fullModeAllowed,
int a_tries)
Initialize the chromosomes within this GP program using the grow or the full method. |
protected GPProgramInfo |
putToCache(GPProgram a_program)
Put program to cache. |
void |
setChromosome(int a_index,
ProgramChromosome a_chrom)
Sets the given chromosome at the given index. |
int |
size()
|
java.lang.String |
toString(int a_startNode)
Builds a string that represents the output of the GPProgram in left-hand-notion. |
java.lang.String |
toStringDebug()
Builds a string that represents the debug output of the GPProgram. |
java.lang.String |
toStringNorm(int a_startNode)
Builds a string that represents the normalized output of the GPProgram. |
| Methods inherited from class org.jgap.gp.GPProgramBase |
|---|
calcFitnessValue, equals, getApplicationData, getArgType, getArgTypes, getFitnessValue, getFitnessValueDirectly, getGPConfiguration, getMaxDepths, getMaxNodes, getMinDepths, getNodeSet, getNodeSets, getType, getTypes, setApplicationData, setArgTypes, setFitnessValue, setMaxDepths, setMaxNodes, setMinDepths, setNodeSets, setTypes |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public GPProgram()
throws java.lang.Exception
java.lang.Exception
public GPProgram(GPConfiguration a_conf,
java.lang.Class[] a_types,
java.lang.Class[][] a_argTypes,
CommandGene[][] a_nodeSets,
int[] a_minDepths,
int[] a_maxDepths,
int a_maxNodes)
throws InvalidConfigurationException
a_conf - the configuration to usea_types - the type of each chromosome, the length is the number of
chromosomesa_argTypes - the types of the arguments to each chromosome, must be an
array of arrays, the first dimension of which is the number of chromosomes
and the second dimension of which is the number of arguments to the
chromosomea_nodeSets - the nodes which are allowed to be used by each chromosome,
must be an array of arrays, the first dimension of which is the number of
chromosomes and the second dimension of which is the number of nodesa_minDepths - contains the minimum depth allowed for each chromosomea_maxDepths - contains the maximum depth allowed for each chromosomea_maxNodes - reserve space for a_maxNodes number of nodes
InvalidConfigurationException
public GPProgram(IGPProgram a_prog)
throws InvalidConfigurationException
a_prog - the GPProgram to read the initialization values from
InvalidConfigurationException
public GPProgram(GPConfiguration a_conf,
int a_numChromosomes)
throws InvalidConfigurationException
a_conf - the configuration to usea_numChromosomes - the number of chromosomes to use with this program.
InvalidConfigurationException| Method Detail |
|---|
public ProgramChromosome getChromosome(int a_index)
getChromosome in interface IGPPrograma_index - the chromosome to get
public void setChromosome(int a_index,
ProgramChromosome a_chrom)
setChromosome in interface IGPPrograma_index - sica_chrom - sic
public void growOrFull(int a_depth,
boolean a_grow,
int a_maxNodes,
boolean[] a_fullModeAllowed,
int a_tries)
a_depth - the maximum depth of the chromosome to createa_grow - true: use grow method; false: use full methoda_maxNodes - maximum number of nodes alloweda_fullModeAllowed - for each chromosome: true means full mode allowed,
otherwise use grow modea_tries - maximum number of tries to create a valid programprotected GPProgramInfo putToCache(GPProgram a_program)
a_program - the program to put into the cache
public void growOrFull(java.lang.Class[][] a_argTypes,
CommandGene[][] a_nodeSets)
a_argTypes - the types of the arguments to each chromosome, must be an
array of arrays, the first dimension of which is the number of chromosomes
and the second dimension of which is the number of arguments to the
chromosomea_nodeSets - the nodes which are allowed to be used by each chromosome,public int size()
size in interface IGPProgrampublic java.lang.String toString(int a_startNode)
a_startNode - the node to start with
public java.lang.String toStringNorm(int a_startNode)
toStringNorm in interface IGPPrograma_startNode - the node to start with
public java.lang.String toStringDebug()
public int execute_int(int a_chromosomeNum,
java.lang.Object[] a_args)
execute_int in interface IGPPrograma_chromosomeNum - the index of the chromosome to executea_args - the arguments to use
public float execute_float(int a_chromosomeNum,
java.lang.Object[] a_args)
execute_float in interface IGPPrograma_chromosomeNum - the index of the chromosome to executea_args - the arguments to use
public double execute_double(int a_chromosomeNum,
java.lang.Object[] a_args)
execute_double in interface IGPPrograma_chromosomeNum - the index of the chromosome to executea_args - the arguments to use
public boolean execute_boolean(int a_chromosomeNum,
java.lang.Object[] a_args)
execute_boolean in interface IGPPrograma_chromosomeNum - the index of the chromosome to executea_args - the arguments to use
public java.lang.Object execute_object(int a_chromosomeNum,
java.lang.Object[] a_args)
execute_object in interface IGPPrograma_chromosomeNum - the index of the chromosome to executea_args - the arguments to use
public void execute_void(int a_chromosomeNum,
java.lang.Object[] a_args)
execute_void in interface IGPPrograma_chromosomeNum - the index of the chromosome to executea_args - the arguments to use
public int getCommandOfClass(int a_chromosomeNum,
java.lang.Class a_class)
getCommandOfClass in interface IGPPrograma_chromosomeNum - the index of the chromosome to start the search witha_class - the class to find
public int compareTo(java.lang.Object a_other)
compareTo in interface java.lang.Comparablea_other - the program against which to compare this program
public java.lang.Object clone()
clone in interface ICloneableclone in class GPProgramBasepublic java.lang.String getPersistentRepresentation()
getPersistentRepresentation in interface IGPProgramprotected java.lang.String encode(java.lang.String a_string)
protected java.lang.String decode(java.lang.String a_string)
public java.lang.String getBusinessKey()
getBusinessKey in interface IBusinessKey
|
JGAP | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||