# dfoptim

> Derivative-Free Optimisation

Latest version **0.0.6** (published 2022-07-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install dfoptim
pnpm add dfoptim
yarn add dfoptim
bun add dfoptim
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2022-07-27 |
| First published | 2022-05-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 97.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Rich FitzJohn |
| Maintainers | richfitz |

## Links

- npm: https://www.npmjs.com/package/dfoptim
- Repository: https://github.com/reside-ic/dfoptim
- Homepage: https://github.com/reside-ic/dfoptim#readme
- Issues: https://github.com/reside-ic/dfoptim/issues
- npm.io page: https://npm.io/package/dfoptim

## Recent versions

- 0.0.6 (latest) — 2022-07-27
- 0.0.5 — 2022-06-30
- 0.0.4 — 2022-06-29
- 0.0.2 — 2022-05-16
- 0.0.1 — 2022-05-16

## README

## Derivative-free optimisation in javascript

[![Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip)
[![build-and-test](https://github.com/reside-ic/dfoptim/actions/workflows/ci.yml/badge.svg)](https://github.com/reside-ic/dfoptim/actions/workflows/ci.yml)
[![codecov.io](https://codecov.io/github/reside-ic/dfoptim/coverage.svg?branch=main)](https://codecov.io/github/reside-ic/dfoptim?branch=main)

Very simple optimisation, using the [Simplex (Nelder-Mead) method](https://en.wikipedia.org/wiki/Nelder%E2%80%93Mead_method) or [Brent's method](https://github.com/osveliz/numerical-veliz/wiki/Brent's-Minimization-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

* `opt` is 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 returns `true` if 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`.

## Example

Run

```
npm run build
npm run webpack
```

Then open `example/index.html` for a simple example.

## Licence

MIT © Imperial College of Science, Technology and Medicine

Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md). By participating in this project you agree to abide by its terms.

---
_Source: https://npm.io/package/dfoptim · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
