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