argmin 0.7.0 and argmin-math 0.2.0 released

Posted August 28, 2022 by Stefan Kroboth ‐ 3 min read

argmin offers a range of numerical optimization methods in Rust.

In the previous release I unfortunately accidentially removed the possibility to turn off building without the ndarray-linalg dependency when using the ndarray backend in argmin-math. ndarray-linalg is essentially only needed for the matrix inverse, which only a few solvers require. However, it links against a BLAS which can cause problems that are particularly frustrating when it is not even needed.

In this release, this possibility is added again. Each ndarray-related feature now also comes with a *-nolinalg* version which turns off building ndarray-linalg. Note that this will not implement ArgminInv for the ndarray backend and therefore certain solvers (for instance the Newton method) will not work with ndarray types. More details can be found in the argmin-math docs.

I was unsure if this fix was a breaking change because of the way argmin depends on argmin-math, therefore I decided to go ahead and release version 0.7 of argmin and version 0.2 of argmin-math just to be safe.

This also gave me the chance to release other (some of them definitely breaking) changes which were made recently.

The change with the most impact was made by @vbkaisetsu (Thanks!) who added L1 regularization to L-BFGS (also known as OWL-QN). This method can be enabled with the with_l1_regularization method of LBFGS which takes the non-negative L1 coefficient as input.

let solver = LBFGS::new(linesearch, 7).with_l1_regularization(1.0)?;

@vbkaisetsu also provided an example.

A minor downside of this addition is that the number of trait bounds on the types used in L-BFGS increased. If you are using one of the default backends, this is unlikely to affect you though.

The OWL-QN implementation required changes and additions to argmin-math, for instance the traits ArgminSignum and ArgminL1Norm.

To make the already existing ArgminNorm trait (which computes the L2 norm) more consistent with ArgminL1Norm, I renamed it to ArgminL2Norm.

And while they were at it, @vbkaisetsu also fixed wrong type alias names in some of the examples.

Shortly after releasing the previous version @renato145 reported a bug in the Dogleg method which I fixed. Thanks again for reporting!

Overall, updating argmin from 0.6 to 0.7 should be fairly straight forward in most cases.

Star Watch Fork Sponsor