The solver interface functions
A solver is the combination of a problem, usually providing at least the manifold and the objective, together with a state.
Given these two, the function to call is solve!, which is a framework that you in general should not change or redefine. It uses the following methods, which also need to be implemented for your own algorithm, if you want to provide one.
Manopt.decorate_objective! — Method
decorate_objective!(M, o::AbstractManifoldObjective; kwargs...)Decorate the AbstractManifoldObjective o with specific decorators.
Optional arguments
The optional arguments provide necessary details on the decorators; providing one of them activates the corresponding decorator.
cache=missing: specify a cache. Currently:Simpleis supported and:LRUif you loadLRUCache.jl. For this case a tuple specifying what to cache and how many entries to keep has to be provided. For example(:LRU, [:Cost, :Gradient], 10)states that the last 10 used cost function evaluations and gradient evaluations should be stored. Seeobjective_cache_factoryfor details.count=missing: specify which calls to the objective should be counted, seeManifoldCountObjectivefor the full list.objective_type=:Riemannian: specify that an objective is:Riemannianor:Euclidean. The:Euclideansymbol is equivalent to specifying it as:Embedding, since in the end, both refer to converting an objective from the embedding (whether it is Euclidean or not) to the Riemannian one.return_objective=false: indicate whether to wrap the objective in aReturnManifoldObjective, indicating that the solver should return the objective as well.
See also
Manopt.decorate_state! — Method
decorate_state!(s::AbstractManoptSolverState; kwargs...)Decorate the AbstractManoptSolverState s with specific decorators.
Optional arguments
The optional arguments provide necessary details on the decorators.
callback=missing: (deprecated) add an arbitrary (simple) callback functioncb()to be called every iteration.debug=Array{Union{Symbol,DebugAction,String,Int, Function},1}(): a set of symbols representingDebugActions,Stringsused as dividers and a sub-sampling integer. These are passed as aDebugGroupwithin:Iterationto theDebugSolverStatedecorator dictionary. A function is added as a (non-simple) callback within aDebugCallback. Only exception is:Stopthat is passed to:Stop.record=Array{Union{Symbol,RecordAction,Int},1}(): specify recordings by usingSymbols orRecordActions directly. An integer can again be used for only recording every $k$-th iteration.return_state=false: indicate whether to wrap the state in aReturnSolverState, indicating that the solver should return the state and not (only) the minimizer.
All other keywords are ignored.
See also
Manopt.get_cost — Method
get_cost(p::AbstractManoptProblem, s::AbstractManoptSolverState)Get cost at the current iterate of the solver state s for the problem p. The method may be implemented by particular solvers if they store the cost at the current iterate in the state, but by default it is obtained by calling get_cost(p, get_iterate(s)).
Manopt.initialize_solver! — Method
initialize_solver!(amp::AbstractManoptProblem, ams::AbstractManoptSolverState)Initialize the solver to the optimization AbstractManoptProblem amp by initializing the necessary values in the AbstractManoptSolverState ams.
Manopt.solve! — Method
solve!(problem::AbstractManoptProblem, state::AbstractManoptSolverState)Run the solver implemented for the AbstractManoptProblem problem and the AbstractManoptSolverState state employing initialize_solver!, step_solver!, as well as the stop_solver! of the solver.
This includes the callbacks :BeforeInit, :Init, :BeforeStep, :Step, and :Stop.
Manopt.step_solver! — Method
step_solver!(amp::AbstractManoptProblem, ams::AbstractManoptSolverState, k)Do one iteration step (the k-th) for an AbstractManoptProblem amp by modifying the values in the AbstractManoptSolverState ams.
Manopt.stop_solver! — Method
stop_solver!(amp::AbstractManoptProblem, ams::AbstractManoptSolverState, k)Determine whether the solver should stop.
Depending on the current AbstractManoptProblem amp, the current state of the solver stored in AbstractManoptSolverState ams and the current iteration k, this by default calls the internal StoppingCriterion ams.stop.
This includes a callback :BeforeStop.
Internal functions
Manopt.ClosedFormSubSolverState — Type
ClosedFormSubSolverState <: AbstractManoptSolverStateSubsolver state indicating that a closed-form solution is available.
Constructor
ClosedFormSubSolverState()Manopt.ReturnSolverState — Type
ReturnSolverState{O<:AbstractManoptSolverState} <: AbstractManoptSolverStateThis internal type is used to indicate that the contained AbstractManoptSolverState state should be returned at the end of a solver instead of the usual minimizer.
See also
Manopt.get_solver_return — Method
get_solver_return(s::ReturnSolverState)
get_solver_return(o::AbstractManifoldObjective, s::ReturnSolverState)Determine the solver return.
Return the internally stored state of the ReturnSolverState instead of the minimizer.
Since a solver might return both a state and an objective in a tuple, this then re-iterates on the second argument.