From 47b21dca0b411381bd7d49ff0ece18d800c7e4ba Mon Sep 17 00:00:00 2001 From: leo Date: Sat, 21 Jan 2023 13:24:36 +0100 Subject: [PATCH] go(de): use method to get bestIndividual --- algo/de/jDE.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/algo/de/jDE.go b/algo/de/jDE.go index 718aa0a..431d964 100644 --- a/algo/de/jDE.go +++ b/algo/de/jDE.go @@ -282,15 +282,9 @@ func (j *JDE) Run() { func (j *JDE) evaluate(pop *Population) float64 { f := bench.Functions[pop.Problem] - bestIndividual := pop.Population[0].CurX + bestIndividual := pop.Population[pop.GetBestIdx()].CurX bestSolution := f(bestIndividual) - for _, v := range pop.Population { - if solution := f(v.CurX); solution < bestSolution { - bestSolution = solution - } - } - return bestSolution }