|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.vizzini.ai.geneticalgorithm.AbstractPopulation
public abstract class AbstractPopulation
Provides base functionality for a collection which holds
IChromosome
s.
Constructor Summary | |
---|---|
AbstractPopulation(int capacity)
Construct this object using the given parameter. |
Method Summary | |
---|---|
void |
add(IChromosome chromosome)
Add the given chromosome. |
void |
addAll(IPopulation population)
Add all chromosomes from the given population to this. |
int |
capacity()
Return the capacity of the population. |
void |
clearFitnesses()
Clear the fitnesses of all members of the population. |
boolean |
contains(IChromosome chromosome)
Return true if the given chromosome is a duplicate of one already in the population. |
boolean |
contains(IChromosome chromosome,
int start,
int end)
Return true if the given chromosome is a duplicate of one already in the given range of the population. |
IChromosome |
first()
Return the first chromosome. |
IChromosome |
get(int i)
Return the chromosome at the given index. |
double |
getAverageFitness()
Return the average fitness of all the chromosomes. |
int |
getMaxFitness()
|
int |
getMinFitness()
|
int |
getSumFitness()
Return the sum of the chromosome's fitnesses. |
int |
indexOf(IChromosome chromosome)
Return the index of the given chromosome. |
boolean |
isEmpty()
Return true if this is empty. |
void |
resetAverageFitness()
Reset the average fitness. |
void |
setFitnesses(int fitness)
Set the fitnesses of all members of the population to the given value. |
void |
shuffle()
Shuffle the chromosomes. |
int |
size()
Return the current size of the population. |
void |
sort()
Sort the chromosomes. |
String |
toString()
Return a string representation of this object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public AbstractPopulation(int capacity)
capacity
- Capacity of this population.Method Detail |
---|
public void add(IChromosome chromosome)
add
in interface IPopulation
chromosome
- Chromosome.public void addAll(IPopulation population)
addAll
in interface IPopulation
public int capacity()
capacity
in interface IPopulation
public void clearFitnesses()
clearFitnesses
in interface IPopulation
public boolean contains(IChromosome chromosome)
contains
in interface IPopulation
chromosome
- Chromosome for which to search.public boolean contains(IChromosome chromosome, int start, int end)
contains
in interface IPopulation
chromosome
- Chromosome for which to search.start
- Start index.end
- End index plus one.public IChromosome first()
first
in interface IPopulation
public IChromosome get(int i)
get
in interface IPopulation
i
- Chromosome index.public double getAverageFitness()
getAverageFitness
in interface IPopulation
public int getMaxFitness()
getMaxFitness
in interface IPopulation
public int getMinFitness()
getMinFitness
in interface IPopulation
public int getSumFitness()
getSumFitness
in interface IPopulation
public int indexOf(IChromosome chromosome)
indexOf
in interface IPopulation
public boolean isEmpty()
isEmpty
in interface IPopulation
public void resetAverageFitness()
resetAverageFitness
in interface IPopulation
public void setFitnesses(int fitness)
setFitnesses
in interface IPopulation
public void shuffle()
shuffle
in interface IPopulation
public int size()
size
in interface IPopulation
public void sort()
sort
in interface IPopulation
public String toString()
toString
in interface IPopulation
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2007 Vizzini.org. All Rights Reserved. | 2007.12.25.03.00.02 |