public PeaResult Run(PeaSettings settings, IEvaluationInitData initData, LaunchTravelersDelegate launchTravelers = null) { string[] keys = new string[settings.SubProblemList.Count]; for (int i = 0; i < settings.SubProblemList.Count; i++) { keys[i] = settings.SubProblemList[i].Encoding.Key; } Key = new MultiKey(keys); var islandEngine = IslandEngineFactory.Create(Key, settings, settings.Seed); AddCallbackEvents(islandEngine, settings.NewEntityMergedToBest); Evaluator = (EvaluationBase)TypeLoader.CreateInstance(settings.Evaluation, settings.ParameterSet); Evaluator.Init(initData); islandEngine.Algorithm.SetEvaluationCallback(Evaluate); islandEngine.Init(initData); if (launchTravelers != null) { islandEngine.LaunchTravelers += launchTravelers; } var c = 0; StopDecision stopDecision; while (true) { islandEngine.Algorithm.RunOnce(); stopDecision = islandEngine.StopCriteria.MakeDecision(islandEngine, islandEngine.Algorithm.Population); if (stopDecision.MustStop) { Debug.WriteLine(stopDecision.Reasons[0]); break; } c++; } return(new PeaResult(stopDecision.Reasons, islandEngine.Algorithm.Population.Bests)); }
public void SetBestMergedDelegate(LaunchTravelersDelegate mergedDelegate) { }