math-optim/run.go

55 lines
1.3 KiB
Go
Raw Normal View History

2023-01-12 23:35:51 +01:00
// Copyright 2023 wanderer <a_mirre at utb dot cz>
2022-07-18 23:12:33 +02:00
// SPDX-License-Identifier: GPL-3.0-or-later
package main
import (
"flag"
"log"
"sync"
"git.dotya.ml/wanderer/math-optim/algo"
"git.dotya.ml/wanderer/math-optim/report"
)
var version = "development"
func run() {
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)")
2022-12-24 11:30:22 +01:00
// TODO(me): add flag for plot output format: -plotout=(svg,eps,pdf)
2022-07-18 23:12:33 +02:00
flag.Parse()
if *generate {
// atm we're only doing Random search and SHC
2023-01-21 02:35:29 +01:00
// algoCount := 2
algoCount := 1
2022-07-18 23:12:33 +02:00
var wg sync.WaitGroup
wg.Add(algoCount)
var m sync.Mutex
2023-01-21 02:35:29 +01:00
// go algo.DoRandomSearch(&wg, &m)
// go algo.DoStochasticHillClimbing(&wg, &m)
// // go algo.DoStochasticHillClimbing100Neigh(&wg, &m)
go algo.DojDE(&wg, &m)
2022-07-18 23:12:33 +02:00
wg.Wait()
2023-01-21 02:35:29 +01:00
// pL, benchCount := algo.PrepComparisonOfMeans(&wg)
2023-01-21 02:35:29 +01:00
// report.SaveComparisonOfMeans(*pL, benchCount)
2022-07-18 23:12:33 +02:00
report.SaveTexAllPics()
report.SaveTexAllTables()
}
report.SaveAndPrint(*doPrint)
log.Println("looks like we're done")
log.Println("run an equivalent of `pdflatex -clean -shell-escape -interaction=nonstopmode ./report.tex` to get a pdf")
}