示例#1
0
        public Genome AddNewGenome(Genome genomeToAdd = null)
        {
            Genome genome = null;

            if (genomeToAdd == null)
            {
                OrderGenomeByFitness();
                genome = Breed();
            }
            else
            {
                genome = Genome.GenomeRandomWeights(genomeToAdd, _r);
            }
            AddGenomeToList(genome);
            return(genome);
        }
示例#2
0
        private string _mutationLogs = "";                                                          // Mutation Logs

        public EvaluatorRT(RTNEATConfig config, Genome startingGenome, InnovationCounter nodeInnovation, InnovationCounter connectionInnovation)
        {
            _config               = config;
            _nodeInnovation       = nodeInnovation;
            _connectionInnovation = connectionInnovation;
            _currentPop           = 0;

            _genomes = new List <Genome>();
            for (int i = 0; i < _config.startPopulation; ++i)
            {
                AddGenomeToList(Genome.GenomeRandomWeights(startingGenome, _r));
            }

            BestFitness = -1f;
            BestGenome  = null;
        }
示例#3
0
        private string _mutationLogs = "";                                                          // Mutation Logs

        public Evaluator(NEATConfig config, Genome startingGenome, InnovationCounter nodeInnovation, InnovationCounter connectionInnovation)
        {
            _config               = config;
            GenerationNumber      = 0;
            _nodeInnovation       = nodeInnovation;
            _connectionInnovation = connectionInnovation;

            _genomes = new List <Genome>();
            for (int i = 0; i < _config.populationSize; ++i)
            {
                _genomes.Add(Genome.GenomeRandomWeights(startingGenome, _r));
            }

            _nextEvaluationGenomes = new List <Genome>();

            _species = new List <Species>();

            _genomesSpecies = new Dictionary <Genome, Species>();

            BestFitness = -1f;
            BestGenome  = null;
        }