Nonlinear Solvers
One of our goals is to make adding new and hacking existing nonlinear solvers easy!
Input File Syntax Example
Below is an example input file block for a trust region solver that leverages a direct solver with an LDLT factorization. The nonlinear solver is also utilizing warm start to improve the first few iterations of each load step.
linear solvers:
direct:
type: DirectLinearSolver
factorization method: ldl
nonlinear solvers:
trs:
type: TrustRegionSolver
linear solver: direct
warm start: on
General methods and abstract types
Cthonios.AbstractNonlinearSolver
— Typeabstract type AbstractNonlinearSolver{L, O, U, T}
a nonlinear solver needs to define the following methods
- check_convergence - returns a bool
- logger - @info information
- step! - step for the solver
it needs the following types
- a linear solver
- an objective
- an unknown vector
- an int called max_iter
Cthonios.create_unknowns
— Methodcreate_unknowns(
solver::Cthonios.AbstractNonlinearSolver
) -> Any
Creates a set of unknowns for the nonlinear solver
Cthonios.solve!
— Methodsolve!(solver::Cthonios.AbstractNonlinearSolver, Uu, p)
Generic method to fall back on if step! is defined
Newton Solver
Cthonios.NewtonSolver
— Typestruct NewtonSolver{L, O, U, T} <: Cthonios.AbstractNonlinearSolver{L, O, U, T}
linear_solver::Any
objective::Any
ΔUu::Any
timer::Any
max_iter::Int64
abs_tol::Float64
rel_tol::Float64
use_warm_start::Bool
Cthonios.NewtonSolver
— MethodNewtonSolver(
objective::Objective,
p,
linear_solver_type,
timer
) -> NewtonSolver{_A, O} where {_A, O<:Objective}
Cthonios.check_convergence
— Methodcheck_convergence(
solver::NewtonSolver,
Uu,
p,
R0_norm
) -> Bool
Cthonios.logger
— Methodlogger(solver::NewtonSolver, Uu, p, n::Int64, norm_R0)
Cthonios.step!
— Methodstep!(solver::NewtonSolver, Uu, p)
Trust Region Solver
Cthonios.TrustRegionSolver
— Typestruct TrustRegionSolver{L, O, U<:(AbstractVector), T<:TimerOutputs.TimerOutput, W, F<:FiniteElementContainers.NodalField, S<:Cthonios.TrustRegionSolverSettings} <: Cthonios.AbstractNonlinearSolver{L, O, U<:(AbstractVector), T<:TimerOutputs.TimerOutput}
preconditioner::Any
objective::Any
ΔUu::AbstractVector
timer::TimerOutputs.TimerOutput
warm_start::Any
o::AbstractVector
g::FiniteElementContainers.NodalField
Hv::FiniteElementContainers.NodalField
cauchy_point::AbstractVector
q_newton_point::AbstractVector
d::AbstractVector
y_scratch_1::AbstractVector
y_scratch_2::AbstractVector
y_scratch_3::AbstractVector
y_scratch_4::AbstractVector
use_warm_start::Bool
settings::Cthonios.TrustRegionSolverSettings
Cthonios.TrustRegionSolver
— MethodTrustRegionSolver(
objective::Objective,
p,
timer;
preconditioner,
use_warm_start
) -> TrustRegionSolver{L, O, Vector{Float64}, TimerOutputs.TimerOutput, W, F, Cthonios.TrustRegionSolverSettings} where {L<:(CholeskyPreconditioner{A, SparseArrays.CHOLMOD.Factor{Float64, Int64}} where A<:(FiniteElementContainers.StaticAssembler{Float64, Int64, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, Vector{Int64}, Vector{Int64}, Vector{Float64}} where {_A<:AbstractVector{Int64}, _B<:AbstractVector{Int64}, _C<:AbstractVector{Int64}, _D<:AbstractVector{Int64}, _E<:AbstractVector{Int64}, _F<:FiniteElementContainers.NodalField, _G<:AbstractVector{Float64}, _H, _I, _J, _K})), O<:Objective, W<:Cthonios.WarmStart, F<:FiniteElementContainers.NodalField}
TODO figure out which scratch arrays can be nixed
Cthonios.TrustRegionSolverSettings
— Typet_1::Float64
t_2::Float64
η_1::Float64
η_2::Float64
η_3::Float64
max_trust_iters::Int64
tol::Float64
max_cg_iters::Int64
max_cumulative_cg_iters::Int64
cg_tol::Float64
cg_inexact_solve_ratio::Float64
tr_size::Float64
min_tr_size::Float64
check_stability::Bool
use_preconditioned_inner_product_for_cg::Bool
use_incremental_objective::Bool
debug_info::Bool
over_iter::Int64
Cthonios.calculate_cauchy_point!
— Methodcalculate_cauchy_point!(
cauchy_point,
solver,
P,
g,
Hg,
tr_size
) -> Any
Cthonios.dog_leg_step!
— Methoddog_leg_step!(
d,
solver,
P,
cauchy_point,
q_newton_point,
tr_size
)
Cthonios.minimize_trust_region_sub_problem!
— Methodminimize_trust_region_sub_problem!(
z,
solver::TrustRegionSolver,
P,
x::AbstractVector,
p,
r_in,
tr_size::Float64
) -> Tuple{Symbol, Int64}
minimize r * z + 0.5 * z * J * z
Cthonios.solve!
— Methodsolve!(solver::TrustRegionSolver, Uu, p)
TODO Eventually map this to the interface
Cthonios.update_tr_size
— Methodupdate_tr_size(
solver,
model_objective,
real_objective,
step_type,
tr_size,
real_res_norm,
g_norm
) -> Tuple{Any, Any}