## dfoptim

## Derivative-free optimisation in javascript

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

`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. By participating in this project you agree to abide by its terms.