public PeaResult Start(PeaSettings settings, IEvaluationInitData initData) { var inbox = Inbox.Create(System); PeaResult result = null; try { inbox.Send(SystemActor, new CreateSystem(settings)); var response = inbox.Receive(TimeSpan.FromSeconds(30)); if (response is CreatedSuccessfully) { inbox.Send(SystemActor, new InitEvaluator(initData)); result = (PeaResult)inbox.Receive(TimeSpan.FromMinutes(30)); } } catch (Exception e) { result = new PeaResult(new List <string>() { e.ToString() }, new List <IEntity>()); } //var response = await SystemActor.Ask(new CreateSystem(settings)); //if (response is CreatedSuccessfully) //{ //result = await SystemActor.Ask(new InitEvaluator(initData)); //} return(result); }
public override void Init(IEvaluationInitData initData) { InitData = (VSInitData)initData; InitData.Build(); ConflictDetector = new VSConflictDetector(); ConflictDetector.Init(initData); }
private void InitEntityCreators(IEvaluationInitData initData) { foreach (var creator in EntityCreators) { creator.Init(initData); } }
public void Init(IEvaluationInitData initData) { initData.Build(); InitConflictDetectors(initData); InitEntityCreators(initData); Algorithm.InitPopulation(); }
public void InitConflictDetectors(IEvaluationInitData initData) { foreach (var key in ConflictDetectors.Keys) { foreach (var detector in ConflictDetectors[key]) { detector.Init(initData); } } }
public PeaResult Run(IEvaluationInitData initData) //async Task<PeaResult> { var settings = Settings.Build(); var islandsCount = settings.ParameterSet.FindLast(p => p.Name == ParameterNames.IslandsCount).Value; //TODO: clarify this PeaResult result = null; if (islandsCount < 2) { var localRunner = new IslandLocalRunner(); result = localRunner.Run(settings, initData); } else { result = _provider.Start(settings, initData); //await } return(result); }
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 override void Init(IEvaluationInitData initData) { TSPPoints = ((TSPInitData)initData).TSPPoints; }
private void Init(IEvaluationInitData initData) { EvaluationData = initData; Evaluation.Init(initData); }
public void Init(IEvaluationInitData initData) { Count = ((TSPInitData)initData).TSPPoints.Count; }
public abstract void Init(IEvaluationInitData initData);
public virtual void Init(IEvaluationInitData initData) { }
public void Init(IEvaluationInitData initData) { InitData = (VSInitData)initData; InitData.Build(); }
public void Init(IEvaluationInitData initData) { }
public InitEvaluator(IEvaluationInitData initdata) { InitData = initdata; }
public override void Init(IEvaluationInitData initData) { throw new System.NotImplementedException(); }