| Modifier and Type | Field and Description |
|---|---|
| private final CrossoverPolicy | crossoverPolicy
the crossover policy used by the algorithm. |
| private final double | crossoverRate
the rate of crossover for the algorithm. |
| private int | generationsEvolved
the number of generations evolved to reach |
| private final MutationPolicy | mutationPolicy
the mutation policy used by the algorithm. |
| private final double | mutationRate
the rate of mutation for the algorithm. |
| private static RandomGenerator | randomGenerator
Static random number generator shared by GA implementation classes. |
| private final SelectionPolicy | selectionPolicy
the selection policy used by the algorithm. |
| Access | Constructor and Description |
|---|---|
| public | GeneticAlgorithm(final CrossoverPolicy
The crossoverPolicy, final double CrossoverPolicyThe crossover rate as a percentage (0-1 inclusive) crossoverRate, final MutationPolicy The mutationPolicy, final double MutationPolicyThe mutation rate as a percentage (0-1 inclusive) mutationRate, final SelectionPolicy The selectionPolicy)SelectionPolicyCreate a new genetic algorithm. |
| Modifier and Type | Method and Description |
|---|---|
| public Population | Returns: the population that satisfies the stopping condition.the initial, seed population. initial, final StoppingCondition the stopping condition used to stop evolution. condition)Evolve the given population. |
| public CrossoverPolicy | |
| public double | |
| public int | Returns: number of generations evolvedReturns the number of generations evolved to reach |
| public MutationPolicy | |
| public double | |
| public static synchronized RandomGenerator | Returns: the static random generator shared by GA implementation classesReturns the (static) random generator. |
| public SelectionPolicy | |
| public Population | Returns: the population for the next generation.the current population. current)Evolve the given population into the next generation. |
| public static synchronized void |
| crossoverPolicy | back to summary |
|---|---|
| private final CrossoverPolicy crossoverPolicy the crossover policy used by the algorithm. | |
| crossoverRate | back to summary |
|---|---|
| private final double crossoverRate the rate of crossover for the algorithm. | |
| generationsEvolved | back to summary |
|---|---|
| private int generationsEvolved the number of generations evolved to reach | |
| mutationPolicy | back to summary |
|---|---|
| private final MutationPolicy mutationPolicy the mutation policy used by the algorithm. | |
| mutationRate | back to summary |
|---|---|
| private final double mutationRate the rate of mutation for the algorithm. | |
| randomGenerator | back to summary |
|---|---|
| private static RandomGenerator randomGenerator Static random number generator shared by GA implementation classes. Set the randomGenerator seed to get
reproducible results. Use | |
| selectionPolicy | back to summary |
|---|---|
| private final SelectionPolicy selectionPolicy the selection policy used by the algorithm. | |
| GeneticAlgorithm | back to summary |
|---|---|
| public GeneticAlgorithm(final CrossoverPolicy crossoverPolicy, final double crossoverRate, final MutationPolicy mutationPolicy, final double mutationRate, final SelectionPolicy selectionPolicy) throws OutOfRangeException Create a new genetic algorithm.
| |
| evolve | back to summary |
|---|---|
| public Population evolve(final Population initial, final StoppingCondition condition) Evolve the given population. Evolution stops when the stopping condition
is satisfied. Updates the
| |
| getCrossoverPolicy | back to summary |
|---|---|
| public CrossoverPolicy getCrossoverPolicy() Returns the crossover policy.
| |
| getCrossoverRate | back to summary |
|---|---|
| public double getCrossoverRate() Returns the crossover rate.
| |
| getGenerationsEvolved | back to summary |
|---|---|
| public int getGenerationsEvolved() Returns the number of generations evolved to reach
| |
| getMutationPolicy | back to summary |
|---|---|
| public MutationPolicy getMutationPolicy() Returns the mutation policy.
| |
| getMutationRate | back to summary |
|---|---|
| public double getMutationRate() Returns the mutation rate.
| |
| getRandomGenerator | back to summary |
|---|---|
| public static synchronized RandomGenerator getRandomGenerator() Returns the (static) random generator.
| |
| getSelectionPolicy | back to summary |
|---|---|
| public SelectionPolicy getSelectionPolicy() Returns the selection policy.
| |
| nextGeneration | back to summary |
|---|---|
| public Population nextGeneration(final Population current) Evolve the given population into the next generation.
| |
| setRandomGenerator | back to summary |
|---|---|
| public static synchronized void setRandomGenerator(final RandomGenerator random) Set the (static) random generator.
| |