public IMeal Solve(IEnumerable <DietaryReferenceIntake> maxWeight, IEnumerable <Food> items, int iterationCount) { MaxWeight = maxWeight; Items = items; IterationCount = iterationCount; var population = PopulationInitializer.InitializePopulation(MaxWeight, items); for (int i = 0; i < IterationCount; i++) { if (IsDebug) { Console.WriteLine($"{population.GetFittest().TotalCostSum:F2}"); } population.RemoveNotFit(); PopulationCrossoverer.CrossoverPopulation(population); PopulationMutator.MutatePopulation(population); population.MergeNewGeneration(); } return(population.GetFittest()); }