chore(go): reach bench funcs via Functions slice
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
surtur 2022-06-17 21:08:26 +02:00
parent cb2b98ed57
commit 3e24a71283
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D

@ -96,16 +96,31 @@ func RandomSearch(fes uint) {
for _, dimens := range bench.Dimensions { for _, dimens := range bench.Dimensions {
for j := 0; j < minIters; j++ { for j := 0; j < minIters; j++ {
// run Schwefel. // run Schwefel.
v, r := singleRandomSearch(dimens, "Schwefel", bench.SchwefelParams.Min(), bench.SchwefelParams.Max()) v, r := singleRandomSearch(
dimens,
bench.Functions[0],
bench.SchwefelParams.Min(),
bench.SchwefelParams.Max(),
)
valsSchwefel = append(valsSchwefel, v) valsSchwefel = append(valsSchwefel, v)
resultsSchwefel = append(resultsSchwefel, r) resultsSchwefel = append(resultsSchwefel, r)
// run De Jong 1st. // run De Jong 1st.
vDJ1, rDJ1 := singleRandomSearch(dimens, "DeJong 1st", bench.DeJong1Params.Min(), bench.DeJong1Params.Max()) vDJ1, rDJ1 := singleRandomSearch(
dimens,
bench.Functions[1],
bench.DeJong1Params.Min(),
bench.DeJong1Params.Max(),
)
valsDeJong1st = append(valsDeJong1st, vDJ1) valsDeJong1st = append(valsDeJong1st, vDJ1)
resultsDeJong1st = append(resultsDeJong1st, rDJ1) resultsDeJong1st = append(resultsDeJong1st, rDJ1)
// run De Jong 2nd. // run De Jong 2nd.
vDJ2, rDJ2 := singleRandomSearch(dimens, "De Jong 2nd", bench.DeJong2Params.Min(), bench.DeJong2Params.Max()) vDJ2, rDJ2 := singleRandomSearch(
dimens,
bench.Functions[2],
bench.DeJong2Params.Min(),
bench.DeJong2Params.Max(),
)
valsDeJong2nd = append(valsDeJong2nd, vDJ2) valsDeJong2nd = append(valsDeJong2nd, vDJ2)
resultsDeJong2nd = append(resultsDeJong2nd, rDJ2) resultsDeJong2nd = append(resultsDeJong2nd, rDJ2)
} }