Пример #1
0
        public Generation CreateNextGeneration(Generation currentGeneration)
        {
            _iteration++;
            _temperature -= (_temperature / _iterations);

            var temperature = rng.NextDouble() * _temperature;

            var permutation = currentGeneration.Permutation.DeepCopy();

            _permutationService.MutatePixelArray(permutation, temperature);

            var generation = CreateGeneration(permutation);

            if (generation.Loss > currentGeneration.Loss)
            {
                generation = currentGeneration.DeepCopy();
            }
            generation.Iteration = _iteration;

            return(generation);
        }