Пример #1
0
        public static NeatEvolutionAlgorithm <double> CreateNeatEvolutionAlgorithm(
            INeatExperimentFactory <double> experimentFactory,
            string jsonConfigFilename)
        {
            // Load experiment json config from file.
            JsonDocument configDoc = JsonUtils.LoadUtf8(jsonConfigFilename);

            // Create an instance of INeatExperiment, configured using the supplied json config.
            INeatExperiment <double> neatExperiment = experimentFactory.CreateExperiment(configDoc.RootElement);

            // Create a NeatEvolutionAlgorithm instance ready to run the experiment.
            var ea = NeatExperimentUtils.CreateNeatEvolutionAlgorithm(neatExperiment);

            return(ea);
        }
Пример #2
0
        public static INeatExperiment <double> CreateAndConfigureExperiment(ExperimentInfo expInfo)
        {
            // Create an experiment factory.
            INeatExperimentFactory factory = (INeatExperimentFactory)Activator.CreateInstance(
                expInfo.ExperimentFactory.AssemblyName,
                expInfo.ExperimentFactory.TypeName)
                                             .Unwrap();

            // Load experiment json config from file.
            JsonDocument configDoc = JsonUtils.LoadUtf8(expInfo.ConfigFile);

            // Create an instance of INeatExperiment, configured using the supplied json config.
            INeatExperiment <double> experiment = factory.CreateExperiment(configDoc.RootElement);

            return(experiment);
        }
Пример #3
0
        public static NeatEvolutionAlgorithm <double> CreateNeatEvolutionAlgorithm(
            INeatExperimentFactory <double> experimentFactory,
            string jsonConfigFilename)
        {
            // Read experiment json config from file.
            // Note. We read the entire contents into a string; we don't ever expect to see large json files here, so this fine.
            string jsonStr = File.ReadAllText(jsonConfigFilename);

            // Create an instance of INeatExperiment, configured using the supplied json config.
            INeatExperiment <double> neatExperiment = experimentFactory.CreateExperiment(jsonStr);

            // Create a NeatEvolutionAlgorithm instance ready to run the experiment.
            var ea = NeatExperimentUtils.CreateNeatEvolutionAlgorithm(neatExperiment);

            return(ea);
        }