|
||||||||||
| 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 IPopulationchromosome - Chromosome.public void addAll(IPopulation population)
addAll in interface IPopulationpublic int capacity()
capacity in interface IPopulationpublic void clearFitnesses()
clearFitnesses in interface IPopulationpublic boolean contains(IChromosome chromosome)
contains in interface IPopulationchromosome - Chromosome for which to search.
public boolean contains(IChromosome chromosome,
int start,
int end)
contains in interface IPopulationchromosome - Chromosome for which to search.start - Start index.end - End index plus one.public IChromosome first()
first in interface IPopulationpublic IChromosome get(int i)
get in interface IPopulationi - Chromosome index.public double getAverageFitness()
getAverageFitness in interface IPopulationpublic int getMaxFitness()
getMaxFitness in interface IPopulationpublic int getMinFitness()
getMinFitness in interface IPopulationpublic int getSumFitness()
getSumFitness in interface IPopulationpublic int indexOf(IChromosome chromosome)
indexOf in interface IPopulationpublic boolean isEmpty()
isEmpty in interface IPopulationpublic void resetAverageFitness()
resetAverageFitness in interface IPopulationpublic void setFitnesses(int fitness)
setFitnesses in interface IPopulationpublic void shuffle()
shuffle in interface IPopulationpublic int size()
size in interface IPopulationpublic void sort()
sort in interface IPopulationpublic String toString()
toString in interface IPopulationtoString 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 |