public void RunHAPMOEA <S>() where S : ContinuousVector, new() { HAPMOEA <S> algorithm = new HAPMOEA <S>(GetProblem()); algorithm.Config.PopulationSize = 100; algorithm.Initialize(); ClearStatusInfo(); BackgroundWorker worker = new BackgroundWorker(); worker.WorkerReportsProgress = true; worker.DoWork += (s1, e1) => { while (!algorithm.IsTerminated) { algorithm.Evolve(); worker.ReportProgress(0); } }; worker.ProgressChanged += (s1, e1) => { txtStatus1.Text = string.Format("Current Generation: {0}", algorithm.CurrentGeneration); txtStatus2.Text = string.Format("Size of Archive: {0}", algorithm.NondominatedArchiveSize); }; worker.RunWorkerCompleted += (s1, e1) => { NondominatedPopulation <S> archive = algorithm.NondominatedArchive; DisplayParetoFront(archive); }; worker.RunWorkerAsync(); }
static void RunHAPMOEA() { HAPMOEA <ContinuousVector> algorithm = new HAPMOEA <ContinuousVector>(new NDNDProblem()); algorithm.Config.PopulationSize = 100; algorithm.Initialize(); while (!algorithm.IsTerminated) { algorithm.Evolve(); Console.WriteLine("Current Generation: {0}", algorithm.CurrentGeneration); Console.WriteLine("Size of Archive: {0}", algorithm.NondominatedArchiveSize); } NondominatedPopulation <ContinuousVector> paretoFront = algorithm.NondominatedArchive; }