func (p concurrentPopEval) Evaluate(pop *neat.Population, orgEval neat.OrgEval) (err error) { orgs := pop.Organisms() var w sync.WaitGroup w.Add(len(orgs)) for _, o := range orgs { go func(o *neat.Organism) { err = orgEval.Evaluate(o) w.Done() }(o) } w.Wait() return }
func (p serialPopEval) Evaluate(pop *neat.Population, orgEval neat.OrgEval) (err error) { // Iterate the species within the population for _, s := range pop.Species { // Iterate the organisms within the species for _, o := range s.Orgs { // Evaluate the organism err = orgEval.Evaluate(o) if err != nil { // do what exactly? } } } return }