mirror of
https://github.com/gonum/gonum.git
synced 2025-10-04 06:46:29 +08:00
optimize: Remove Local function (#538)
* optimize: Remove Local function This change removes the Local function. In order to do so, this changes the previous LocalGlobal wrapper to LocalController to allow Local methods to be used as a Global optimizer. This adds methods to all of the Local methods in order to implement GlobalMethod, and changes the tests accordingly. The next commit will fix all of the names
This commit is contained in:
@@ -12,7 +12,7 @@ import (
|
||||
"gonum.org/v1/gonum/optimize/functions"
|
||||
)
|
||||
|
||||
func ExampleLocal() {
|
||||
func ExampleMinimize() {
|
||||
p := optimize.Problem{
|
||||
Func: functions.ExtendedRosenbrock{}.Func,
|
||||
Grad: functions.ExtendedRosenbrock{}.Grad,
|
||||
@@ -23,8 +23,9 @@ func ExampleLocal() {
|
||||
settings.Recorder = nil
|
||||
settings.GradientThreshold = 1e-12
|
||||
settings.FunctionConverge = nil
|
||||
settings.InitX = x
|
||||
|
||||
result, err := optimize.Local(p, x, settings, &optimize.BFGS{})
|
||||
result, err := optimize.Global(p, len(x), settings, &optimize.BFGS{})
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user