Crates.io | optimization |
lib.rs | optimization |
version | 0.2.0 |
source | src |
created_at | 2016-04-26 11:51:00.158791 |
updated_at | 2020-04-11 09:06:42.490865 |
description | Collection of optimization algorithms |
homepage | |
repository | https://github.com/b52/optimization-rust |
max_upload_size | |
id | 4866 |
size | 51,961 |
Collection of optimization algorithms and strategies.
extern crate optimization;
use optimmization::{Minimizer, GradientDescent, NumericalDifferentiation, Func};
// numeric version of the Rosenbrock function
let function = NumericalDifferentiation::new(Func(|x: &[f64]| {
(1.0 - x[0]).powi(2) + 100.0*(x[1] - x[0].powi(2)).powi(2)
}));
// we use a simple gradient descent scheme
let minimizer = GradientDescent::new();
// perform the actual minimization, depending on the task this may
// take some time, it may be useful to install a log sink to see
// what's going on
let solution = minimizer.minimize(&function, vec![-3.0, -4.0]);
println!("Found solution for Rosenbrock function at f({:?}) = {:?}",
solution.position, solution.value);
Simply add it as a Cargo
dependency:
[dependencies]
optimization = "*"
For an exhaustive documentation head over to the API docs.
Simply download this crate, add your stuff, write some tests and create a pull request. Pretty simple! :)
$ cargo test
$ cargo clippy
This software is licensed under the terms of the MIT license. Please see the LICENSE for full details.