|
Orbital library | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object orbital.algorithm.evolutionary.Population
public abstract class Population
This class represents a population of genomes as a data structure.
Some of these Genomes will reproduce with Genome.recombine
to generate the members of the next generation.
A population provides the following operators and functions:
Genome.getFitness()
, aggregate members:ListConstructor Summary | |
---|---|
protected |
Population()
Create an empty population. |
Method Summary | |
---|---|
boolean |
add(java.lang.Object o)
Append a genome without replacing which will increase the size. |
java.lang.Object |
clone()
Returns a deep copy of this population. |
static Population |
create(Genome prototype,
int size)
Generate (create) a new random population of genomes. |
static Population |
create(Population population,
Genome prototype,
int size)
Generate (create) a new random population of genomes. |
boolean |
equals(java.lang.Object o)
Checks for equality. |
void |
evaluate(boolean redo)
Evaluates the fitness of the Genomes, if necessary. |
Genome |
get(int i)
Gets the i-th member-Genome. |
Genome |
get(int i,
boolean best)
Get the i-th member in the order specified. |
double[] |
getFitnessArray()
Returns an array with the fitness values of all genomes. |
int |
getGeneration()
Get the current generation count. |
java.util.List |
getMembers()
|
double |
getOverallDistance()
Calculate an overall difference of all genomes in the population with several difference comparisons. |
int |
hashCode()
|
java.util.Iterator |
iterator()
|
java.util.ListIterator |
listIterator()
|
java.util.ListIterator |
listIterator(int index)
|
java.lang.Object |
remove(int index)
|
boolean |
remove(java.lang.Object o)
|
protected void |
setGeneration(int newGeneration)
|
int |
size()
Get the size of population i.e. |
java.lang.String |
toString()
Returns a string representation of the object. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected Population()
Method Detail |
---|
public java.lang.Object clone()
clone
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public int getGeneration()
protected void setGeneration(int newGeneration)
public Genome get(int i)
public Genome get(int i, boolean best)
best
- whether to get the i-th best, or the i-th worst.public double getOverallDistance()
public double[] getFitnessArray()
public int size()
public boolean add(java.lang.Object o)
merge(Genome)
public boolean remove(java.lang.Object o)
public java.lang.Object remove(int index)
public java.util.Iterator iterator()
public java.util.ListIterator listIterator()
public java.util.ListIterator listIterator(int index)
public java.util.List getMembers()
public void evaluate(boolean redo)
Default implementation will call evaluate for each member Genome.
redo
- force whole evaluation again, even for cached fitness values.
Should usually be false
for efficiency reasons.public java.lang.String toString()
toString
in class java.lang.Object
public static Population create(Population population, Genome prototype, int size)
Note that the prototype genome should not contain genes that are immune to mutation since that is an essential part of creating an initial random population without problem specific means.
Also note that a mixed random and problem specific initial population might get better results. So consider merging them.
population
- the population to fill with Genomes.size
- the initial size of the new population. i.e. the initial number of Genomes.prototype
- the genome prototype to clone and mutate to create the population.
The prototype must have the right structure to serve as a problem specific solution,
but does not necessarily need to have meaningful values.
evaluated
.Genome.mutate(double)
,
Genome.inverse()
public static Population create(Genome prototype, int size)
Note that the prototype genome should not contain genes that are immune to mutation since that is an essential part of creating an initial random population without problem specific means.
Also note that a mixed random and problem specific initial population might get better results. So consider merging them.
size
- the initial size of the new population. i.e. the initial number of Genomes.prototype
- the genome prototype to clone and mutate to create the population
The prototype must have the right structure to serve as a problem specific solution,
but does not necessarily need to have meaningful values.
Genome.mutate(double)
,
Genome.inverse()
|
Orbital library 1.3.0: 11 Apr 2009 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |