|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.groovyj.jgprog.Individual
Represents a single individual.
Copyright (c) 2000 Robert Baruch. This code is released under the GNU General Public License (GPL).
Constructor Summary | |
Individual(int numChromosomes)
Constructs an empty individual with a number of chromosomes. |
Method Summary | |
static Individual |
dupChromosome(Individual i1)
Causes a chromosome to duplicate itself in a new individual. |
boolean |
execute_boolean(int chromosomeNum)
Executes the given chromosome as a boolean function. |
double |
execute_double(int chromosomeNum)
Executes the given chromosome as a double function. |
float |
execute_float(int chromosomeNum)
Executes the given chromosome as a float function. |
int |
execute_int(int chromosomeNum)
Executes the given chromosome as an integer function. |
long |
execute_long(int chromosomeNum)
Executes the given chromosome as a long function. |
java.lang.Object |
execute_object(int chromosomeNum)
Executes the given chromosome as an object function. |
void |
execute_void(int chromosomeNum)
Executes the given chromosome which returns nothing. |
void |
full(int depth,
Type[] types,
Type[][] argTypes,
Function[][] nodeSets)
Initializes all chromosomes in this individual using the full method. |
Chromosome |
getChromosome(int num)
Gets the given chromosome. |
float |
getFitness()
Gets the adjusted fitness of this individual. |
int |
getSequence()
|
void |
grow(int depth,
Type[] types,
Type[][] argTypes,
Function[][] nodeSets)
Initializes all chromosomes in this individual using the grow method. |
void |
setFitness(float f)
Sets the adjusted fitness of this individual. |
java.lang.String |
toString()
Returns a string representing this individual. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Individual(int numChromosomes)
numChromosomes
- the number of chromosomes this individual hasMethod Detail |
public Chromosome getChromosome(int num)
num
- the chromosome number, 0 to number of chromosomes-1public void grow(int depth, Type[] types, Type[][] argTypes, Function[][] nodeSets)
types
- the type of each chromosome, must be an array of the same length
as the number of chromosomesargTypes
- 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 chromosome.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 nodes. Note that it is not necessary
to include the arguments of a chromosome as terminals in the chromosome's node set.
This is done automatically for you.public void full(int depth, Type[] types, Type[][] argTypes, Function[][] nodeSets)
types
- the type of each chromosome, must be an array of the same length
as the number of chromosomesargTypes
- 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 chromosome.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 nodes. Note that it is not necessary
to include the arguments of a chromosome as terminals in the chromosome's node set.
This is done automatically for you.public static Individual dupChromosome(Individual i1)
i1
- the individual in which to duplicate the chromosomepublic boolean execute_boolean(int chromosomeNum)
chromosomeNum
- the chromosome to executepublic void execute_void(int chromosomeNum)
chromosomeNum
- the chromosome to executepublic int execute_int(int chromosomeNum)
chromosomeNum
- the chromosome to executepublic java.lang.Object execute_object(int chromosomeNum)
chromosomeNum
- the chromosome to executepublic long execute_long(int chromosomeNum)
chromosomeNum
- the chromosome to executepublic float execute_float(int chromosomeNum)
chromosomeNum
- the chromosome to executepublic double execute_double(int chromosomeNum)
chromosomeNum
- the chromosome to executepublic float getFitness()
World
.public void setFitness(float f)
f
- the adjusted fitnesspublic java.lang.String toString()
toString
in class java.lang.Object
public int getSequence()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |