Evolution Algorithm

Singleton class that is responsible for initialization of the evolution algorithm. EvolutionAlgorithm.prefab must be always present in the scene, because it acts as a container for the variables, that are used in other scripts.

classDiagram
    EvolutionAlgorithm <.. WeaponManager : Dependency
    EvolutionAlgorithm <.. AbstractWeapon : Dependency
    EvolutionAlgorithm <.. EvoWeapon : Dependency

Evolution Algorithm

Property Type Description
PopulationSize int Gets or sets the number of genomes to create.
Generation uint The current evolution algorithm generation.
InputCount int Gets or sets the number of network inputs.
OutputCount int Gets or sets the number of network outputs.
CloneOffspringCount int Gets or sets the number of networks created by asexual reproduction.
SexualOffspringCount int Gets or sets the number of networks created by sexual reproduction.

You can change these properties in InitializeEvolutionAlgorithmParams method:

private void InitializeEvolutionAlgorithmParams() {
    _activationScheme = NetworkActivationScheme.CreateAcyclicScheme();
    PopulationSize = 6; // Modify this parameter to change number of weapons
    CloneOffspringCount = 2;
    SexualOffspringCount = PopulationSize - CloneOffspringCount;
    // Do not change this
    Generation = 0;
    InputCount = 3;
    OutputCount = 5;
}
Method Description
CreateNewGeneration Creates a new generation of genomes using the user-selected genomes as parents.
CreateRandomPopulation Creates a random population of genomes.

Activation Functions

Function id Probability
Linear 0 0.1
Sine 1 0.1
ArcTan 2 0.1
BipolarGaussian 3 0.1
BipolarSigmoid 4 0.1
LogisticFunction 5 0.1
QuadraticSigmoid 6 0.1
TanH 7 0.1
ArcSinH 8 0.1
ReLU 9 0.1

Neat Genome Parameters

Represents parameters specific to NEAT genomes. E.g. parameters that describe probabilities for the different types of mutation and the proportion of possible connections to instantiate between input and output neurons within the initial population.

You can change these parameters as you see fit, but FeedfowardOnly must be true.

Property Type Description
FeedforwardOnly bool Gets or sets a boolean that indicates if NEAT should produce only feed-forward networks (no recurrent/cyclic connection paths).
ConnectionWeightRange double Gets or sets the connection weight range to use in NEAT genomes. E.g. a value of 5 defines a weight range of -5 to 5. The weight range is strictly enforced - e.g. when creating new connections and mutating existing ones.
InitialInterconnections
Proportion
double Gets or sets a proportion that specifies the number of interconnections to make between input and output neurons in an initial random population. This is a proportion of the total number of possible interconnections.
DisjointExcessGenes
RecombinedProbability
double Gets or sets the probability that all excess and disjoint genes are copied into an offspring genome during sexual reproduction. Currently, the excess/disjoint genes are copied in an all or nothing strategy.
ConnectionWeight
MutationProbability
double Gets or sets the probability that a genome mutation operates on genome connection weights.
AddNode
MutationProbability
double Gets or sets the probability that a genome mutation is an add node mutation.
AddConnection
MutationProbability
double Gets or sets the probability that a genome mutation is an add connection mutation.
NodeAuxState
MutationProbability
double Gets or sets the probability that a genome mutation is a node auxiliary state mutation.
DeleteConnection
MutationProbability
double Gets or sets the probability that a genome mutation is a delete connection mutation.

Back to top

Page last modified: Jun 24 2024 at 07:40 PM.