diff --git a/algo/algo.go b/algo/algo.go index 7cbf605..1afe11f 100644 --- a/algo/algo.go +++ b/algo/algo.go @@ -45,6 +45,21 @@ func DoStochasticHillClimbing(wg *sync.WaitGroup) { defer wg.Done() printSHC("starting...") + + // funcCount is the number of bench functions available. + funcCount := len(bench.Functions) + // stats for the current algo (StochasticHillClimber). + algoStats := make([][]stats.Stats, funcCount) + + for i := range algoStats { + algoStats[i] = HillClimb(10000, 30, []int{5, 10, 20}, bench.FuncNames[i]) + } + + for _, algoStat := range algoStats { + plotAllDims(algoStat, "plot", ".svg") + } + + stats.PrintStatisticTable(algoStats) } func newValues() *Values { diff --git a/algo/algo_test.go b/algo/algo_test.go index 2ace823..6232aaa 100644 --- a/algo/algo_test.go +++ b/algo/algo_test.go @@ -29,6 +29,10 @@ func TestDoSHCExec(t *testing.T) { go DoStochasticHillClimbing(&wg) wg.Wait() + + if err := os.RemoveAll(picPath); err != nil { + t.Error(err) + } } func TestNewValues(t *testing.T) {