https://github.com/jd557/nelder-mead.rs
A Rust implementation of the Nelder-Mead method
https://github.com/jd557/nelder-mead.rs
Last synced: about 1 month ago
JSON representation
A Rust implementation of the Nelder-Mead method
- Host: GitHub
- URL: https://github.com/jd557/nelder-mead.rs
- Owner: JD557
- Created: 2019-02-09T20:12:32.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-02-09T20:12:50.000Z (about 6 years ago)
- Last Synced: 2025-04-01T18:09:23.475Z (about 1 month ago)
- Language: Rust
- Size: 10.7 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Nelder-Mead.rs
A [Nelder-Mead method][neldermead] implementation in Rust.
Allows fast minimization/maximization of `Vec -> f64` functions.
## Basic usage
```
use nelder_mead::*;
use nelder_mead::params::*;use assert_approx_eq::assert_approx_eq;
// minimize (x+1)^2 + y^2
let (x, fx) = minimize_unbounded(
|args| (args[0]+1.0) * (args[0]+1.0) + args[1]*args[1],
vec![5.0,5.0],
1.0,
Params::default(),
1000);// expected minimum: f(-1, 0) = 0
assert_approx_eq!(x[0], -1.0);
assert_approx_eq!(x[1], 0.0);
assert_approx_eq!(fx, 0.0);
```[neldermead]: https://en.wikipedia.org/wiki/Nelder%E2%80%93Mead_method