CreateEvolutionAlgorithm() public method

Create and return a NeatEvolutionAlgorithm object ready for running the NEAT algorithm/search. Various sub-parts of the algorithm are also constructed and connected up. This overload requires no parameters and uses the default population size.
public CreateEvolutionAlgorithm ( ) : NeatEvolutionAlgorithm
return NeatEvolutionAlgorithm
コード例 #1
0
ファイル: Program.cs プロジェクト: tansey/social-learning
        void RunExperiment(string XMLFile, string filename)
        {
            _filename = filename;
            _experiment = new SocialExperiment();

            // Write the header for the results file in CSV format.
            using (TextWriter writer = new StreamWriter(_filename))
                writer.WriteLine("Generation,Average,Best,Updates");

            using (TextWriter writer = new StreamWriter(_filename.Replace(".csv", "_diversity_after.csv")))
                writer.WriteLine("Generation,Orientation Variance,Velocity Variance");

            using (TextWriter writer = new StreamWriter(_filename.Replace(".csv", "_diversity_before.csv")))
                writer.WriteLine("Generation,Orientation Variance,Velocity Variance");

            // Load the XML configuration file
            XmlDocument xmlConfig = new XmlDocument();
            xmlConfig.Load(XMLFile);
            _experiment.Initialize("EgalitarianSocialLearning", xmlConfig.DocumentElement);
            _experiment.TrialId = _trialNum;

            // Create the evolution algorithm and attach the update event.
            _ea = _experiment.CreateEvolutionAlgorithm();
            _ea.UpdateScheme = new SharpNeat.Core.UpdateScheme(1);
            _ea.UpdateEvent += new EventHandler(_ea_UpdateEvent);

            _experiment.Evaluator.TrialId = _trialNum;
            _experiment.Evaluator.DiversityFile = _filename.Replace(".csv", "_diversity.csv");

            // Start algorithm (it will run on a background thread).
            _ea.StartContinue();
        }