From 3e24a712831c80ff06a9486a13eee70cb43f1061 Mon Sep 17 00:00:00 2001 From: surtur Date: Fri, 17 Jun 2022 21:08:26 +0200 Subject: [PATCH] chore(go): reach bench funcs via Functions slice --- algo/randomSearch.go | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/algo/randomSearch.go b/algo/randomSearch.go index ccbde1f..275c86b 100644 --- a/algo/randomSearch.go +++ b/algo/randomSearch.go @@ -96,16 +96,31 @@ func RandomSearch(fes uint) { for _, dimens := range bench.Dimensions { for j := 0; j < minIters; j++ { // 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) resultsSchwefel = append(resultsSchwefel, r) // 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) resultsDeJong1st = append(resultsDeJong1st, rDJ1) // 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) resultsDeJong2nd = append(resultsDeJong2nd, rDJ2) }