public CreateEvolutionAlgorithm ( ) : NeatEvolutionAlgorithm |
||
Résultat | NeatEvolutionAlgorithm |
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(); }