public void AddCompleteModule() { UpdateGenomeAndFactory(); // Reset evolution process if it is running! (Or ensure it is stopped // before calling this method.) System.Diagnostics.Debug.WriteLine( "\nCreating a module for the genomes. This module will " + "create connections for all inputs and outputs. " + "(This may be used to simulate traditional interactive " + "evolution with no modular functionality.)\n"); PrepareUIvar(); //System.Diagnostics.Debug.WriteLine("ui var done"); // WARNING: 3 parameters is too many! //evolutionAlgorithm.GenomeList[0].PrintGenomeStatistics(); //evolutionAlgorithm.GenomeList[1].PrintGenomeStatistics(); //evolutionAlgorithm.CurrentChampGenome.PrintGenomeStatistics(); factory.AddNewModule(evolutionAlgorithm.GenomeList, evolutionAlgorithm.CurrentChampGenome, uiVar); System.Diagnostics.Debug.WriteLine("new module done"); UpdateGenomeStatistics(); System.Diagnostics.Debug.WriteLine("statistics done"); RandomChampion(); System.Diagnostics.Debug.WriteLine("champion done"); PopulationReadWrite.SavePopulation(evolutionAlgorithm.UserName); // TODO: IMPORTANT NOTICE FROM UNITY IMPORT. See comment at the end of the script.* // Easy patch: update the ID generator here. System.Diagnostics.Debug.WriteLine("saved done"); factory.InitializeGeneratorAfterLoad(evolutionAlgorithm.GenomeList); System.Diagnostics.Debug.WriteLine("InitializeGeneratorAfterLoad done"); }
/// <summary> /// This is specially useful since it is possible that startevolution will be called /// after stop evolution (because stopping is not instantaneous!) /// </summary> static void SaveDataIfRunning(string userName) { if (ActiveUsersList <NeatGenome> .IsUserRunning(userName)) { PopulationReadWrite.SavePopulation(userName); } }