public static void OnResetEvolution(object sender, EvolutionEventsArgs eventArguments) { TryStopEvolution(eventArguments.userName); PopulationReadWrite.DeleteLocalEvolutionFiles(eventArguments.userName); // TODO: Probably unnecessary wait. Thread.Sleep(500); StartOrRestartEvolution(eventArguments.userName); }
public static void OnBranch(object sender, EvolutionEventsArgs eventArguments) { // If evolution has not been created or is not running this will not have effect! TryStopEvolution(eventArguments.userName); // TODO: Probably unnecessary wait. Thread.Sleep(500); StartOrRestartEvolution(eventArguments.userName); }
static void WhenPauseEvent(object sender, EvolutionEventsArgs arguments) { string userName = arguments.userName; // In this version we decide to stop the program at a pause event. // evolutionRunning = false here seems reiterative? (see TryStopEvolution) ActiveUsersList <NeatGenome> .SetRunningStatus(userName, false); SaveDataIfRunning(userName); }
static void WhenUpdateEvent(object sender, EvolutionEventsArgs arguments) { string userName = arguments.userName; NeatEvolutionAlgorithm <NeatGenome> evolutionAlgorithm = null; try { evolutionAlgorithm = ActiveUsersList <NeatGenome> .EvolutionAlgorithmForUser(userName); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("Null algorithm at WhenUpdateEvent in EvolutionCoordination: " + ex.Message); } if (evolutionAlgorithm != null) { System.Diagnostics.Debug.WriteLine(string.Format("gen={0:N0} bestFitness={1:N6}", evolutionAlgorithm.CurrentGeneration, evolutionAlgorithm.Statistics._maxFitness)); SaveDataIfRunning(userName); } }
public static void OnStopEvolution(object sender, EvolutionEventsArgs eventArguments) { TryStopEvolution(eventArguments.userName); }
public static void OnStartEvolution(object sender, EvolutionEventsArgs eventArguments) { StartOrRestartEvolution(eventArguments.userName); }