Example #1
0
        public Population(NetworkParameters networkParameters,
                          ReproductionParameters reproductionParameters,
                          bool relaxedNeatGenesComparison = true)
        {
            _networkParameters = networkParameters ?? throw new ArgumentNullException(nameof(networkParameters));

            Replicator = new Replicator(reproductionParameters ??
                                        throw new ArgumentNullException(nameof(reproductionParameters)));
            InnovationTracker = new InnovationTracker(NetworkParameters.BiasCount +
                                                      _networkParameters.SensorCount +
                                                      _networkParameters.EffectorCount);

            RelaxedNeatGenesComparison = relaxedNeatGenesComparison;
        }
Example #2
0
        internal Replicator(ReproductionParameters reproductionParameters)
        {
            _mutationsDistribution = new DiscreteDistribution(new double[]
            {
                reproductionParameters.WeightMutations.OverallRouletteWheelShare,
                reproductionParameters.SplitConnectionRouletteWheelShare,
                reproductionParameters.AddConnectionRouletteWheelShare,
                reproductionParameters.RemoveConnectionRouletteWheelShare,
            },
                                                              new[]
            {
                (int)MutationType.Weight,
                (int)MutationType.SplitConnection,
                (int)MutationType.AddConnection,
                (int)MutationType.RemoveConnection
            });

            _weightMutationDistribution = new WeightMutationDistribution(reproductionParameters.WeightMutations, Rng);
            _crossoverType = reproductionParameters.CrossoverType;
        }