nemos.solvers.register#

nemos.solvers.register(algo_name, implementation, backend='custom', replace=False, default=False, validate=True, test_ridge_without_aux=False, test_ridge_with_aux=False)[source]#

Register a solver implementation in the registry.

Parameters:
  • algo_name (str) – Name of the optimization algorithm.

  • implementation (Type[SolverProtocol]) – Class implementing the solver. Has to adhere to the AbstractSolver interface.

  • backend (str) – Backend name. Defaults to “custom”. When wrapping and registering an existing solver from an external package, this would be the package name.

  • replace (bool) – If an implementation for the given algorithm and backend names is already present in the registry, overwrite it.

  • default (bool) – Set this implementation as the default for the algorithm. Can also be done with set_default_backend.

  • validate (bool) – Validate all required methods exist and have correct signatures.

  • test_ridge_without_aux (bool) – Validate solver signatures and functionality by running a small ridge regression, objective function without aux.

  • test_ridge_with_aux (bool) – Validate solver signatures and functionality by running a small ridgeregression, testing that objective functions with auxiliary variables are handled.

Return type:

None

Examples

>>> import nemos as nmo
>>> nmo.solvers.register("FISTA", nmo.solvers._fista.OptimistixFISTA, backend="optimistix")