Experimental Julia package for trust region methods, with an emphasis on
Clean functional style: no preallocated buffers, resulting in less complicated code.
A simple modular interface: iterate stepwise, or use a simple wrapper.
AD agnostic function evaluations: an objective function just returns a value with properties
Jacobian. It can be any type that supports this, and carry extra payload relevant to your problem. However, if you just want to code an ℝⁿ → ℝⁿ function, it can do AD for you using wrappers (currently
Support for bailing out: some inputs just may not be possible or worthwhile to evaluated for very complicated functions (eg economic models). You can signal this by returning non-finite residuals (eg
julia> using TrustRegionMethods julia> f(x) = [1.0 2; 3 4] * x - ones(2) # very simple linear function f (generic function with 1 method) julia> ff = ForwardDiff_wrapper(f, 2) # AD via a wrapper results in a callable AD wrapper via ForwardDiff for ℝⁿ→ℝⁿ function, n = 2 julia> ff(ones(2)) # this is what the solver will need (residual = [2.0, 6.0], Jacobian = [1.0 2.0; 3.0 4.0]) julia> trust_region_solver(ff, [100.0, 100.0]) # remote starting point Nonlinear solver using trust region method converged after 9 steps with ‖x‖₂ = 3.97e-15, Δ = 128.0 x = [-1.0, 1.0] r = [-1.78e-15, 3.55e-15]
This package is very experimental — the interface will be evolving without prior warning or deprecation. You may want to consider the packages below instead.
NLsolve.jl is much more mature, but written with a lot of emphasis on using pre-allocated buffers.
TRS.jl solves trust region subproblems for large scale problems using the generalized eigenvalue solver of Adachi et al (2017). This solver is also implemented in this package, but not optimized for large-scale sparse problems.