Represents an individual for evolutionary algorithms (EA).
It stores the encoding consisting of optimizable parameters (represented by BaseEvoParam and specialized EvoParam<Type>).
The members (fields or properties) should be registered for optimization using SetMemberParameterOptimizable methods in your implementation of the constructor.
In the optimization process, the EA will require assigning the fitness evaluation to the individual. Calculate it in your game environment based on the current values of Individual's parameters.
More...
|
void | SetMemberParameterOptimizable (BaseEvoParam parameter) |
| Call this method in a constructor and pass references to fields or properties stored in this object.
Marks a certain stored parameter as optimizable allowing it to be manipulated by the evolutionary algorithm (EA).
This operation essentially binds your class member with the object used by EA. During optimization, EA might change its value. You can then read the value of your field or property using memberName.Value.
More...
|
|
void | SetMemberParameterOptimizable (IEnumerable< BaseEvoParam > parameter) |
| Call this method in a constructor and pass references to fields or properties stored in this object.
Marks a certain stored parameter as optimizable allowing it to be manipulated by the evolutionary algorithm (EA).
This operation essentially binds your class member with the object used by EA. During optimization, EA might change its value. You can then read the value of your field or property using memberName.Value.
More...
|
|
|
double | Fitness [get, set] |
| Gets or sets the fitness value (evaluation of how good the particular Individual is).
You will typically adjust the state of the game based on the current Individual's encoding, perform a simulation and then assign the value to Fitness. More...
|
|
BaseEvoParam | this[int index] [get] |
|
double | Fitness [get, set] |
|
Represents an individual for evolutionary algorithms (EA).
It stores the encoding consisting of optimizable parameters (represented by BaseEvoParam and specialized EvoParam<Type>).
The members (fields or properties) should be registered for optimization using SetMemberParameterOptimizable methods in your implementation of the constructor.
In the optimization process, the EA will require assigning the fitness evaluation to the individual. Calculate it in your game environment based on the current values of Individual's parameters.
◆ CalculateSimilarity()
float Grail.Evolution.Individual.CalculateSimilarity |
( |
Individual |
other | ) |
|
|
inline |
This function calculates the similarity between two Individuals in the form of a number of corresponding EvoParam pairs that share the same value divided by the total number of such pairs.
Thus, the value is normalized to the [0,1] interval.
- Parameters
-
other | Instance of another Individual object to which similarity is computed |
- Returns
- The computed similarity.
◆ Clone()
Performs a deep copy of the individual.
- Returns
- A copy of the individual that holds the same parameter values.
◆ CloneMany()
List<Individual> Grail.Evolution.Individual.CloneMany |
( |
int |
cloneCount | ) |
|
|
inline |
Performs a given number of copies of the individual.
- Parameters
-
- Returns
- A list of copies of the individual. For example, you can use this method to create the initial population.
◆ GetRandomRealizations()
List<Individual> Grail.Evolution.Individual.GetRandomRealizations |
( |
Random |
random, |
|
|
int |
count |
|
) |
| |
|
inline |
Returns count number of copies of the individuals with randomized parameter values.
- Parameters
-
random | A random number generator. |
count | The number of individuals to return. |
◆ Instantiate()
abstract Individual Grail.Evolution.Individual.Instantiate |
( |
| ) |
|
|
pure virtual |
◆ Randomize()
void Grail.Evolution.Individual.Randomize |
( |
Random |
random | ) |
|
|
inline |
Changes the values of each parameter in the encoding of the individual to random available ones.
- Parameters
-
random | A random number generator. |
◆ SetMemberParameterOptimizable() [1/2]
void Grail.Evolution.Individual.SetMemberParameterOptimizable |
( |
BaseEvoParam |
parameter | ) |
|
|
inlineprotected |
Call this method in a constructor and pass references to fields or properties stored in this object.
Marks a certain stored parameter as optimizable allowing it to be manipulated by the evolutionary algorithm (EA).
This operation essentially binds your class member with the object used by EA. During optimization, EA might change its value. You can then read the value of your field or property using memberName.Value.
- Parameters
-
parameter | A member stored in your Individual class of type BaseEvoParam. Typically, you will be using the EvoParam<Type>specialization. |
◆ SetMemberParameterOptimizable() [2/2]
void Grail.Evolution.Individual.SetMemberParameterOptimizable |
( |
IEnumerable< BaseEvoParam > |
parameter | ) |
|
|
inlineprotected |
Call this method in a constructor and pass references to fields or properties stored in this object.
Marks a certain stored parameter as optimizable allowing it to be manipulated by the evolutionary algorithm (EA).
This operation essentially binds your class member with the object used by EA. During optimization, EA might change its value. You can then read the value of your field or property using memberName.Value.
- Parameters
-
parameter | A member of a collection type stored in your Individual class. Typically, you will be using the EvoParam<Type>specialization |
◆ EvoParamsCount
int Grail.Evolution.Individual.EvoParamsCount => parameters.Count |
Returns the number of parameters set as optimizable for evolutionary algorithms.
◆ FITNESS_NOT_INITIALIZED
const double Grail.Evolution.Individual.FITNESS_NOT_INITIALIZED = -1.0 |
Fitness score assigned to Individual before its evaluation.
◆ Fitness
double Grail.Evolution.Individual.Fitness |
|
getset |
Gets or sets the fitness value (evaluation of how good the particular Individual is).
You will typically adjust the state of the game based on the current Individual's encoding, perform a simulation and then assign the value to Fitness.
The documentation for this class was generated from the following file:
- GrailEvolution/source/Individual.cs