Crate cobyla

Crate cobyla 

Source
Expand description

§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 a function minimize: the Rust code was generated from the C code of the NLopt project (version 2.7.1)
  • and optionally as an argmin solver, CobylaSolver: the Rust code was generated from the C code from here

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

or to solve with the argmin COBYLA solver too

cargo run --example paraboloid --features argmin

§License

The project is released under MIT License.

Structs§

StopTols
Tolerances used as termination criteria. For all, condition is disabled if value is not strictly positive.

Enums§

FailStatus
Failed termination status of the optimization process
RhoBeg
An enum for specifying the initial change of x which correspond to the rhobeg argument of the original Powell’s algorithm (hence the name)
SuccessStatus
Successful termination status of the optimization process

Traits§

Func
A trait representing objective and constraints functions.

Functions§

minimize
Minimizes a function using the Constrained Optimization By Linear Approximation (COBYLA) method.