public class PhrGeneticAlgorithm
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected int |
beatsPerBar |
protected boolean |
finished |
protected double[] |
fitness |
protected FitnessEvaluater |
fitnessEvaluater |
protected double |
initialLength |
protected int |
initialSize |
protected long |
iteration |
protected Mutater |
mutater |
protected int |
originalSize |
protected ParentSelector |
parentSelector |
protected Phrase[] |
population |
protected PopulationInitialiser |
populationInitialiser |
protected Recombiner |
recombiner |
protected SurvivorSelector |
survivorSelector |
protected TerminationCriteria |
terminationCriteria |
Constructor and Description |
---|
PhrGeneticAlgorithm(Phrase phrase,
int beatsPerBar,
PopulationInitialiser populationInitialiser,
FitnessEvaluater fitnessEvaluater,
TerminationCriteria terminationCriteria,
ParentSelector parentSelector,
Recombiner recombiner,
Mutater mutater,
SurvivorSelector survivorSelector) |
Modifier and Type | Method and Description |
---|---|
double |
getAverageFitness() |
double |
getBestFitness() |
Phrase |
getBestIndividual() |
double[] |
getFitness() |
long |
getIteration() |
Mutater |
getMutater() |
Phrase[] |
getOrderedPopulation()
Returns the population ordered by fitness with better fitness' first.
|
Phrase[] |
getPopulation() |
double |
getStandardDeviation() |
boolean |
iterate()
Evolve the population through one generation.
|
long |
iterate(long iterations)
Evolve the population through the specified number of generations.
|
void |
restoreInitialSize() |
void |
setBeatsPerBar(int beats) |
void |
setUpNewPopulation(Phrase phrase) |
void |
zeroInitialSize() |
protected Phrase[] population
protected double[] fitness
protected PopulationInitialiser populationInitialiser
protected FitnessEvaluater fitnessEvaluater
protected TerminationCriteria terminationCriteria
protected ParentSelector parentSelector
protected Recombiner recombiner
protected Mutater mutater
protected SurvivorSelector survivorSelector
protected int beatsPerBar
protected long iteration
protected double initialLength
protected int initialSize
protected int originalSize
protected boolean finished
public PhrGeneticAlgorithm(Phrase phrase, int beatsPerBar, PopulationInitialiser populationInitialiser, FitnessEvaluater fitnessEvaluater, TerminationCriteria terminationCriteria, ParentSelector parentSelector, Recombiner recombiner, Mutater mutater, SurvivorSelector survivorSelector)
public void setUpNewPopulation(Phrase phrase)
public void setBeatsPerBar(int beats)
public void zeroInitialSize()
public void restoreInitialSize()
public long getIteration()
public boolean iterate()
public long iterate(long iterations)
public double[] getFitness()
public Phrase[] getPopulation()
public Phrase[] getOrderedPopulation()
public double getBestFitness()
public double getAverageFitness()
public double getStandardDeviation()
public Phrase getBestIndividual()
public Mutater getMutater()