/// <summary> /// Updates the GlobalBestSolution property. /// </summary> public void UpdateBestGlobalSolution() { //Find the best solution in this iteration. ISolution iterationBest = this.GlobalBestSolution; foreach (IParticle particle in this.Particles) { if (particle.CurrentSolution.BetterThan(iterationBest)) { iterationBest = particle.CurrentSolution; } } if (iterationBest.BetterThan(this.GlobalBestSolution)) { this.GlobalBestSolution = iterationBest.Copy(); } }