public StopDecision MakeDecision(IEngine engine, IPopulation population) { var decision1 = Criteria1.MakeDecision(engine, population); var decision2 = Criteria2.MakeDecision(engine, population); var decision = new StopDecision(decision1.MustStop || decision2.MustStop); decision.Reasons.AddRange(decision1.Reasons); decision.Reasons.AddRange(decision2.Reasons); return(decision); }
public void RunOneStep() { StopDecision stop = null; var algorithmCycleCount = Engine.Parameters.GetInt(Algorithm.ParameterNames.SubCycleRunCount) + 1; for (int i = 0; i < algorithmCycleCount; i++) { stop = Engine.RunOnce(); if (stop.MustStop) { var result = new PeaResult(stop.Reasons, Engine.Algorithm.Population.Bests); Starter.Tell(result); Self.Tell(PoisonPill.Instance); break; } } Engine.Reduct(); if (!stop.MustStop) { Self.Tell(Continue.Instance); } }