Very simple optimisation, using the Simplex (Nelder-Mead) method or Brent's method (for single-variable functions).
We provide two interfaces. In the first, you can dfoptim a function in a single go:
const point = dfoptim.fitSimplex(target, start);
which will look for the minimum of the vector-valued function target, starting from location start.
Running the optimisation may take a while, and no information can be retrieved while it runs, so we also provide a more stateful interface. The function above can be implemented as:
const opt = new dfoptim.Simplex(target, start)
while (!opt.step()) {
// do something
}
const point = opt.result();
Where
optis our optimiser. At this point, it has done basic set up (creating the first simplex) but not taken any steps- The
step()method advances the algorithm one step, which will take one or two evaluations of the target function and may or may not find a better point than our current best. It returnstrueif we have converged. - The
result()method returns information about the best point.
The same pair of interfaces is provided for the Brent's method via dfoptim.fitBrent and dfoptim.Brent.
Run
npm run build
npm run webpack
Then open example/index.html for a simple example.
MIT © Imperial College of Science, Technology and Medicine
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
Automatically publish to NPM. Assuming a version number 1.0.0:
- Create a release on github
- Choose a tag -> Create a new tag: v1.0.0
- Use this version as the description
- Optionally describe the release
- Click "Publish release"
- This triggers the release workflow and the package will be available on NPM in a few minutes
Note: This package's name on NPM is @reside-ic/dfoptim not dfoptim.