go(de): use method to get bestIndividual
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
cffbcd9866
commit
47b21dca0b
@ -282,15 +282,9 @@ func (j *JDE) Run() {
|
|||||||
func (j *JDE) evaluate(pop *Population) float64 {
|
func (j *JDE) evaluate(pop *Population) float64 {
|
||||||
f := bench.Functions[pop.Problem]
|
f := bench.Functions[pop.Problem]
|
||||||
|
|
||||||
bestIndividual := pop.Population[0].CurX
|
bestIndividual := pop.Population[pop.GetBestIdx()].CurX
|
||||||
bestSolution := f(bestIndividual)
|
bestSolution := f(bestIndividual)
|
||||||
|
|
||||||
for _, v := range pop.Population {
|
|
||||||
if solution := f(v.CurX); solution < bestSolution {
|
|
||||||
bestSolution = solution
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return bestSolution
|
return bestSolution
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user