Пример #1
0
        public Program()
        {
            var synapseTracker = new SynapseInnovNbTracker();

            var initialGenerationGenerator = new NeuralInitialGenerationCreatorBase(
                InitModel(),
                new RecursiveNetworkOpBaker());

            //var selection = new EliteSelection();
            var selection = new RouletteWheelSelectionWithRepetion();
            var crossover = new OnePointCrossover(true);
            var breeding  = new BreedingClassic(
                crossoverPart,
                1,
                selection,
                crossover,
                InitMutations()
                );

            var reinsertion = new ReinsertionFromSelection(
                reinsertionPart, 0, new EliteSelection());
            var producers   = new IGenomeProducer[] { breeding, reinsertion };
            var genomeForge = new GenomeForge(producers);

            var generationManager = new GenerationManagerKeepLast();

            geneticManager = new GeneticManagerClassic(
                generationManager,
                initialGenerationGenerator,
                genomeForge,
                genomesCount
                );

            geneticManager.Init();
        }
    protected void InitGeneticManager()
    {
        var initialGenerationGenerator = new NeuralInitialGenerationCreatorBase(
            InitNeuralModel(),
            new RecursiveNetworkOpBaker());

        var selection = new RouletteWheelSelectionWithRepetion();

        var crossover = new OnePointCrossover(true);
        var breeding  = new BreedingClassic(
            crossoverPart,
            minProduction: 1,
            selection: selection,
            crossover: crossover,
            mutationManager: InitMutations()
            );

        var reinsertion = new ReinsertionFromSelection(
            reinsertionPart,
            minProduction: 0,
            selection: new EliteSelection());
        var producers   = new IGenomeProducer[] { breeding, reinsertion };
        var genomeForge = new GenomeForge(producers);

        var generationManager = new GenerationManagerKeepLast();

        geneticManager = new GeneticManagerClassic(
            generationManager,
            initialGenerationGenerator,
            genomeForge,
            genomesCount
            );

        geneticManager.Init();
    }
Пример #3
0
    private void InitGenetics()
    {
        var initialGenerationGenerator = new NeuralInitialGenerationCreatorBase(
            //Init4InputsNeuralModel(),
            Init2InputsNeuralModel(),
            new FeedForwardOpBaker());

        //var selection = new EliteSelection();
        //var selection = new RouletteWheelSelection();
        var selection = new RouletteWheelSelectionWithRepetion();

        var crossover = new OnePointCrossover(true);
        var breeding  = new BreedingClassic(
            crossoverPart,
            1,
            selection,
            crossover,
            InitMutations()
            );

        var reinsertion = new ReinsertionFromSelection(reinsertionPart, 0, new EliteSelection());
        var producers   = new IGenomeProducer[] { breeding, reinsertion };
        var genomeForge = new GenomeForge(producers);

        var generationManager = new GenerationManagerKeepLast();

        geneticManager = new GeneticManagerClassic(
            generationManager,
            initialGenerationGenerator,
            genomeForge,
            genomesCount
            );

        geneticManager.Init();
    }
Пример #4
0
        public Program()
        {
            GARandomManager.Random = new RandomClassic((int)DateTime.Now.Ticks);

            var generationManager = new GenerationManagerKeepLast();

            var initialGenerationGenerator = new GASumInitialGenerationGenerator
            {
                GeneCount = genesCount,
                MinValue  = minGeneValue,
                MaxValue  = maxGeneValue
            };

            var selection = new EliteSelection();
            var crossover = new OnePointCrossover(useBothChildren: true);

            var breeding = new BreedingClassic(
                crossoverPart,
                minProduction: 1,
                selection: selection,
                crossover: crossover,
                mutationManager: InitMutations());

            var reinsertion = new ReinsertionFromSelection(
                reinsertionPart,
                minProduction: 1,
                selection: new EliteSelection());

            var producers = new List <IGenomeProducer>
            {
                reinsertion,
                breeding
            };

            var genomeForge = new GenomeForge(producers);

            geneticManager = new GeneticManagerClassic(
                generationManager,
                initialGenerationGenerator,
                genomeForge,
                genomesCount
                );
            geneticManager.Init();

            fitnessEvaluation = new FitnessEvaluation();
        }
Пример #5
0
        public Program()
        {
            datasets = GenerateDatasets(25, () => GARandomManager.Random.Next(1, 20)).ToArray();
            //datasets = GenerateDatasets(50, 10).ToArray();

            var synapseTracker = new SynapseInnovNbTracker();

            var initialGenerationGenerator = new NeuralInitialGenerationCreatorBase(
                InitModel(),
                new FeedForwardOpBaker());

            //var selection = new EliteSelection();
            var selection = new RouletteWheelSelectionWithRepetion();
            var crossover = new OnePointCrossover(true);
            var breeding  = new BreedingClassic(
                crossoverPart,
                1,
                selection,
                crossover,
                InitMutations()
                );

            var reinsertion = new ReinsertionFromSelection(
                reinsertionPart, 0, new EliteSelection());
            var producers   = new IGenomeProducer[] { breeding, reinsertion };
            var genomeForge = new GenomeForge(producers);

            var generationManager = new GenerationManagerKeepLast();

            geneticManager = new GeneticManagerClassic(
                generationManager,
                initialGenerationGenerator,
                genomeForge,
                genomesCount
                );

            geneticManager.Init();
        }
Пример #6
0
        public Salesman(Vector2[] locations)
        {
            Locations = locations;

            var initialGenerationGenerator = new TSInitGenerationGenerator(Locations);

            var selection = new RouletteWheelSelectionWithRepetion();
            var crossover = new TSCrossover();
            var breeding  = new BreedingClassic(
                crossoverPart,
                0,
                selection,
                crossover,
                InitMutations()
                );

            var reinsertion = new ReinsertionFromSelection(
                reinsertionPart,
                minProduction: 0,
                selection: new EliteSelection());
            var producers = new IGenomeProducer[]
            {
                reinsertion,
                breeding
            };

            var genomeForge       = new GenomeForge(producers);
            var generationManager = new GenerationManagerKeepLast();

            geneticManager = new GeneticManagerClassic(
                generationManager,
                initialGenerationGenerator,
                genomeForge,
                genomesCount
                );
            geneticManager.Init();
        }