Initial infrasctructure for preconditioners #59
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
cc @amontoison
This PR introduces infrastructure for using preconditioners in conjunction with Krylov-based linear solvers.
The overall scheme is as follows:
AbstractPreconditioner
type is introduced, from which preconditioner implementations should derive.Since preconditioners will be updated at each IPM iteration, persistent data structures make sense here.
For instance, to hold and update limited-memory factorizations.
update_preconditioner(kkt::AbstractKrylovSolver)
KrylovKKTSolver
s will have a fieldP
that stores the preconditioner and, to ensure type stability at solve time,KrylovKKTSolver
types will be templated by the type ofP
.!!! The limitation of this approach is that the type of preconditioner cannot be changed during the optimization. For instance, it would not be possible to start with a Jacobi preconditioner, then switch to a limited-memory factorization. More specifically, doing so would require a "meta-preconditioner" that switch between the
op(P::AbstractPreconditioner)
shall be implemented, that returns a linear operator which can then be passed in the Krylov method.Overall, the code will thus look like this:
Finally, the current way of selecting a preconditioner is through the
preconditioner::Symbol
key-word argument inKKTOptions
.Only
:Identity
and:Jacobi
are supported at this time, and I only implemented them for the normal equations system, i.e.,KrylovSPDSolver
s.This way of selecting preconditioners is not type-stable, and it will likely be changed in in favor of a factory-like approach, similar to the way
KKTOptions
are handled.