go(de): add {f,cr}Vect
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
ab004c8308
commit
fe8e071460
@ -23,6 +23,10 @@ type JDE struct {
|
|||||||
F float64
|
F float64
|
||||||
// CR is the crossover probability constant.
|
// CR is the crossover probability constant.
|
||||||
CR float64
|
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
|
// MutationStrategy selects the mutation strategy, i.e. the variant of the
|
||||||
// jDE algorithm (0..17), see mutationStrategies.go for more details.
|
// jDE algorithm (0..17), see mutationStrategies.go for more details.
|
||||||
MutationStrategy int
|
MutationStrategy int
|
||||||
@ -102,6 +106,17 @@ func (j *JDE) Init(generations, mutStrategy, adptScheme, np int, f, cr float64,
|
|||||||
j.BenchName = bench
|
j.BenchName = bench
|
||||||
j.ch = ch
|
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 := newPopulation(bench, j.NP)
|
||||||
|
|
||||||
pop.Init()
|
pop.Init()
|
||||||
|
Loading…
Reference in New Issue
Block a user