public IGeneticAlgorithm Create(NeuralNetworkConfigurationSettings networkConfig, GenerationConfigurationSettings generationConfig, EvolutionConfigurationSettings evolutionConfig)
 {
     var breeder = _breederFactory.Create();
     var mutator = _mutatorFactory.Create();
     var workingSet = _workingSetFactory.Create();
     return GeneticAlgorithm.GetInstance(networkConfig, generationConfig, evolutionConfig, _networkFactory, breeder, mutator, workingSet, _evaluatableFactory, null);
 }
        public IGeneticAlgorithm Create(NeuralNetworkConfigurationSettings networkConfig, GenerationConfigurationSettings generationConfig, EvolutionConfigurationSettings evolutionConfig)
        {
            var breeder    = _breederFactory.Create();
            var mutator    = _mutatorFactory.Create();
            var workingSet = _workingSetFactory.Create();

            return(GeneticAlgorithm.GetInstance(networkConfig, generationConfig, evolutionConfig, _networkFactory, breeder, mutator, workingSet, _evaluatableFactory, null));
        }
        static void Main(string[] args)
        {
            NeuralNetworkConfigurationSettings networkConfig = new NeuralNetworkConfigurationSettings
            {
                NumInputNeurons = 1,
                NumOutputNeurons = 1,
                NumHiddenLayers = 2,
                NumHiddenNeurons = 3,
                SummationFunction = new SimpleSummation(),
                ActivationFunction = new TanhActivationFunction()
            };
            GenerationConfigurationSettings generationSettings = new GenerationConfigurationSettings
            {
                UseMultithreading = true,
                GenerationPopulation = 500
            };
            EvolutionConfigurationSettings evolutionSettings = new EvolutionConfigurationSettings
            {
                NormalMutationRate = 0.05,
                HighMutationRate = 0.5,
                GenerationsPerEpoch = 10,
                NumEpochs = 1000,
                NumTopEvalsToReport = 10
            };
            MutationConfigurationSettings mutationSettings = new MutationConfigurationSettings
            {
                MutateAxonActivationFunction = true,
                MutateNumberOfHiddenLayers = true,
                MutateNumberOfHiddenNeuronsInLayer = true,
                MutateSomaBiasFunction = true,
                MutateSomaSummationFunction = true,
                MutateSynapseWeights = true
            };
            var random = new RandomWeightInitializer(new Random());
            INeuralNetworkFactory factory = NeuralNetworkFactory.GetInstance(SomaFactory.GetInstance(networkConfig.SummationFunction), AxonFactory.GetInstance(networkConfig.ActivationFunction), SynapseFactory.GetInstance(new RandomWeightInitializer(new Random()), AxonFactory.GetInstance(networkConfig.ActivationFunction)), SynapseFactory.GetInstance(new ConstantWeightInitializer(1.0), AxonFactory.GetInstance(new IdentityActivationFunction())), random);
            IBreeder breeder = BreederFactory.GetInstance(factory, random).Create();
            IMutator mutator = MutatorFactory.GetInstance(factory, random).Create(mutationSettings);
            IEvalWorkingSet history = EvalWorkingSetFactory.GetInstance().Create(50);
            IEvaluatableFactory evaluatableFactory = new GameEvaluationFactory();

            IStorageProxy proxy = new NodeJSProxy(1, "http://localhost:3000", "123456789");
            IEpochAction action = new BestPerformerUpdater(proxy);

            var GAFactory = GeneticAlgorithmFactory.GetInstance(evaluatableFactory);
            IGeneticAlgorithm evolver = GAFactory.Create(networkConfig, generationSettings, evolutionSettings, factory, breeder, mutator, history, evaluatableFactory, action);
            evolver.RunSimulation();
        }
 public IGeneticAlgorithm Create(NeuralNetworkConfigurationSettings networkConfig)
 {
     var breeder = _breederFactory.Create();
     var mutator = _mutatorFactory.Create();
     var workingSet = _workingSetFactory.Create();
     var generationConfig = new GenerationConfigurationSettings
     {
         GenerationPopulation = 100,
         UseMultithreading = true
     };
     var evolutionConfig = new EvolutionConfigurationSettings
     {
         GenerationsPerEpoch = 100,
         HighMutationRate = 0.5,
         NormalMutationRate = 0.05,
         NumEpochs = 10
     };
     return GeneticAlgorithm.GetInstance(networkConfig, generationConfig, evolutionConfig, _networkFactory, breeder, mutator, workingSet, _evaluatableFactory, null);
 }
        public IGeneticAlgorithm Create(NeuralNetworkConfigurationSettings networkConfig)
        {
            var breeder          = _breederFactory.Create();
            var mutator          = _mutatorFactory.Create();
            var workingSet       = _workingSetFactory.Create();
            var generationConfig = new GenerationConfigurationSettings
            {
                GenerationPopulation = 100,
                UseMultithreading    = true
            };
            var evolutionConfig = new EvolutionConfigurationSettings
            {
                GenerationsPerEpoch = 100,
                HighMutationRate    = 0.5,
                NormalMutationRate  = 0.05,
                NumEpochs           = 10
            };

            return(GeneticAlgorithm.GetInstance(networkConfig, generationConfig, evolutionConfig, _networkFactory, breeder, mutator, workingSet, _evaluatableFactory, null));
        }
        private GeneticAlgorithm(NeuralNetworkConfigurationSettings networkConfig, GenerationConfigurationSettings generationConfig, EvolutionConfigurationSettings evolutionConfig, INeuralNetworkFactory networkFactory, IBreeder breeder, IMutator mutator, IEvalWorkingSet workingSet, IEvaluatableFactory evaluatableFactory, IEpochAction epochAction)
        {
            _networkConfig    = networkConfig;
            _generationConfig = generationConfig;
            _evolutionConfig  = evolutionConfig;
            _epochAction      = epochAction;
            var sessions = new List <ITrainingSession>();

            _networkFactory     = networkFactory;
            _breeder            = breeder;
            _mutator            = mutator;
            _history            = workingSet;
            _evaluatableFactory = evaluatableFactory;
            for (int i = 0; i < _generationConfig.GenerationPopulation; i++)
            {
                var network = _networkFactory.Create(_networkConfig.NumInputNeurons, _networkConfig.NumOutputNeurons, _networkConfig.NumHiddenLayers, _networkConfig.NumHiddenNeurons);
                sessions.Add(new TrainingSession(network, _evaluatableFactory.Create(network), i));
            }
            _generation = new Generation(sessions, _generationConfig);
        }
 public IGeneticAlgorithm Create(NeuralNetworkConfigurationSettings networkConfig, GenerationConfigurationSettings generationConfig, EvolutionConfigurationSettings evolutionConfig, INeuralNetworkFactory networkFactory, IBreeder breeder, IMutator mutator, IEvalWorkingSet workingSet, IEvaluatableFactory evaluatableFactory, IEpochAction epochAction)
 {
     return(GeneticAlgorithm.GetInstance(networkConfig, generationConfig, evolutionConfig, _networkFactory, breeder, mutator, workingSet, _evaluatableFactory, epochAction));
 }
 public IGeneticAlgorithm Create(NeuralNetworkConfigurationSettings networkConfig, GenerationConfigurationSettings generationConfig, EvolutionConfigurationSettings evolutionConfig, INeuralNetworkFactory networkFactory, IBreeder breeder, IMutator mutator, IEvalWorkingSet workingSet, IEvaluatableFactory evaluatableFactory, IEpochAction epochAction)
 {
     return GeneticAlgorithm.GetInstance(networkConfig, generationConfig, evolutionConfig, _networkFactory, breeder, mutator, workingSet, _evaluatableFactory, epochAction);
 }