go(algo): close chans after use
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
df33a3c3a7
commit
805db5088b
10
algo/algo.go
10
algo/algo.go
@ -143,6 +143,8 @@ func DoRandomSearch(wg *sync.WaitGroup, m *sync.Mutex) {
|
|||||||
// ch serves as a way to get the actual computed output.
|
// ch serves as a way to get the actual computed output.
|
||||||
ch := make(chan []stats.Stats, funcCount)
|
ch := make(chan []stats.Stats, funcCount)
|
||||||
|
|
||||||
|
defer close(ch)
|
||||||
|
|
||||||
for i := range algoStats {
|
for i := range algoStats {
|
||||||
// ng y'all.
|
// ng y'all.
|
||||||
go RandomSearchNG(10000, 30, bench.Dimensions, bench.FuncNames[i], ch)
|
go RandomSearchNG(10000, 30, bench.Dimensions, bench.FuncNames[i], ch)
|
||||||
@ -158,6 +160,9 @@ func DoRandomSearch(wg *sync.WaitGroup, m *sync.Mutex) {
|
|||||||
pCh := make(chan report.PicList, funcCount*len(bench.Dimensions))
|
pCh := make(chan report.PicList, funcCount*len(bench.Dimensions))
|
||||||
pMeanCh := make(chan report.PicList, funcCount*len(bench.Dimensions))
|
pMeanCh := make(chan report.PicList, funcCount*len(bench.Dimensions))
|
||||||
|
|
||||||
|
defer close(pCh)
|
||||||
|
defer close(pMeanCh)
|
||||||
|
|
||||||
for i := range algoStats {
|
for i := range algoStats {
|
||||||
go plotAllDims(algoStats[i], "plot", ".svg", pCh, pMeanCh)
|
go plotAllDims(algoStats[i], "plot", ".svg", pCh, pMeanCh)
|
||||||
}
|
}
|
||||||
@ -197,6 +202,8 @@ func DoStochasticHillClimbing(wg *sync.WaitGroup, m *sync.Mutex) {
|
|||||||
// ch serves as a way to get the actual computed output.
|
// ch serves as a way to get the actual computed output.
|
||||||
ch := make(chan []stats.Stats, funcCount)
|
ch := make(chan []stats.Stats, funcCount)
|
||||||
|
|
||||||
|
defer close(ch)
|
||||||
|
|
||||||
for i := range algoStats {
|
for i := range algoStats {
|
||||||
// params:
|
// params:
|
||||||
// maxFES, benchMinIters, neighbours int,
|
// maxFES, benchMinIters, neighbours int,
|
||||||
@ -216,6 +223,9 @@ func DoStochasticHillClimbing(wg *sync.WaitGroup, m *sync.Mutex) {
|
|||||||
pCh := make(chan report.PicList, funcCount*len(bench.Dimensions))
|
pCh := make(chan report.PicList, funcCount*len(bench.Dimensions))
|
||||||
pMeanCh := make(chan report.PicList, funcCount*len(bench.Dimensions))
|
pMeanCh := make(chan report.PicList, funcCount*len(bench.Dimensions))
|
||||||
|
|
||||||
|
defer close(pCh)
|
||||||
|
defer close(pMeanCh)
|
||||||
|
|
||||||
for _, algoStat := range algoStats {
|
for _, algoStat := range algoStats {
|
||||||
go plotAllDims(algoStat, "plot", ".svg", pCh, pMeanCh)
|
go plotAllDims(algoStat, "plot", ".svg", pCh, pMeanCh)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user