Solver Status
In SimpleSolvers we can use the SimpleSolvers.NonlinearSolverStatus to provide a diagnostic tool for a NonlinearSolver. We first make an instance of NonlinearProblem:
x = [3., 1.3]
f = x -> tanh.(x)
F!(y, x, params) = y .= f(x)
nlp = NonlinearProblem(F!, x, f(x))NonlinearProblem{Float64, typeof(Main.F!), Missing}(Main.F!, missing)We now create an instance of NewtonSolver and NonlinearSolverState:
solver = NewtonSolver(x, f(x); F = F!)
state = NonlinearSolverState(x)NonlinearSolverState{Float64, Vector{Float64}, Vector{Float64}}(0, [NaN, NaN], [NaN, NaN], [NaN, NaN], [NaN, NaN])Note that all variables are initialized with NaNs.
For the first step we call solver_step! (which updates the state internally via update![1]):
params = NullParameters()
solver_step!(x, solver, state, params)2-element Vector{Float64}:
-47.428289342569705
-0.3736830570984193We now compute the NonlinearSolverStatus:
NonlinearSolverStatus(state, config(solver))i= 0,
rxₛ= NaN,
rfₐ= NaN,
rfₛ= NaN- 1Also see the page on the
update!function.