|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.groovyj.jgprog.Population
Represents a population of individuals.
Copyright: Copyright (c) 2000 Robert Baruch. This code is released under the GNU General Public License (GPL).
Constructor Summary | |
Population(int size)
Constructs a population of the given size, with empty individuals. |
Method Summary | |
void |
create(Type[] types,
Type[][] argTypes,
Function[][] nodeSets)
Creates a population using the ramped half-and-half method. |
boolean |
execute_boolean(int n,
int c)
|
double |
execute_double(int n,
int c)
|
float |
execute_float(int n,
int c)
|
int |
execute_int(int n,
int c)
|
long |
execute_long(int n,
int c)
|
void |
execute_void(int n,
int c)
|
Individual |
getIndividual(int i)
Gets a particular individual. |
int |
getSize()
Gets the number of individuals in this population. |
void |
setIndividual(int i,
Individual ind)
Sets a particular individual. |
void |
sort(java.util.Comparator c)
Sorts the population into "ascending" order using some criterion for "ascending". |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Population(int size)
size
- the number of individuals in the populationMethod Detail |
public void create(Type[] types, Type[][] argTypes, Function[][] nodeSets)
random
- the random number generatormaxdepth
- the maximum depth of the initial individualstypes
- the type of each chromosome, the length
is 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 int getSize()
public Individual getIndividual(int i)
i
- the individual number, 0 to population size-1.public void setIndividual(int i, Individual ind)
i
- the individual number, 0 to population size-1ind
- the individualpublic void sort(java.util.Comparator c)
c
- the Comparator to usepublic void execute_void(int n, int c)
public boolean execute_boolean(int n, int c)
public int execute_int(int n, int c)
public long execute_long(int n, int c)
public float execute_float(int n, int c)
public double execute_double(int n, int c)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |