JGAP

examples.gp.paintedDesert
Class X

java.lang.Object
  extended by org.jgap.gp.CommandGene
      extended by examples.gp.paintedDesert.AntCommand
          extended by examples.gp.paintedDesert.X
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable, IMutateable

public class X
extends AntCommand
implements IMutateable

Look ahead, right and left (in this order) and turns to food in case such was detected. Does nothing in the other case.

This command is not part of the classic ant problem.

Since:
3.01
See Also:
Serialized Form

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
X(GPConfiguration a_conf)
          Constructor.
X(GPConfiguration a_conf, int a_subReturnType, int[] a_childSubTypes)
           
 
Method Summary
 CommandGene applyMutation(int index, double a_percentage)
          Mutates a CommandGene.
 int execute_int(ProgramChromosome a_chrom, int a_n, java.lang.Object[] a_args)
          Executes this node as an integer.
 java.lang.Class getChildType(IGPProgram a_ind, int a_chromNum)
          Gets the type of node allowed from the given child number.
 java.lang.String toString()
           
 
Methods inherited from class examples.gp.paintedDesert.AntCommand
getMap
 
Methods inherited from class org.jgap.gp.CommandGene
check, check, cleanup, compareTo, dynamizeArity, ensureUniqueness, ensureUniqueness, ensureUniqueness2, equals, execute_boolean, execute_double, execute_float, execute_long, execute_object, execute_void, execute, getAllele, getApplicationData, getArity, getArityMax, getArityMin, getCommandType, getEnergy, getGPConfiguration, getInternalValue, getName, getPersistentRepresentation, getPersistentRepresentationExt, getReturnType, getSubChildType, getSubChildTypes, getSubReturnType, hashCode, init, isAffectGlobalState, isCompareApplicationData, isFloatType, isIntegerType, isValid, isValid, setAllele, setApplicationData, setArity, setArityMax, setArityMin, setCompareApplicationData, setEnergy, setNoValidation, setReturnType, setToRandomValue, setValueFromPersistentRepresentation, setValueFromString, size
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

X

public X(GPConfiguration a_conf)
  throws InvalidConfigurationException
Constructor.

Parameters:
a_conf - the configuration to use
Throws:
InvalidConfigurationException
Since:
3.01

X

public X(GPConfiguration a_conf,
         int a_subReturnType,
         int[] a_childSubTypes)
  throws InvalidConfigurationException
Throws:
InvalidConfigurationException
Method Detail

applyMutation

public CommandGene applyMutation(int index,
                                 double a_percentage)
                          throws InvalidConfigurationException
Description copied from interface: IMutateable
Mutates a CommandGene.

Specified by:
applyMutation in interface IMutateable
Parameters:
index - references the part of a multipart object, normally not relevant
a_percentage - the mutation rate (0.0 to 1.0)
Returns:
the mutant
Throws:
InvalidConfigurationException

execute_int

public int execute_int(ProgramChromosome a_chrom,
                       int a_n,
                       java.lang.Object[] a_args)
Description copied from class: CommandGene
Executes this node as an integer. Override to implement.

Overrides:
execute_int in class CommandGene
Parameters:
a_chrom - ignored here
a_n - ignored here
a_args - ignored here
Returns:
nothing but exception

getChildType

public java.lang.Class getChildType(IGPProgram a_ind,
                                    int a_chromNum)
Description copied from class: CommandGene
Gets the type of node allowed from the given child number. Should be overridden in subclasses.

Overrides:
getChildType in class CommandGene
Parameters:
a_ind - the individual the child belongs to
a_chromNum - the chromosome number
Returns:
the type of node allowed for that child, or null of no child exists

toString

public java.lang.String toString()
Specified by:
toString in class CommandGene
Returns:
the string representation of the command. Especially usefull to output a resulting formula in human-readable form.

JGAP