44 lines
1007 B
Go
44 lines
1007 B
Go
// Copyright 2022 wanderer <a_mirre at utb dot cz>
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
package algo
|
|
|
|
import (
|
|
"sync"
|
|
)
|
|
|
|
// Values type is just a fancy named []float64 that will allow us to define
|
|
// methods over it.
|
|
type Values []float64
|
|
|
|
var picPath = "res/"
|
|
|
|
// DoRandomSearch executes a search using the 'Random search' method.
|
|
func DoRandomSearch(wg *sync.WaitGroup) {
|
|
defer wg.Done()
|
|
|
|
printRandomSearch("starting...")
|
|
|
|
// ng y'all.
|
|
schw := RandomSearchNG(10000, 30, []int{5, 10, 20}, "Schwefel")
|
|
djg1 := RandomSearchNG(10000, 30, []int{5, 10, 20}, "De Jong 1st")
|
|
djg2 := RandomSearchNG(10000, 30, []int{5, 10, 20}, "De Jong 2nd")
|
|
|
|
plotAllDims(schw, "plot", ".svg")
|
|
plotAllDims(djg1, "plot", ".svg")
|
|
plotAllDims(djg2, "plot", ".svg")
|
|
}
|
|
|
|
// DoStochasticHillClimbing performs a search using the 'Stochastic Hill
|
|
// Climbing' method.
|
|
func DoStochasticHillClimbing(wg *sync.WaitGroup) {
|
|
defer wg.Done()
|
|
|
|
printSHC("starting...")
|
|
}
|
|
|
|
func newValues() *Values {
|
|
var v Values
|
|
return &v
|
|
}
|