From ed2aece330f61a30ce15c65c83c46b2723fa2901 Mon Sep 17 00:00:00 2001 From: surtur Date: Mon, 18 Jul 2022 02:33:17 +0200 Subject: [PATCH] go: add flag -generate --- main.go | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/main.go b/main.go index 2b15041..d718dde 100644 --- a/main.go +++ b/main.go @@ -18,24 +18,28 @@ func main() { log.Println("starting math-optim version", "'"+version+"'") doPrint := flag.Bool("printreport", true, "print report.tex to console") + generate := flag.Bool("generate", true, "run algos and generate plot pics/statistical tables (anew)") flag.Parse() - // atm we're only doing Random search and SHC - algoCount := 2 + if *generate { + // atm we're only doing Random search and SHC + algoCount := 2 - var wg sync.WaitGroup + var wg sync.WaitGroup - wg.Add(algoCount) + wg.Add(algoCount) - var m sync.Mutex + var m sync.Mutex - go algo.DoRandomSearch(&wg, &m) - go algo.DoStochasticHillClimbing(&wg, &m) + go algo.DoRandomSearch(&wg, &m) + go algo.DoStochasticHillClimbing(&wg, &m) - wg.Wait() + wg.Wait() + + report.SaveTexAllPics() + report.SaveTexAllTables() + } - report.SaveTexAllPics() - report.SaveTexAllTables() report.SaveAndPrint(*doPrint) log.Println("looks like we're done")