Crate argmin_core
source ·Expand description
Argmin Optimizaton toolbox core
This crate contains the core functionality of argmin. If you just want to run an optimization method, this is not what you are looking for. However, if you want to implement your own solver based on the argmin architecture, you should find all necessary tools here.
TODOs:
- Provide an example of how to implement a solver
Re-exports
pub extern crate failure;
pub extern crate failure_derive;
Modules
Macros
Macros
Release an
T
from an Option<T>
if it is not None
. If it is None
, return an
ArgminError
with a message that needs to be provided.Creates an
ArgminKV
at compile time in order to avoid pushing to the kv
vector.Structs
Storage for data needed by most solvers
The datastructure which is returned by the
next_iter
method of the ArgminNextIter
trait.A simple key-value storage
Container for
ArgminLog
gersReturn struct for all solvers.
A logger based on
slog
The
Error
type, which can contain any failure.Enums
Indicates why the optimization algorithm stopped
Traits
Add a
T
to self
Dot/scalar product of
T
and self
Compute the inverse (
T
) of self
Defines a common interface to line search methods. Requires that
ArgminSolver
is implemented
for the line search method as well.Defince the interface every logger needs to expose
Every method for the update of beta needs to implement this trait.
Main part of every solver:
next_iter
computes one iteration of the algorithm and init
is
executed before these iterations. The init
method comes with a default implementation which
corresponds to doing nothing.Compute the l2-norm (
U
) of self
This trait needs to be implemented for every operator/cost function.
Scale
self
by a U
Add a
T
scaled by an U
to self
Subtract a
T
scaled by an U
from self
Defines the interface to a solver. Usually, there is no need to implement this manually, use
the
argmin_derive
crate instead.Subtract a
T
from self
Defines a common interface to methods which calculate approximate steps for trust region
methods. Requires that
ArgminSolver
is implemented as well.Dot/scalar product of
T
and self
weighted by W (p^TWv)Every writer (which is something that writes parameter vectors somewhere after each iteration)
needs to implement this.
Return param vector of all zeros (for now, this is a hack. It should be done better)