/// <summary> /// Запуск работы анализа выбранных методов /// </summary> public void Start() { DisplayResult.ClearText(); ResultDictionary = new Dictionary <dynamic, List <Candidate> >(); var propertyInfo = typeof(AnalysisSetting).GetProperty(AnalysisSetting.SelectMethod.ToString()); var propertyValue = propertyInfo.GetValue(AnalysisSetting); //Получение первой популяции List <Candidate> firstCandidateList = GenerateFirstPopulation(); DisplayResult.DisplayPopulation("Начальная популяция:", firstCandidateList); foreach (var selectionMethod in AnalysisSetting.List) { var resultCandidateList = new List <Candidate>(); DisplayResult.DisplayText($"{GetMethodName(selectionMethod, selectionMethod.GetType())}"); propertyInfo.SetValue(AnalysisSetting, selectionMethod); for (int run = 1; run <= AnalysisSetting.RunAmount; run++) { ClearPopulation(); //DisplayResult.ClearText(); Population.AddRange(firstCandidateList); Process(); var bestCandidate = GetBestCandidate(); DisplayResult.DisplayText($"Прогон №{run}\tЛучшее решение: {bestCandidate.DecValue}\tНайдено за {NumberOfLastGeneneration} итераций"); resultCandidateList.Add(bestCandidate); NumberOfLastGenerationList.Add(NumberOfLastGeneneration); } DisplayResult.DisplayText($"Среднее \tЛучшее решение: {GetAvgBestCandidate(resultCandidateList).DecValue}\tНайдено за {Math.Round(NumberOfLastGenerationList.Average(), MidpointRounding.AwayFromZero)} итераций"); DisplayResult.AddNewLine(); ResultDictionary.Add(selectionMethod, resultCandidateList); } propertyInfo.SetValue(AnalysisSetting, propertyValue); }