go(de): implement Clear method on Population
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
93206b2cd1
commit
37710c95b3
|
@ -78,7 +78,21 @@ func (p *Population) Reinit() {
|
||||||
|
|
||||||
// ReinitN reinitialises the individual at position n.
|
// ReinitN reinitialises the individual at position n.
|
||||||
func (p *Population) ReinitN(n uint) {}
|
func (p *Population) ReinitN(n uint) {}
|
||||||
func (p *Population) Clear() {}
|
|
||||||
|
// Clear sets all vectors to 0.
|
||||||
|
func (p *Population) Clear() {
|
||||||
|
if p.Population != nil {
|
||||||
|
for _, v := range p.Population {
|
||||||
|
v.CurX = make([]float64, p.Dimen)
|
||||||
|
v.CurC = make([]float64, p.Dimen)
|
||||||
|
v.CurF = make([]float64, p.Dimen)
|
||||||
|
v.CurV = make([]float64, p.Dimen)
|
||||||
|
v.BestX = make([]float64, p.Dimen)
|
||||||
|
v.BestC = make([]float64, p.Dimen)
|
||||||
|
v.BestF = make([]float64, p.Dimen)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// meanVelocity computes the mean current velocity of all individuals in the population.
|
// meanVelocity computes the mean current velocity of all individuals in the population.
|
||||||
func (p *Population) MeanVelocity() float64 { return 0.0 }
|
func (p *Population) MeanVelocity() float64 { return 0.0 }
|
||||||
|
|
Loading…
Reference in New Issue