optimize: Change initialization, remove Needser, and update Problem f… (#779)

* optimize: Change initialization, remove Needser, and update Problem function calls

We need a better way to express the Hessian function call so that sparse Hessians can be provided. This change updates the Problem function definitions to allow an arbitrary Symmetric matrix. With this change, we need to change how Location is used, so that we do not allocate a SymDense. Once this location is changed, we no longer need Needser to allocate the appropriate memory, and can shift that to initialization, further simplifying the interfaces.

A 'fake' Problem is passed to Method to continue to make it impossible for the Method to call the functions directly.

Fixes #727, #593.
This commit is contained in:
Brendan Tracey
2019-02-01 15:26:26 +00:00
committed by GitHub
parent 199b7405a3
commit c07f678f3f
20 changed files with 427 additions and 192 deletions

View File

@@ -27,12 +27,12 @@ func ExampleMinimize() {
log.Fatal(err)
}
fmt.Printf("result.Status: %v\n", result.Status)
fmt.Printf("result.X: %v\n", result.X)
fmt.Printf("result.F: %v\n", result.F)
fmt.Printf("result.X: %0.4g\n", result.X)
fmt.Printf("result.F: %0.4g\n", result.F)
fmt.Printf("result.Stats.FuncEvaluations: %d\n", result.Stats.FuncEvaluations)
// Output:
// result.Status: GradientThreshold
// result.X: [1 1 1 1 1]
// result.F: 0
// result.Stats.FuncEvaluations: 35
// result.F: 4.98e-30
// result.Stats.FuncEvaluations: 31
}