go(de): don't run evolve concurrently for dimens
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
leo 2023-01-19 20:25:42 +01:00
parent 2e5bb5c538
commit 8f55d80731
Signed by: wanderer
SSH Key Fingerprint: SHA256:Dp8+iwKHSlrMEHzE3bJnPng70I7LEsa3IJXRH/U+idQ

@ -6,7 +6,6 @@ package de
import ( import (
"log" "log"
"os" "os"
"sync"
"git.dotya.ml/wanderer/math-optim/bench" "git.dotya.ml/wanderer/math-optim/bench"
"git.dotya.ml/wanderer/math-optim/stats" "git.dotya.ml/wanderer/math-optim/stats"
@ -131,28 +130,18 @@ func (j *JDE) Run() {
jDELogger.Fatalln("jDE needs to be initialised before calling Run(), exiting...") jDELogger.Fatalln("jDE needs to be initialised before calling Run(), exiting...")
} }
// have a wait group. // run evolve for for all dimensions.
var wg sync.WaitGroup
// we're be spawning goroutines per dimension and that is the number of
// goroutines we need to wait for.
wg.Add(len(j.Dimensions))
// run Evolve for for all dimensions.
for _, dim := range j.Dimensions { for _, dim := range j.Dimensions {
maxFES := bench.GetGAMaxFES(dim) maxFES := bench.GetGAMaxFES(dim)
j.evolve(maxFES, &wg) j.evolve(maxFES)
} }
// wait for all.
wg.Wait()
} }
// evolve evolves a population by running the jDE (self-adapting Differential // evolve evolves a population by running the jDE (self-adapting Differential
// Evolution) algorithm on the passed population until termination conditions // Evolution) algorithm on the passed population until termination conditions
// are met. // are met.
func (j *JDE) evolve(maxFES int, wg *sync.WaitGroup) {} func (j *JDE) evolve(maxFES int) {}
// NewjDE returns a pointer to a new, uninitialised jDE instance. // NewjDE returns a pointer to a new, uninitialised jDE instance.
func NewjDE() *JDE { func NewjDE() *JDE {