static void Initialize(string userName) { MyExperiment currentExperiment = CreateNewExperiment(userName); InitializeEvolutionAlgorithm(currentExperiment, userName); SaveDataIfRunning(userName); AddFirstModuleIfNeeded(userName); }
static void InitializeEvolutionAlgorithm(MyExperiment currentExperiment, string userName) { // Passing a file path the new evolution algorithm will try to read an existing population. string posiblePopulationFile = PopulationReadWrite.PopulationPathForUser(userName); // This step will create the evolution algorithm and pass the userName (which currentExperiment already has) // to the algorithm constructor, which will add the pair (algorithm, user) to ActiveUsersList NeatEvolutionAlgorithm <NeatGenome> evolutionAlgorithm = currentExperiment.CreateEvolutionAlgorithm(posiblePopulationFile); evolutionAlgorithm.UpdateEvent += new EventHandler <EvolutionEventsArgs>(WhenUpdateEvent); evolutionAlgorithm.PausedEvent += new EventHandler <EvolutionEventsArgs>(WhenPauseEvent); }
static void ReInitialize(string userName) { MyExperiment currentExperiment = CreateNewExperiment(userName); var myEvolutionAlgorithm = ActiveUsersList <NeatGenome> .EvolutionAlgorithmForUser(userName); string populationPath = PopulationReadWrite.PopulationPathForUser(userName); currentExperiment.ReInitializeEvolution(myEvolutionAlgorithm, populationPath); SaveDataIfRunning(userName); AddFirstModuleIfNeeded(userName); System.Diagnostics.Debug.WriteLine("added module!"); }