go(de): add {f,cr}Vect
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
leo 2023-01-19 21:42:56 +01:00
parent ab004c8308
commit fe8e071460
Signed by: wanderer
SSH Key Fingerprint: SHA256:Dp8+iwKHSlrMEHzE3bJnPng70I7LEsa3IJXRH/U+idQ

View File

@ -23,6 +23,10 @@ type JDE struct {
F float64
// CR is the crossover probability constant.
CR float64
// fVect holds the F values in a slice.
fVect []float64
// crVect holds the CR values in a slice.
crVect []float64
// MutationStrategy selects the mutation strategy, i.e. the variant of the
// jDE algorithm (0..17), see mutationStrategies.go for more details.
MutationStrategy int
@ -102,6 +106,17 @@ func (j *JDE) Init(generations, mutStrategy, adptScheme, np int, f, cr float64,
j.BenchName = bench
j.ch = ch
fV := make([]float64, np)
crV := make([]float64, np)
for i := 0; i < np; i++ {
fV[i] = f
crV[i] = cr
}
j.fVect = fV
j.crVect = crV
pop := newPopulation(bench, j.NP)
pop.Init()