3 releases (breaking)

Uses old Rust 2015

0.2.0 Apr 11, 2020
0.1.0 Jun 6, 2016
0.0.1 Apr 26, 2016

#1921 in Algorithms

Download history 27/week @ 2024-07-18 36/week @ 2024-07-25 36/week @ 2024-08-01 36/week @ 2024-08-08 14/week @ 2024-08-15 15/week @ 2024-08-22 20/week @ 2024-08-29 20/week @ 2024-09-05 29/week @ 2024-09-12 52/week @ 2024-09-19 114/week @ 2024-09-26 197/week @ 2024-10-03 90/week @ 2024-10-10 380/week @ 2024-10-17 136/week @ 2024-10-24 16/week @ 2024-10-31

678 downloads per month
Used in 2 crates (via finalytics)

MIT license

35KB
630 lines

optimization Build Status Coverage Status

Collection of optimization algorithms and strategies.

Usage

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);

Installation

Simply add it as a Cargo dependency:

[dependencies]
optimization = "*"

Documentation

For an exhaustive documentation head over to the API docs.

Development

Simply download this crate, add your stuff, write some tests and create a pull request. Pretty simple! :)

$ cargo test
$ cargo clippy

License

This software is licensed under the terms of the MIT license. Please see the LICENSE for full details.

Dependencies

~1.7–2.4MB
~43K SLoC