public final class EvolutionUtils extends Object
Modifier and Type | Method and Description |
---|---|
static <T> PopulationData<T> |
getPopulationData(List<EvaluatedCandidate<T>> evaluatedPopulation,
boolean naturalFitness,
int eliteCount,
int iterationNumber,
long startTime)
Gets data about the current population, including the fittest candidate
and statistics about the population as a whole.
|
static <T> List<TerminationCondition> |
shouldContinue(PopulationData<T> data,
TerminationCondition... conditions)
Given data about the current population and a set of termination conditions, determines
whether or not the evolution should continue.
|
static <T> void |
sortEvaluatedPopulation(List<EvaluatedCandidate<T>> evaluatedPopulation,
boolean naturalFitness)
Sorts an evaluated population in descending order of fitness
(descending order of fitness score for natural scores, ascending
order of scores for non-natural scores).
|
public static <T> List<TerminationCondition> shouldContinue(PopulationData<T> data, TerminationCondition... conditions)
T
- The type of entity that is being evolved.data
- The current state of the population.conditions
- One or more termination conditions. The evolution should not continue if
any of these is satisfied.public static <T> void sortEvaluatedPopulation(List<EvaluatedCandidate<T>> evaluatedPopulation, boolean naturalFitness)
T
- The type of entity that is being evolved.evaluatedPopulation
- The population to be sorted (in-place).naturalFitness
- True if higher fitness scores mean fitter individuals, false otherwise.public static <T> PopulationData<T> getPopulationData(List<EvaluatedCandidate<T>> evaluatedPopulation, boolean naturalFitness, int eliteCount, int iterationNumber, long startTime)
T
- The type of entity that is being evolved.evaluatedPopulation
- Population of candidate solutions with their
associated fitness scores.naturalFitness
- True if higher fitness scores mean fitter individuals, false otherwise.eliteCount
- The number of candidates preserved via elitism.iterationNumber
- The zero-based index of the current generation/epoch.startTime
- The time at which the evolution began, expressed as a number of milliseconds since
00:00 on 1st January 1970.