go(report): process pic lists in batches
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
surtur 2022-07-16 21:40:53 +02:00
parent c47951f3ea
commit 610060c88f
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D
2 changed files with 48 additions and 37 deletions

@ -46,12 +46,16 @@ func DoRandomSearch(wg *sync.WaitGroup) {
go plotAllDims(algoStats[i], "plot", ".svg", pCh)
}
pLs := []report.PicList{}
for range algoStats {
pL := <-pCh
report.SavePicsToFile(pL, "Random Search")
pLs = append(pLs, pL)
}
report.SavePicsToFile(pLs, "Random Search")
stats.SaveTable("Random Search", algoStats)
}
@ -86,12 +90,16 @@ func DoStochasticHillClimbing(wg *sync.WaitGroup) {
go plotAllDims(algoStat, "plot", ".svg", pCh)
}
pLs := []report.PicList{}
for range algoStats {
pL := <-pCh
report.SavePicsToFile(pL, "Stochastic Hill Climbing")
pLs = append(pLs, pL)
}
report.SavePicsToFile(pLs, "Stochastic Hill Climbing")
stats.SaveTable("Stochastic Hill CLimbing", algoStats)
}

@ -35,8 +35,10 @@ func NewPicList() *PicList {
return &PicList{}
}
// SavePicsToFile saves to file a pic list of a specified algo.
func SavePicsToFile(p PicList, algoName string) {
// SavePicsToFile saves each pic list for all bench funcs of a specified algo
// to a file.
func SavePicsToFile(pls []PicList, algoName string) {
for _, p := range pls {
safeName := util.SanitiseFName(p.Algo + "-" + p.Bench)
texPicsFile := GetTexDir() + "pics-" + safeName + ".tex"
tmplPicsFile := "report/pics.tmpl"
@ -79,3 +81,4 @@ func SavePicsToFile(p PicList, algoName string) {
log.Println(err)
}
}
}