argmin 0.1.5

A pure Rust optimization toolbox

Build Status

argmin

A work-in-progress optimization toolbox written in Rust. Highly unstable and potentially very buggy. Please use with care and report any bugs you encounter. This crate is looking for contributors! Please get in touch with me if you're interested.

Documentation.

Design goals

This crate's intention is to be useful to users as well as developers of optimization algorithms, meaning that it should be both easy to apply and easy to implement algoritms. In particular, as a developer of optimization algorithms you should not need to worry about usability features (such as logging, dealing with different types, setters and getters for certain common parameters, counting cost function and gradient evaluations, termination, and so on). Instead you can focus on implementing your algorithm and let argmin do the boring stuff for you.

  • Provide an easy framework for the implementation of optimization algorithms: Define a struct to hold your data, implement a single iteration of your method and let argmin generate the rest with #[derive(ArgminSolver)]. With is approach, the interfaces to different solvers will be fairly similar, making it easy for users to try different methods on their problem without much work.
  • Provide pure Rust implementations of many optimization methods. That way there is no need to compile and interface C code and it furthermore avoids inconsistent interfaces.
  • Be type-agnostic: If you have your own special type that you need for solving your optimization problem, you just need to implement a couple of traits on that type and you're ready to go. These traits will already be implemented for common types.
  • Easy iteration information logging: Either print your iteration information to the terminal, or write it to a file, or store it in a database or send it to a big data pipeline.
  • Easy evaluation of algorithms: Make it possible to run algorithms with different parameters and store all necessary of information of all iterations and calculate measures in order to evaluate the performance of the implementation/method. Take particular care of stochastic methods.

Since this crate is in a very early stage, so far most points are only partially implemented. In addition it is very likely very buggy.

What is still needed?

The following list shows some of the important parts that need to be tackled in the near future:

  • (Much, much) more optimization algorithms
  • Tests, tests, tests!
  • Evaluation on real problems
  • Strong focus on speed
  • Making it ready for wasm and #![no_std]
  • Useful documentation
  • Extensive tutorials

Any help is appreciated!

Algorithms

  • Linesearches
    • Backtracking line search
    • More-Thuente line search
    • Hager-Zhang line search
  • Trust region method
    • Cauchy point method
    • Dogleg method
    • Steihaug method
  • Steepest Descent
  • Conjugate Gradient method
  • Nonlinear Conjugate Gradient method
  • Newton's Method
  • Newton-CG
  • Landweber iteration
  • Simulated Annealing

Usage

Add this to your Cargo.toml:

[dependencies]
argmin = "0.1.3"

Optional features

There are additional features which can be activated in Cargo.toml:

[dependencies]
argmin = { version = "0.1.3", features = ["ctrlc", "ndarrayl"] }

These are currently optional, but they may move to the default features in the future. Without adding these features compilation to wasm32-unknown-unkown seems to be possible.

  • ctrlc: Uses the ctrlc crate to properly stop the optimization (and return the current best result) after pressing Ctrl+C.
  • ndarrayl: Support for ndarray and ndarray-linalg.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.