go(de): use method to get bestIndividual
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
leo 2023-01-21 13:24:36 +01:00
parent cffbcd9866
commit 47b21dca0b
Signed by: wanderer
SSH Key Fingerprint: SHA256:Dp8+iwKHSlrMEHzE3bJnPng70I7LEsa3IJXRH/U+idQ

@ -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
}