|
JGAP | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jgap.gp.CommandGene
public abstract class CommandGene
Abstract base class for all GP commands. A CommandGene can hold additional CommandGene's, it acts sort of like a Composite (also see CompositeGene for a smiliar characteristics, although for a GA).
| Field Summary | |
|---|---|
static java.lang.Class |
BooleanClass
|
static double |
DELTA
Delta, useful for comparing doubles and floats. |
static java.lang.Class |
DoubleClass
|
static java.lang.Class |
FloatClass
|
static java.lang.Class |
IntegerClass
|
static java.lang.Class |
LongClass
|
static java.lang.Class |
VoidClass
|
| Constructor Summary | |
|---|---|
CommandGene(GPConfiguration a_conf,
int a_arity,
java.lang.Class a_returnType)
|
|
| Method Summary | |
|---|---|
protected void |
check(ProgramChromosome a_program)
|
protected void |
check(ProgramChromosome a_program,
int a_index)
|
void |
cleanup()
|
int |
compareTo(java.lang.Object a_other)
|
boolean |
equals(java.lang.Object a_other)
|
boolean |
execute_boolean(ProgramChromosome c,
int n,
java.lang.Object[] args)
Executes this node as a boolean. |
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.Object |
execute(ProgramChromosome c,
int n,
java.lang.Object[] args)
Executes this node without knowing its return type. |
java.lang.Object |
getAllele()
|
java.lang.Object |
getApplicationData()
Retrieves the application-specific data that is attached to this Gene. |
int |
getArity(IGPProgram a_indvividual)
Arity of the command. |
java.lang.Class |
getChildType(IGPProgram a_ind,
int a_chromNum)
Gets the type of node allowed form the given child number. |
double |
getEnergy()
|
GPConfiguration |
getGPConfiguration()
|
protected java.lang.Object |
getInternalValue()
|
java.lang.String |
getName()
|
java.lang.String |
getPersistentRepresentation()
|
java.lang.Class |
getReturnType()
|
int |
hashCode()
Retrieves the hash code value for a CommandGene. |
protected void |
init()
Initializations, called from each Constructor. |
boolean |
isAffectGlobalState()
|
boolean |
isCompareApplicationData()
|
boolean |
isFloatType()
|
boolean |
isIntegerType()
|
boolean |
isValid(ProgramChromosome a_program)
Subclasses capable of validating programs should overwrite this method. |
boolean |
isValid(ProgramChromosome a_program,
int a_index)
|
void |
setAllele(java.lang.Object a_newValue)
|
void |
setApplicationData(java.lang.Object a_newData)
This sets the application-specific data that is attached to this Gene. |
void |
setCompareApplicationData(boolean a_doCompare)
Should we also consider the application data when comparing? |
void |
setEnergy(double a_energy)
Sets the energy of the gene |
void |
setNoValidation(boolean a_noValidation)
|
void |
setReturnType(java.lang.Class a_type)
Sets the return type of this node. |
void |
setToRandomValue(RandomGenerator a_numberGenerator)
|
void |
setValueFromPersistentRepresentation(java.lang.String a_representation)
|
int |
size()
|
abstract java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final double DELTA
public static final java.lang.Class BooleanClass
public static final java.lang.Class IntegerClass
public static final java.lang.Class LongClass
public static final java.lang.Class FloatClass
public static final java.lang.Class DoubleClass
public static final java.lang.Class VoidClass
| Constructor Detail |
|---|
public CommandGene(GPConfiguration a_conf,
int a_arity,
java.lang.Class a_returnType)
throws InvalidConfigurationException
InvalidConfigurationException| Method Detail |
|---|
protected void init()
public void setAllele(java.lang.Object a_newValue)
public java.lang.Object getAllele()
public java.lang.String getPersistentRepresentation()
throws java.lang.UnsupportedOperationException
java.lang.UnsupportedOperationException
public void setValueFromPersistentRepresentation(java.lang.String a_representation)
throws java.lang.UnsupportedOperationException,
UnsupportedRepresentationException
java.lang.UnsupportedOperationException
UnsupportedRepresentationExceptionpublic void setToRandomValue(RandomGenerator a_numberGenerator)
public void cleanup()
public int size()
public int getArity(IGPProgram a_indvividual)
a_indvividual - the invididual the command's arity may depend on (in
most cases the arity will not depend on the individual)
public int compareTo(java.lang.Object a_other)
compareTo in interface java.lang.Comparablepublic boolean equals(java.lang.Object a_other)
equals in class java.lang.Objectpublic abstract java.lang.String toString()
toString in class java.lang.Object
public java.lang.Object execute(ProgramChromosome c,
int n,
java.lang.Object[] args)
c - the current Chromosome which is executingn - the index of the Function in the Chromosome's Function array which
is executingargs - the arguments to the current Chromosome which is executing
java.lang.UnsupportedOperationException - if the type of this node is not
booleanpublic java.lang.Class getReturnType()
public void setReturnType(java.lang.Class a_type)
a_type - the type to set the return type to
public boolean execute_boolean(ProgramChromosome c,
int n,
java.lang.Object[] args)
c - ignored heren - ignored hereargs - ignored here
java.lang.UnsupportedOperationException
public void execute_void(ProgramChromosome c,
int n,
java.lang.Object[] args)
c - ignored heren - ignored hereargs - ignored here
java.lang.UnsupportedOperationException
public int execute_int(ProgramChromosome c,
int n,
java.lang.Object[] args)
c - ignored heren - ignored hereargs - ignored here
java.lang.UnsupportedOperationException
public long execute_long(ProgramChromosome c,
int n,
java.lang.Object[] args)
c - ignored heren - ignored hereargs - ignored here
java.lang.UnsupportedOperationException
public float execute_float(ProgramChromosome c,
int n,
java.lang.Object[] args)
c - ignored heren - ignored hereargs - ignored here
java.lang.UnsupportedOperationException
public double execute_double(ProgramChromosome c,
int n,
java.lang.Object[] args)
c - ignored heren - ignored hereargs - ignored here
java.lang.UnsupportedOperationException
public java.lang.Object execute_object(ProgramChromosome c,
int n,
java.lang.Object[] args)
c - ignored heren - ignored hereargs - ignored here
java.lang.UnsupportedOperationExceptionpublic java.lang.String getName()
public java.lang.Class getChildType(IGPProgram a_ind,
int a_chromNum)
a_ind - the individual the child belongs toa_chromNum - the chromosome number
protected java.lang.Object getInternalValue()
public int hashCode()
hashCode in class java.lang.Objectpublic boolean isIntegerType()
public boolean isFloatType()
public boolean isAffectGlobalState()
public boolean isValid(ProgramChromosome a_program)
a_program - the ProgramChromosome to validate
public boolean isValid(ProgramChromosome a_program,
int a_index)
protected void check(ProgramChromosome a_program)
protected void check(ProgramChromosome a_program,
int a_index)
public void setNoValidation(boolean a_noValidation)
public GPConfiguration getGPConfiguration()
public void setApplicationData(java.lang.Object a_newData)
a_newData - the new application-specific data to attach to this
Genepublic java.lang.Object getApplicationData()
public void setCompareApplicationData(boolean a_doCompare)
a_doCompare - true: consider application data in method compareTopublic boolean isCompareApplicationData()
public double getEnergy()
public void setEnergy(double a_energy)
a_energy - the energy to set
|
JGAP | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||