optimize: Change Settings to allow InitialLocation (#497)

* optimize: Change Settings to allow InitialLocation

This modifies Settings to allow specifying an initial location and properties of the function (value, gradient, etc.). This allows to work with local optimizers that are seeded with initial settings. This has two fields that must be specified, InitX and InitValues. Ideally this would only be one location, but the difficulty is that the default value of the function is 0. We either must require the user to specify it is set (in this case that InitValues is non-zero), or require the user to change the default value away if it is not set. The former seems much safer.
This commit is contained in:
Brendan Tracey
2018-06-06 09:11:04 -06:00
committed by GitHub
parent ee7a7204dd
commit d56ca496c1
5 changed files with 96 additions and 53 deletions

View File

@@ -164,15 +164,16 @@ func (p Problem) satisfies(method Needser) error {
// settings, convergence information, and Recorder information. In general, users
// should use DefaultSettings rather than constructing a Settings literal.
//
// If UseInitData is true, InitialValue, InitialGradient and InitialHessian
// specify function information at the initial location.
//
// If Recorder is nil, no information will be recorded.
type Settings struct {
UseInitialData bool // Use supplied information about the conditions at the initial x.
InitialValue float64 // Function value at the initial x.
InitialGradient []float64 // Gradient at the initial x.
InitialHessian *mat.SymDense // Hessian at the initial x.
// InitX specifies an initial location to communicate to the Method. If InitX
// is nil, then a slice of zeros is used as a default value.
InitX []float64
// InitValues specifies properties known at InitX (function value, gradient, etc.).
// If InitX is nil, InitValues must be also. If InitValues is non-nil, then
// the function value F must be provided, the location X must not be specified
// (use InitX instead), and other fields may be specified.
InitValues *Location
// FunctionThreshold is the threshold for acceptably small values of the
// objective function. FunctionThreshold status is returned if