Commit Graph

16 Commits

Author SHA1 Message Date
Dan Kortschak
8ad895b51b optimize: avoid unnecessary allocations for Gradient and Hessian 2020-02-17 09:22:36 +10:30
Dan Kortschak
7d9e94571f optimize: fix typo 2020-02-16 10:24:52 +10:30
Dan Kortschak
9a5a03f262 optimize: unify Gradient and Hessian API behaviour 2019-04-23 20:19:19 +09:30
Dan Kortschak
ae324d6d48 optimize: make Problem.Hess take a *mat.SymDense 2019-04-23 20:19:19 +09:30
Brendan Tracey
c07f678f3f 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.
2019-02-01 15:26:26 +00:00
Brendan Tracey
b545e3e77e optimize: Refactor gradient convergence and remove DefaultSettings (#772)
* optimize: Refactor gradient convergence and remove DefaultSettings

The current API design makes it easy to make a mistake in not using the DefaultSettings. This change makes the zero value of Settings do the 'right thing'. The remaining setting that is used by the DefaultSettings is to change the behavior of the GradientTolerance. This was necessary because gradient-based Local methods (BFGS, LBFGS, CG, etc.) typically _define_ convergence by the value of the gradient, while Global methods (CMAES, GuessAndCheck) are defined by _not_ converging when the gradient is small. The problem is to have two completely different default behaviors without knowing the Method. The solution is to treat a very small value of the gradient as a method-based convergence, in the same way that a small spread of data is a convergence of CMAES. Thus, the default behavior, from the perspective of Settings, is never to converge based on the gradient, but all of the Local methods will converge when a value close to the minimum is found. This default value is set to a very small value, such that users should not want a smaller value. A user can thus still set a (more reasonable) convergence value through settings.

Fixes 677.
2018-12-23 08:17:27 -05:00
Brendan Tracey
44a6721e0d optimize: make function converger an interface (#728)
* optimize: make function converger an interface

Fixes #488.
Updates #677.
2018-12-16 11:37:46 +01:00
Brendan Tracey
c395f0688f optimize: move global code to minimize (#724)
Fixes #482.
2018-12-05 18:18:39 +00:00
Brendan Tracey
d56ca496c1 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.
2018-06-06 09:11:04 -06:00
Brendan Tracey
996b88e8f8 optimize: completely overhaul Global (#352)
* optimize: completely overhaul Global

The previous implementation of Global was a minefield for incorrectly implementing global optimization methods. It was very difficult to correctly implement methods (both of the provided methods were incorrect), and the resulting code is very ugly. This commit switches to use channels to communicate, allowing a more clear ordering of concurrent code. This also enables better shutdown of methods.

In addition to the main fix of Global, this refactors the two Global methods to use the updated interface, and makes some small improvements that were previously not possible. In addition, there are some small cleanups of Local to better match between the two calls.

If anyone has been curious about what is meant by 'Don't communicate by sharing memory, share memory by communicating' this is it, and why.

* respond to PR comments

* make constants

* simplify termination logic

* optimize: simplify stats collection

* overhaul documentation and respond to PR comments

* implement PR requests

* clean up cmaes
2018-02-05 08:44:02 -07:00
kortschak
805531d142 all: change capitalization of gonum in license header 2017-11-02 06:54:08 +10:30
Brendan Tracey
38fbc22caf optimize: Update documentation for Global and clean up usage of globa… (#265)
* optimize: Update documentation for Global and clean up usage of globalStatus
2017-10-17 09:15:41 -06:00
Brendan Tracey
0d639745f1 all: update packages from mat64 to mat.
This mostly changes package name and code, but also fixes a couple of name clashes with the new package names
2017-06-13 10:28:21 -06:00
Vladimir Chalupecky
49d4aa112a optimize: remove lint found by megacheck 2017-06-01 22:07:40 +02:00
Brendan Tracey
d33397aa65 all: change import paths 2017-05-23 00:03:03 -06:00
Brendan Tracey
37c29d47e7 optimize: imported optimize as a subtree 2017-05-23 00:02:57 -06:00