Esempio n. 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();
        }
Esempio n. 2
0
        public NeuralModelBase()
        {
            synapseInnovNbTracker = new SynapseInnovNbTracker();

            Neurons  = new Dictionary <InnovationNumber, Neuron>();
            Synapses = new Dictionary <Synapse, WeightInitializer>();

            this.defaultWeightInitializer = () => GARandomManager.NextFloat(-1f, 1f);
        }
        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();
        }