예제 #1
0
파일: concurrent.go 프로젝트: soniah/neat
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
}
예제 #2
0
파일: serial.go 프로젝트: soniah/neat
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
}