go(algo): use var for algo name
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
surtur 2022-07-18 00:23:53 +02:00
parent 602ee8206f
commit efbc963875
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D

@ -54,11 +54,13 @@ func DoRandomSearch(wg *sync.WaitGroup, m *sync.Mutex) {
pLs = append(pLs, pL) pLs = append(pLs, pL)
} }
algoName := "Random Search"
// protect access to shared data. // protect access to shared data.
m.Lock() m.Lock()
report.SavePicsToFile(pLs, "Random Search") report.SavePicsToFile(pLs, algoName)
stats.SaveTable("Random Search", algoStats) stats.SaveTable(algoName, algoStats)
m.Unlock() m.Unlock()
} }
@ -101,11 +103,13 @@ func DoStochasticHillClimbing(wg *sync.WaitGroup, m *sync.Mutex) {
pLs = append(pLs, pL) pLs = append(pLs, pL)
} }
algoName := "Stochastic Hill Climbing"
// protect access to shared data. // protect access to shared data.
m.Lock() m.Lock()
report.SavePicsToFile(pLs, "Stochastic Hill Climbing") report.SavePicsToFile(pLs, algoName)
stats.SaveTable("Stochastic Hill CLimbing", algoStats) stats.SaveTable(algoName, algoStats)
m.Unlock() m.Unlock()
} }