15 unstable releases (5 breaking)

new 0.6.0 Apr 22, 2024
0.5.1 Oct 19, 2023
0.4.0 Oct 6, 2023
0.3.3 Aug 24, 2023
0.1.2 Jan 21, 2021

#251 in Algorithms

Download history 253/week @ 2024-01-03 16/week @ 2024-01-10 158/week @ 2024-01-17 81/week @ 2024-01-24 256/week @ 2024-01-31 107/week @ 2024-02-07 165/week @ 2024-02-14 121/week @ 2024-02-21 195/week @ 2024-02-28 96/week @ 2024-03-06 73/week @ 2024-03-13 80/week @ 2024-03-20 130/week @ 2024-03-27 193/week @ 2024-04-03 88/week @ 2024-04-10 183/week @ 2024-04-17

607 downloads per month
Used in 4 crates (2 directly)

Custom license

1MB
17K SLoC

Rust 14K SLoC // 0.0% comments C 3.5K SLoC // 0.2% comments

cobyla - a pure Rust implementation

tests crates.io docs

COBYLA is an algorithm for minimizing a function of many variables. The method is derivatives-free (only the function values are needed) and take into account constraints on the variables. The algorithm is described in:

M.J.D. Powell, "A direct search optimization method that models the objective and constraint functions by linear interpolation," in Advances in Optimization and Numerical Analysis Mathematics and Its Applications, vol. 275 (eds. Susana Gomez and Jean-Pierre Hennart), Kluwer Academic Publishers, pp. 51-67 (1994).

The algorithm comes into two flavours :

  • As an argmin solver, the Rust code was generated from the C code from here
  • As a function minimize, the Rust code was generated from the C code of the NLopt project (version 2.7.1)

In both cases, an initial transpilation was done with c2rust then the code was manually edited to make it work. The callback mechanismn is inspired from the Rust binding of NLopt, namely rust-nlopt

Example

cargo run --example paraboloid

License

The project is released under MIT License.

Dependencies

~4–13MB
~132K SLoC