From efbc963875f921b05dcef6157ec0799eb7f07175 Mon Sep 17 00:00:00 2001 From: surtur Date: Mon, 18 Jul 2022 00:23:53 +0200 Subject: [PATCH] go(algo): use var for algo name --- algo/algo.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/algo/algo.go b/algo/algo.go index 79415ea..9f0e7ae 100644 --- a/algo/algo.go +++ b/algo/algo.go @@ -54,11 +54,13 @@ func DoRandomSearch(wg *sync.WaitGroup, m *sync.Mutex) { pLs = append(pLs, pL) } + algoName := "Random Search" + // protect access to shared data. m.Lock() - report.SavePicsToFile(pLs, "Random Search") + report.SavePicsToFile(pLs, algoName) - stats.SaveTable("Random Search", algoStats) + stats.SaveTable(algoName, algoStats) m.Unlock() } @@ -101,11 +103,13 @@ func DoStochasticHillClimbing(wg *sync.WaitGroup, m *sync.Mutex) { pLs = append(pLs, pL) } + algoName := "Stochastic Hill Climbing" + // protect access to shared data. m.Lock() - report.SavePicsToFile(pLs, "Stochastic Hill Climbing") + report.SavePicsToFile(pLs, algoName) - stats.SaveTable("Stochastic Hill CLimbing", algoStats) + stats.SaveTable(algoName, algoStats) m.Unlock() }