Watchmaker Framework for Evolutionary Computation API
(Version 0.7.1)

org.uncommons.watchmaker.framework
Interface CandidateFactory<T>

Type Parameters:
T - The type of evolvable entity created by the factory.
All Known Implementing Classes:
AbstractCandidateFactory, BitStringFactory, ListPermutationFactory, ObjectArrayPermutationFactory, StringFactory

public interface CandidateFactory<T>

Creates new populations of candidates. For most implementations it will be easiest just to extend AbstractCandidateFactory and implement the method to generate a single random candidate.

Author:
Daniel Dyer

Method Summary
 List<T> generateInitialPopulation(int populationSize, Collection<T> seedCandidates, Random rng)
          Sometimes it is desirable to seed the initial population with some known good candidates, or partial solutions, in order to provide some hints for the evolution process.
 List<T> generateInitialPopulation(int populationSize, Random rng)
          Creates an initial population of candidates.
 T generateRandomCandidate(Random rng)
          Randomly create a single candidate solution.
 

Method Detail

generateInitialPopulation

List<T> generateInitialPopulation(int populationSize,
                                  Random rng)
Creates an initial population of candidates. If more control is required over the composition of the initial population, consider the overloaded generateInitialPopulation(int,Collection,Random) method.

Parameters:
populationSize - The number of candidates to create.
rng - The random number generator to use when creating the initial candidates.
Returns:
An initial population of candidate solutions.

generateInitialPopulation

List<T> generateInitialPopulation(int populationSize,
                                  Collection<T> seedCandidates,
                                  Random rng)
Sometimes it is desirable to seed the initial population with some known good candidates, or partial solutions, in order to provide some hints for the evolution process. This method generates an initial population, seeded with some initial candidates. If the number of seed candidates is less than the required population size, the factory should generate additional candidates to fill the remaining spaces in the population.

Parameters:
populationSize - The size of the initial population.
seedCandidates - Candidates to seed the population with. Number of candidates must be no bigger than the population size.
rng - The random number generator to use when creating additional candidates to fill the population when the number of seed candidates is insufficient. This can be null if and only if the number of seed candidates provided is sufficient to fully populate the initial population.
Returns:
An initial population of candidate solutions, including the specified seed candidates.

generateRandomCandidate

T generateRandomCandidate(Random rng)
Randomly create a single candidate solution.

Parameters:
rng - The random number generator to use when creating the random candidate.
Returns:
A randomly-initialised candidate.

Watchmaker Framework for Evolutionary Computation API
(Version 0.7.1)