ga/population: idiomaticise init
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
c4efcbb103
commit
5e4eee8853
@ -230,16 +230,12 @@ func (p *Population) Size() int {
|
||||
|
||||
// newPopulation returns a pointer to a new, uninitialised population.
|
||||
func newPopulation(benchProblem string, np, dimen int) *Population {
|
||||
p := &Population{}
|
||||
|
||||
p.Problem = benchProblem
|
||||
|
||||
p.ProblemFunc = cec2020.Functions[benchProblem]
|
||||
|
||||
p.Dimen = dimen
|
||||
|
||||
// pre-alloc.
|
||||
p.Population = make([]PopulationIndividual, np)
|
||||
p := &Population{
|
||||
Problem: benchProblem,
|
||||
ProblemFunc: cec2020.Functions[benchProblem],
|
||||
Dimen: dimen,
|
||||
Population: make([]PopulationIndividual, np),
|
||||
}
|
||||
|
||||
return p
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user