argmin 0.10.0 and argmin-math v0.4.0

Posted February 27, 2024 by Stefan Kroboth ‐ 6 min read

argmin is a Rust library which offers a range of numerical optimization methods and is a framework for developing optimization algorithms. Details about the design and features of argmin can be found on the website, in the book, on Github, on and on

argmin 0.10.0

argmin has seen a few smaller, but partially breaking changes in this release.

Observers and Checkpointing (Breaking)

Observers and checkpointing were moved from argmin into dedicated crates. This greatly reduced the complexity of argmin and the number of its dependencies. Now users can decide which observers and checkpointing they actually need, thus potentially reducing compile times and code size.

Notable changes:

Furthermore, Observe::observe_init, which is called after initialization of the solver, now also has access to the state, meaning that it can observe the initial state of the optimization run.

Interrupt handling (Breaking)

Interrupt handling now includes SIGINT, SIGTERM and SIGHUP. Consequently, TerminationReason::KeyboardInterrupt was renamed to TerminationReason::Interrupt. This is a breaking change for those who match on TerminationReason.

Optional timeout

Executor now allows one to terminate a run after a given timeout, which can be set with the timeout method of Executor. The check whether the overall runtime exceeds the timeout is performed after every iteration, therefore the actual runtime can be longer than the set timeout. In case of timeout, the run terminates with TerminationReason::Timeout.

The timeout is set via the timeout method of Executor:

let res = Executor::new(operator, solver)
The optional serde1 feature

With moving observers out of the argmin crate, it became easier to reason about the optional serde1 feature, which eventually led to the removal of the SerializeAlias and DeserializeAlias traits. Activating serde1 for argmin is now only necessary for checkpointing.

Other changes and fixes
  • In GaussNewton, the residuals were out of sync with the parameter vector (Thanks @gmilleramilar for reporting and starting the fix).

  • A failing line search in LBFGS now does not lead to the error propagating to the Executor but instead causes LBFGS to terminate with TerminationReason::SolverExit(string) where string indicates the reason why the line search failed.

  • The random number generator (RNG) used in ParticleSwarm can now be set by users (Thanks to @jonboh).

  • All crates are now in the crates directory of the argmin monorepo.

  • All examples are now in dedicated crates in the examples directory. This makes it easier for users to see which dependencies (and features) an example requires.

  • argmin-math dependency updated to version 0.4.

argmin-math 0.4.0

Removal of *-serde features (Breaking)

All features ending with -serde were removed. Support for serde is now enabled simply be enabling serde support in the backends (ndarray or nalgebra). Using *-serde features will cause a failing build, which can be solved without loss of functionality by removing -serde from the feature.

Development on Windows

Thanks to @Tastaturtaste development on Windows is finally possible. This was achieved by using MKL in the argmin-math tests and involved a lot of effort to be able to continue supporting multiple versions of ndarray.

Other changes (Breaking)
  • ArgminInv is now also implemented for scalars (f32 and f64, thanks to @sdrap).
  • ArgminRandom::rand_from_range(...) now also accepts a random number generator. This allows for setting the seed manually (Thanks to @jonboh).
  • Tests for ArgminMinMax were added (Thanks to @Shreyan11).


There currently are a couple of open issues, some of which are good first issues to start getting involved in argmin. I am happy to provide guidance if needed.

Suggestions and feature requests are also welcome. For instance, let me know which observers or checkpointing methods yo would like to see.


This release mostly affected the project structure, which was an important step for further development. By moving observers and checkpointing into dedicated crates, the dependencies of argmin could be reduced and users have more freedom in pulling in only what they need. The changes to ParticleSwarm and ArgminRandom allow for reproducible runs by setting an RNG seed. Interrupt handling has become more useful by capturing more interrupts. Finally, development on Windows is possible.

This release included contributions from @gmilleramilar, @jonboh, @Tastaturtaste, @Shreyan11, @sdrap, and @stefan-k. Thanks to the contributors and those who opened and responded to issues and discussions!

A bit offtopic, but I want to use this opportunity to give a shoutout to gkls-rs, a pure Rust implementation of the GKLS function generator by @jonboh.

Discord server

If you're interested you're invited to join the Discord!

Star Watch Fork Sponsor