|
Grail (C++)
1.4.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
|
3 #ifndef GRAIL_MUTATION_H
4 #define GRAIL_MUTATION_H
50 Mutation(
double mutationPhaseRate = 1.0,
51 double mutateIndividualRate = 0.09,
52 double mutateGeneRate = 0.5,
53 bool mutateBothParentsAndChildren =
true,
56 std::mt19937_64::result_type seed = std::random_device{}());
65 virtual void Perform(
const std::vector<std::unique_ptr<Individual>>& parentPopulation,
66 const std::vector<std::unique_ptr<Individual>>& childrenPopulation);
99 std::mt19937_64 randGen;
103 std::vector<std::unique_ptr<Individual>> populationAfter{};
BaseEvoParam - A class that represents a parameter that is modifiable (optimizable) by evolutionary a...
Definition: EvoParam.hh:20
virtual void MutateGene(Individual &individual, BaseEvoParam &gene)
The function that performs the mutation operation of a single parameter within the mutated individual...
Definition: Mutation.cpp:124
@ ITERATE_AND_TEST_P
ITERATE_AND_TEST_P - a random test whether to mutate an individual will be performed for each individ...
MutationSelectionType
Predefined ways in which individuals are selected from the population for mutation....
Definition: Mutation.hh:28
virtual void Perform(const std::vector< std::unique_ptr< Individual >> &parentPopulation, const std::vector< std::unique_ptr< Individual >> &childrenPopulation)
Perform - Attempts to mutate the entire population. The umber of individuals mutates is based on muta...
Definition: Mutation.cpp:31
Mutation(double mutationPhaseRate=1.0, double mutateIndividualRate=0.09, double mutateGeneRate=0.5, bool mutateBothParentsAndChildren=true, MutationSelectionType randomResolutionTypeForIndividual=MutationSelectionType::SELECT_P_OF_N, MutationSelectionType randomResolutionTypeForGene=MutationSelectionType::SELECT_P_OF_N, std::mt19937_64::result_type seed=std::random_device{}())
Mutation - Constructor.
Definition: Mutation.cpp:10
bool MutateBothParentsAndChildren
If true: both the previous population and children can be mutated; if false: only the individuals aft...
Definition: Mutation.hh:80
@ SELECT_P_OF_N
SELECT_P_OF_N - upfront, the PopulationSize*MutationIndividualRate of individuals will be randomly ch...
double MutateGeneRate
Probability that a gene of an individual will be considered for mutation [if (randomResolutionTypeFor...
Definition: Mutation.hh:77
MutationSelectionType RandomResolutionTypeForIndividual
Specifies how individuals for mutations are chosen. See MutationSelectionType enum.
Definition: Mutation.hh:83
Represents an individual for evolutionary algorithms (EA). It stores the encoding consisting of opti...
Definition: Individual.hh:23
The Mutation structure that encapsulates the mutation operation and its configuration in evolutionary...
Definition: Mutation.hh:20
double MutateIndividualRate
Probability that an individual will be considered for mutation [if (randomResolutionTypeForIndividual...
Definition: Mutation.hh:73
double MutationPhaseRate
Probability of a mutation phase to happen (globally). If a mutation is included in the algorithm,...
Definition: Mutation.hh:69
virtual void MutateIndividual(Individual &individual)
The function that performs the mutation operation of one individual.
Definition: Mutation.cpp:94
MutationSelectionType RandomResolutionTypeForGene
Specifies how genes in an individual (already chosen for mutation) are chosen for mutation....
Definition: Mutation.hh:86
A class that serves as the main interface for evolutionary algorithms in Grail.
Definition: EAOptimizer.hh:49