go(de): add InitAndRun
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
leo 2023-01-19 19:57:41 +01:00
parent 2216b93426
commit 93dc845fbb
Signed by: wanderer
SSH Key Fingerprint: SHA256:Dp8+iwKHSlrMEHzE3bJnPng70I7LEsa3IJXRH/U+idQ

View File

@ -106,6 +106,18 @@ func (j *JDE) Init(generations, mutStrategy, adptScheme, np int, f, cr float64,
pop.Init()
}
// InitAndRun initialises the jDE algorithm, performs sanity checks on the
// inputs and calls the Run method.
func (j *JDE) InitAndRun(generations, mutStrategy, adptScheme, np int, f, cr float64, dimensions []int, bench string, ch chan []stats.Stats) {
if j == nil {
jDELogger.Fatalln("jDE is nil, NewjDE() needs to be called first. exiting...")
}
j.Init(generations, mutStrategy, adptScheme, np, f, cr, dimensions, bench, ch)
j.Run()
}
// Run self-adapting differential evolution algorithm.
func (j *JDE) Run() {
if j == nil {