org.vizzini.ai.geneticalgorithm
Interface IPopulation

All Known Implementing Classes:
AbstractPopulation, DefaultPopulation

public interface IPopulation

Defines methods required by a collection which holds IChromosome s.

Since:
v0.3
Version:
v0.3
Author:
Jeffrey M. Thompson

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.
 

Method Detail

add

void add(IChromosome chromosome)
Add the given chromosome.

Parameters:
chromosome - Chromosome.
Since:
v0.3

addAll

void addAll(IPopulation population)
Add all chromosomes from the given population to this.

Since:
v0.3

capacity

int capacity()
Return the capacity of the population.

Since:
v0.3

clearFitnesses

void clearFitnesses()
Clear the fitnesses of all members of the population.

Since:
v0.3

contains

boolean contains(IChromosome chromosome)
Return true if the given chromosome is a duplicate of one already in the population.

Parameters:
chromosome - Chromosome for which to search.
Since:
v0.3

contains

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.

Parameters:
chromosome - Chromosome for which to search.
start - Start index.
end - End index plus one.
Since:
v0.3

first

IChromosome first()
Return the first chromosome.

Since:
v0.3

get

IChromosome get(int i)
Return the chromosome at the given index.

Parameters:
i - Chromosome index.
Since:
v0.3

getAverageFitness

double getAverageFitness()
Return the average fitness of all the chromosomes.

Since:
v0.3

getMaxFitness

int getMaxFitness()
Returns:
Return maxFitness.
Since:
v0.3

getMinFitness

int getMinFitness()
Returns:
Return minFitness.
Since:
v0.3

getSumFitness

int getSumFitness()
Return the sum of the chromosome's fitnesses.

Since:
v0.3

indexOf

int indexOf(IChromosome chromosome)
Return the index of the given chromosome.

Since:
v0.3

isEmpty

boolean isEmpty()
Return true if this is empty.

Since:
v0.3

resetAverageFitness

void resetAverageFitness()
Reset the average fitness.

Since:
v0.3

setFitnesses

void setFitnesses(int fitness)
Set the fitnesses of all members of the population to the given value.

Since:
v0.3

shuffle

void shuffle()
Shuffle the chromosomes.

Since:
v0.3

size

int size()
Return the current size of the population.

Since:
v0.3

sort

void sort()
Sort the chromosomes.

Since:
v0.3

toString

String toString()
Return a string representation of this object.

Overrides:
toString in class Object
Since:
v0.3


Copyright © 2007 Vizzini.org. All Rights Reserved. 2007.12.25.03.00.02