go(report): process pic lists in batches
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
c47951f3ea
commit
610060c88f
12
algo/algo.go
12
algo/algo.go
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user