diff --git a/Project.toml b/Project.toml index 58ab465..4e240e8 100644 --- a/Project.toml +++ b/Project.toml @@ -12,6 +12,7 @@ Enzyme = "7da242da-08ed-463a-9acd-ee780be4f1d9" ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" KernelAbstractions = "63c18a36-062a-441e-b654-da1e3ab1ce7c" LineSearch = "87fe0de2-c867-4266-b59a-2f0a94fc965b" +LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" NonlinearSolveBase = "be0214bd-f91f-a760-ac4e-3421ce2b2da0" OptimizationBase = "bca83a33-5cc9-4baa-983d-23429ab6bcbb" PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" @@ -62,9 +63,8 @@ julia = "1.10" LatticeRules = "73f95e8e-ec14-4e6a-8b18-0d2e271c4e55" SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" -LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] -test = ["LatticeRules", "JET", "LinearAlgebra", "SafeTestsets", "Test"] +test = ["LatticeRules", "JET", "SafeTestsets", "Test"] diff --git a/src/ParallelParticleSwarms.jl b/src/ParallelParticleSwarms.jl index 4324a95..869d47e 100644 --- a/src/ParallelParticleSwarms.jl +++ b/src/ParallelParticleSwarms.jl @@ -10,7 +10,9 @@ import ForwardDiff import KernelAbstractions import KernelAbstractions: CPU, @groupsize, @index, @kernel, @localmem, @private, @synchronize, @uniform, get_backend +import LineSearch import LineSearch: StrongWolfeLineSearch +import LinearAlgebra: dot, norm import NonlinearSolveBase.Utils as NLBUtils # Loaded for its `solve(::OptimizationProblem, alg, ...)` method, which applies the # `allowsbounds`/`allowsconstraints` checks before forwarding to `SciMLBase.__solve`. @@ -28,7 +30,7 @@ import SciMLBase: ImmutableNonlinearProblem, NonlinearFunction, OptimizationFunc # `init`/`reinit!`/`solve!` cache workflow, and inspect the result. Everything stays # owned and documented upstream in SciMLBase. import SciMLBase: NullParameters, OptimizationSolution, ReturnCode, successful_retcode -import Setfield: @set! +import Setfield: @set, @set! import SimpleNonlinearSolve: SimpleBroyden import SimpleOptimization import SimpleOptimization: SimpleLBFGS diff --git a/src/algorithms.jl b/src/algorithms.jl index 4e3f137..89df0cc 100644 --- a/src/algorithms.jl +++ b/src/algorithms.jl @@ -237,6 +237,15 @@ Run a particle-swarm search followed by local refinement. - `pso`: Particle-swarm algorithm used to generate local starting points. - `local_opt`: `SimpleLBFGS` (projected Strong-Wolfe L-BFGS from SimpleOptimization.jl) or [`BFGS`](@ref) local refinement algorithm. + +With `SimpleLBFGS`, every particle's best position is refined by SimpleOptimization's +projected L-BFGS with its Strong-Wolfe line search, unchanged, but executed in lockstep +across particles: each step evaluates the objective and gradient at every particle's next +point together. With `AutoForwardDiff` the gradient is split into one direction per +thread; other AD types compute it once per particle, as before. Each particle visits the +same points as a standalone SimpleOptimization solve, provided the objective returns the +same floating-point type as its input. Passing `maxtime` to `solve` stops the local phase +once that many seconds have passed since it started. """ struct HybridPSO{Backend, LocalOpt} <: HybridPSOAlgorithm{LocalOpt} pso::PSOAlgorithm diff --git a/src/hybrid.jl b/src/hybrid.jl index 53361f4..070594c 100644 --- a/src/hybrid.jl +++ b/src/hybrid.jl @@ -107,6 +107,7 @@ function SciMLBase.solve!( maxiters = 100, local_maxiters = 50, linesearch = opt.local_opt.linesearch, + maxtime = nothing, kwargs... ) where {Backend} @@ -140,11 +141,11 @@ function SciMLBase.solve!( α_init = T(linesearch.α_init), α_max = T(linesearch.α_max), maxiters = linesearch.maxiters, zoom_maxiters = linesearch.zoom_maxiters, ) - lbfgs_run!(opt.backend)( - grad_f, f_raw, p, particles, result, result_fx, lb, ub, + lockstep_lbfgs!( + result, result_fx, grad_f, f_raw, p, prob.f.adtype, particles, lb, ub, local_maxiters, abstol, reltol, typed_linesearch, SimpleOptimization.__get_threshold(opt.local_opt); - ndrange = n, + maxtime, ) KernelAbstractions.synchronize(opt.backend) diff --git a/src/lbfgs.jl b/src/lbfgs.jl index 82145a0..a5f9844 100644 --- a/src/lbfgs.jl +++ b/src/lbfgs.jl @@ -4,18 +4,251 @@ function _static_bounds(prob, ::Val{N}, ::Type{T}) where {N, T} return lb, ub end -# Local polish runs inside a KernelAbstractions kernel, so call the static -# SimpleOptimization L-BFGS core directly rather than host-side `solve`. -@kernel function lbfgs_run!( - grad_f, f, p, particles, result, result_fx, lb, ub, - maxiters, abstol, reltol, linesearch, history_size +# Local polish: SimpleOptimization's `_lbfgs` (projected L-BFGS with LineSearch's +# Strong-Wolfe search), re-executed in lockstep across particles. Each particle's run is +# cut at its objective/gradient evaluations: every host step evaluates f and the gradient +# at each particle's pending point, then `_lbfgs_advance` runs `_lbfgs`'s own control +# flow up to that particle's next evaluation. Each particle visits the same points as +# `_lbfgs` would on its own; finished particles pass through unchanged. + +const _START, _LS_ZERO, _LS_BRACKET, _LS_ZOOM, _LS_ACCEPT, _DONE = 1, 2, 3, 4, 5, 6 + +struct LBFGSState{D, T, M} + phase::Int + xe::SVector{D, T} # point whose f and gradient the phase is waiting for + x::SVector{D, T} + fx::T + g::SVector{D, T} + s_hist::NTuple{M, SVector{D, T}} + y_hist::NTuple{M, SVector{D, T}} + pseudo_iteration::Int + iter::Int + tol::T + direction::SVector{D, T} + # Strong-Wolfe search (`_sw_search`, `_sw_zoom`) + α_max::T + α_init::T + ϕ_0::T + dϕ_0::T + α::T # trial step: α_i while bracketing, α_j while zooming + k::Int # bracketing or zoom iteration + α_prev::T + ϕ_prev::T + dϕ_prev::T + a_lo::T + ϕ_lo::T + dϕ_lo::T + a_hi::T + ϕ_hi::T + dϕ_hi::T +end + +function _lbfgs_start(x0::SVector{D, T}, lb, ub, ::Val{M}) where {D, T, M} + x = SimpleOptimization._project(x0, lb, ub) + z = zero(T) + zs = ntuple(_ -> zero(x), Val(M)) + return LBFGSState( + _START, x, x, z, zero(x), zs, zs, 0, 0, z, zero(x), + z, z, z, z, z, 0, z, z, z, z, z, z, z, z, z ) - i = @index(Global, Linear) - @inbounds x0 = as_svector(particles[i].best_position) - u, v, _, _ = SimpleOptimization._lbfgs( - grad_f, f, p, x0, lb, ub, maxiters, abstol, reltol, - linesearch, history_size +end + +_isdone(st) = st.phase == _DONE + +# Top of `_lbfgs`'s loop, through the line search's evaluation of φ(0). +function _lbfgs_iterate(st::LBFGSState{D, T, M}, lb, ub, maxiters, ls) where {D, T, M} + (; x, fx, g) = st + st.iter < maxiters || return @set st.phase = _DONE + (!isfinite(fx) || !all(isfinite, g)) && return @set st.phase = _DONE + maximum(abs, SimpleOptimization._projected_gradient(x, g, lb, ub)) ≤ st.tol && + return @set st.phase = _DONE + + pseudo_iteration = st.pseudo_iteration + 1 + direction = SimpleOptimization._feasible_direction( + x, SimpleOptimization._lbfgs_direction( + g, st.s_hist, st.y_hist, pseudo_iteration, Val(M) + ), lb, ub ) - @inbounds result[i] = u - @inbounds result_fx[i] = isfinite(v) ? v : eltype(u)(Inf) + if dot(direction, g) ≥ zero(T) + pseudo_iteration = 1 + direction = SimpleOptimization._feasible_direction(x, -g, lb, ub) + end + @set! st.iter = st.iter + 1 + @set! st.pseudo_iteration = pseudo_iteration + @set! st.direction = direction + maximum(abs, direction) ≤ eps(T) && return @set st.phase = _DONE + + # `_objective_line_search`, then the static `solve!` of StrongWolfeLineSearch. + α_max = SimpleOptimization._max_feasible_step(x, direction, lb, ub, T(ls.α_max)) + α_max ≤ zero(T) && return @set st.phase = _DONE + α_max_val = max(zero(T), min(T(ls.α_max), T(α_max))) + α_max_val > zero(T) || return @set st.phase = _DONE + @set! st.α_max = α_max_val + @set! st.α_init = min(T(ls.α_init), α_max_val) + @set! st.phase = _LS_ZERO + @set! st.xe = x .+ zero(T) .* direction + return st +end + +function _ls_trial(st, phase, α) + @set! st.phase = phase + @set! st.α = α + @set! st.xe = st.x .+ α .* st.direction + return st +end + +function _ls_accept(st::LBFGSState{D, T}, α, lb, ub) where {D, T} + @set! st.phase = _LS_ACCEPT + @set! st.xe = SimpleOptimization._project(st.x + T(α) * st.direction, lb, ub) + return st +end + +# `_sw_zoom` from its start, or its next iteration, through the next trial evaluation. +function _ls_zoom_trial(st::LBFGSState{D, T}, ls) where {D, T} + st.k > ls.zoom_maxiters && return @set st.phase = _DONE + (; a_lo, a_hi) = st + α_j = LineSearch._sw_interpolate(a_lo, a_hi, st.ϕ_lo, st.ϕ_hi, st.dϕ_lo, st.dϕ_hi) + bracket = T(0.01) * abs(a_hi - a_lo) + α_j = clamp(α_j, min(a_lo, a_hi) + bracket, max(a_lo, a_hi) - bracket) + return _ls_trial(st, _LS_ZOOM, α_j) +end + +function _ls_zoom_start(st, a_lo, a_hi, ϕ_lo, dϕ_lo, ϕ_hi, dϕ_hi, ls) + @set! st.a_lo = a_lo + @set! st.a_hi = a_hi + @set! st.ϕ_lo = ϕ_lo + @set! st.dϕ_lo = dϕ_lo + @set! st.ϕ_hi = ϕ_hi + @set! st.dϕ_hi = dϕ_hi + @set! st.k = 1 + return _ls_zoom_trial(st, ls) +end + +# Consume f and the gradient at `st.xe`, then run to the particle's next evaluation. +function _lbfgs_advance( + st::LBFGSState{D, T, M}, fe, ge, lb, ub, maxiters, abstol, reltol, ls + ) where {D, T, M} + phase = st.phase + if phase == _START + x, fx, g = st.xe, T(fe), SimpleOptimization._as_u(st.xe, ge) + default_tol = sqrt(eps(T)) + abs_tol = abstol === nothing ? default_tol : max(T(abstol), default_tol) + rel_tol = reltol === nothing ? zero(T) : max(T(reltol), zero(T)) + initial_residual = maximum(abs, SimpleOptimization._projected_gradient(x, g, lb, ub)) + @set! st.x = x + @set! st.fx = fx + @set! st.g = g + @set! st.tol = max(abs_tol, rel_tol * initial_residual) + return _lbfgs_iterate(st, lb, ub, maxiters, ls) + elseif phase == _LS_ZERO + ϕ_0, dϕ_0 = fe, dot(ge, st.direction) + (isfinite(ϕ_0) && isfinite(dϕ_0) && dϕ_0 < zero(T)) || return @set st.phase = _DONE + @set! st.ϕ_0 = ϕ_0 + @set! st.dϕ_0 = dϕ_0 + @set! st.α_prev = zero(T) + @set! st.ϕ_prev = ϕ_0 + @set! st.dϕ_prev = dϕ_0 + @set! st.k = 1 + ls.maxiters ≥ 1 || return @set st.phase = _DONE + return _ls_trial(st, _LS_BRACKET, st.α_init) + elseif phase == _LS_BRACKET + ϕ_i, dϕ_i = fe, dot(ge, st.direction) + (; ϕ_0, dϕ_0, α_prev, ϕ_prev, dϕ_prev) = st + α_i, c1, c2 = st.α, ls.c1, ls.c2 + if (ϕ_i > ϕ_0 + c1 * α_i * dϕ_0) || (ϕ_i >= ϕ_prev && st.k > 1) + return _ls_zoom_start(st, α_prev, α_i, ϕ_prev, dϕ_prev, ϕ_i, dϕ_i, ls) + elseif abs(dϕ_i) <= -c2 * dϕ_0 + return _ls_accept(st, α_i, lb, ub) + elseif dϕ_i >= zero(T) + return _ls_zoom_start(st, α_i, α_prev, ϕ_i, dϕ_i, ϕ_prev, dϕ_prev, ls) + elseif α_i >= st.α_max + return _ls_accept(st, α_i, lb, ub) + end + @set! st.α_prev = α_i + @set! st.ϕ_prev = ϕ_i + @set! st.dϕ_prev = dϕ_i + @set! st.k = st.k + 1 + st.k > ls.maxiters && return @set st.phase = _DONE + return _ls_trial(st, _LS_BRACKET, min(α_i * T(2), st.α_max)) + elseif phase == _LS_ZOOM + ϕ_j, dϕ_j = fe, dot(ge, st.direction) + α_j, c1, c2 = st.α, ls.c1, ls.c2 + if (ϕ_j > st.ϕ_0 + c1 * α_j * st.dϕ_0) || (ϕ_j >= st.ϕ_lo) + @set! st.a_hi = α_j + @set! st.ϕ_hi = ϕ_j + @set! st.dϕ_hi = dϕ_j + elseif abs(dϕ_j) <= -c2 * st.dϕ_0 + return _ls_accept(st, α_j, lb, ub) + else + if dϕ_j * (st.a_hi - st.a_lo) >= zero(T) + @set! st.a_hi = st.a_lo + @set! st.ϕ_hi = st.ϕ_lo + @set! st.dϕ_hi = st.dϕ_lo + end + @set! st.a_lo = α_j + @set! st.ϕ_lo = ϕ_j + @set! st.dϕ_lo = dϕ_j + end + return _ls_zoom_trial((@set st.k = st.k + 1), ls) + elseif phase == _LS_ACCEPT + x_next, fx_next, g_next = st.xe, T(fe), SimpleOptimization._as_u(st.x, ge) + s, y = x_next - st.x, g_next - st.g + curvature = dot(s, y) + curvature_floor = sqrt(eps(T)) * max(norm(s) * norm(y), eps(T)) + if !isfinite(curvature) || curvature ≤ curvature_floor + @set! st.pseudo_iteration = 0 + else + s_hist, y_hist = SimpleOptimization._store_history( + st.s_hist, st.y_hist, st.pseudo_iteration, s, y, Val(M) + ) + @set! st.s_hist = s_hist + @set! st.y_hist = y_hist + end + @set! st.x = x_next + @set! st.fx = fx_next + @set! st.g = g_next + return _lbfgs_iterate(st, lb, ub, maxiters, ls) + end + return st +end + +# Gradients at the pending points. With ForwardDiff, one thread per (particle, direction): +# a single-partial dual seeded exactly as `ForwardDiff.gradient` seeds that direction, so +# the values match it. Other backends call `grad_f` once per particle. +function _pending_partial(f, p, st::LBFGSState{D, T}, j) where {D, T} + _isdone(st) && return zero(T) + x = st.xe + return T( + ForwardDiff.derivative( + t -> f(SVector{D}(ntuple(i -> i == j ? t : oftype(t, x[i]), Val(D))), p), x[j] + ) + ) +end + +function _gradients( + ::AutoForwardDiff, grad_f, f, p, states::AbstractArray{<:LBFGSState{D, T}} + ) where {D, T} + js = reshape(adapt(get_backend(states), collect(1:D)), D, 1) + partials = _pending_partial.(Ref(f), Ref(p), reshape(states, 1, :), js) + return vec(reinterpret(SVector{D, T}, partials)) +end +function _gradients(adtype, grad_f, f, p, states) + return map(st -> _isdone(st) ? zero(st.g) : grad_f(st.xe, p), states) +end + +function lockstep_lbfgs!( + result::AbstractArray{SVector{D, T}}, result_fx, grad_f, f, p, adtype, particles, + lb, ub, maxiters, abstol, reltol, linesearch, ::Val{M}; maxtime = nothing + ) where {D, T, M} + t_start = time() + states = map(pt -> _lbfgs_start(as_svector(pt.best_position), lb, ub, Val(M)), particles) + advance(st, fe, ge) = _lbfgs_advance(st, fe, ge, lb, ub, maxiters, abstol, reltol, linesearch) + while !mapreduce(_isdone, &, states; init = true) + fes = map(st -> _isdone(st) ? zero(T) : T(f(st.xe, p)), states) + states = advance.(states, fes, _gradients(adtype, grad_f, f, p, states)) + maxtime !== nothing && time() - t_start > maxtime && break + end + map!(st -> st.x, result, states) + map!(st -> isfinite(st.fx) ? st.fx : T(Inf), result_fx, states) + return nothing end diff --git a/test/lbfgs.jl b/test/lbfgs.jl index 450f1d5..529a38c 100644 --- a/test/lbfgs.jl +++ b/test/lbfgs.jl @@ -84,3 +84,110 @@ using ParallelParticleSwarms, Optimization, SciMLBase, StaticArrays, KernelAbstr @test sol.u[1] ≈ 0.0 atol = 1.0e-6 @test sol.objective ≈ 1.0 atol = 1.0e-6 end + +@testset "HybridPSO default lockstep L-BFGS on bounded Rosenbrock" begin + rosenbrock(x, p) = (1 - x[1])^2 + 100 * (x[2] - x[1]^2)^2 + prob = OptimizationProblem( + OptimizationFunction{false}(rosenbrock, Optimization.AutoForwardDiff()), + SVector(0.0, 0.0); lb = SVector(-2.0, -2.0), ub = SVector(2.0, 2.0) + ) + sol = solve(prob, HybridPSO(; backend = CPU()); local_maxiters = 200) + @test sol.u ≈ [1.0, 1.0] atol = 1.0e-4 + @test sol.objective < 1.0e-8 +end + +@testset "HybridPSO lockstep L-BFGS stops at maxtime" begin + rosenbrock(x, p) = (1 - x[1])^2 + 100 * (x[2] - x[1]^2)^2 + prob = OptimizationProblem( + OptimizationFunction{false}(rosenbrock, Optimization.AutoForwardDiff()), + SVector(0.0, 0.0); lb = SVector(-2.0, -2.0), ub = SVector(2.0, 2.0) + ) + opt = HybridPSO(; backend = CPU()) + solve(prob, opt; maxiters = 2, local_maxiters = 2) # compile + # No abstol and far more iterations than can run, so only maxtime ends the local phase. + t = @elapsed sol = solve(prob, opt; maxiters = 2, local_maxiters = 10^9, maxtime = 0.5) + @test t < 10 + @test isfinite(sol.objective) +end + +# The lockstep L-BFGS must visit the same points as SimpleOptimization's `_lbfgs` run in +# one thread per particle (master's kernel, kept here for this comparison). StaticArrays' +# `dot` is an `@simd` loop, so its rounding depends on what it is inlined into and even +# `_lbfgs` in a kernel and on the host differ in the last bits; for a bitwise comparison, +# the same left-to-right sum without `@simd` stands in for it during this testset. +using BlackBoxOptimizationBenchmarking, LinearAlgebra, Random +import ParallelParticleSwarms: SimpleOptimization, StrongWolfeLineSearch + +@inline function LinearAlgebra.dot(a::SVector{D, T}, b::SVector{D, T}) where {D, T <: AbstractFloat} + r = zero(T) * zero(T) + zero(T) * zero(T) + for j in 1:D + r += a[j] * b[j] + end + return r +end +const simd_free_dot = which(LinearAlgebra.dot, Tuple{SVector{2, Float64}, SVector{2, Float64}}) + +@kernel function lbfgs_run!( + grad_f, f, p, particles, result, result_fx, lb, ub, + maxiters, abstol, reltol, linesearch, history_size + ) + i = @index(Global, Linear) + @inbounds x0 = ParallelParticleSwarms.as_svector(particles[i].best_position) + u, v, _, _ = SimpleOptimization._lbfgs( + grad_f, f, p, x0, lb, ub, maxiters, abstol, reltol, + linesearch, history_size + ) + @inbounds result[i] = u + @inbounds result_fx[i] = isfinite(v) ? v : eltype(u)(Inf) +end + +@testset "Lockstep L-BFGS matches per-thread _lbfgs" begin + function compare(f, xs::Vector{SVector{D, T}}, lb, ub, adtype, maxiters, tol) where {D, T} + particles = [(; best_position = x) for x in xs] + n = length(xs) + grad_f = ParallelParticleSwarms.as_svector_grad( + ParallelParticleSwarms.instantiate_gradient(f, adtype) + ) + ls = SimpleLBFGS().linesearch + ls = StrongWolfeLineSearch(; + autodiff = ls.autodiff, c1 = T(ls.c1), c2 = T(ls.c2), + α_init = T(ls.α_init), α_max = T(ls.α_max), + maxiters = ls.maxiters, zoom_maxiters = ls.zoom_maxiters, + ) + u1, f1 = similar(xs), fill(T(Inf), n) + lbfgs_run!(CPU())( + grad_f, f, nothing, particles, u1, f1, lb, ub, + maxiters, tol, tol, ls, Val(10); ndrange = n + ) + u2, f2 = similar(xs), fill(T(Inf), n) + ParallelParticleSwarms.lockstep_lbfgs!( + u2, f2, grad_f, f, nothing, adtype, particles, lb, ub, + maxiters, tol, tol, ls, Val(10) + ) + @test u2 == u1 + @test f2 == f1 + end + + rosenbrock(x, p) = (1 - x[1])^2 + 100 * (x[2] - x[1]^2)^2 + f8 = bbob_suite(Val(10); seed = 1)[8] + bbob_f8(x, p) = f8(x) + adtypes = (Optimization.AutoForwardDiff(), Optimization.AutoEnzyme(), SciMLBase.NoAD()) + @testset "$T $(nameof(typeof(adtype)))" for T in (Float64, Float32), adtype in adtypes + Random.seed!(1) + xs = [SVector{2, T}(4 .* rand(T, 2) .- 2) for _ in 1:32] + for (lb, ub) in ( + (nothing, nothing), + (SVector{2, T}(-2, -2), SVector{2, T}(2, 2)), + (SVector{2, T}(-2, -2), SVector{2, T}(0.5, 2)), # active upper bound + ), tol in (nothing, T(1.0e-8)) + compare(rosenbrock, xs, lb, ub, adtype, 100, tol) + end + + lb, ub = fill(T(-5), SVector{10, T}), fill(T(5), SVector{10, T}) + xs = [SVector{10, T}(10 .* rand(T, 10) .- 5) for _ in 1:32] + compare(bbob_f8, xs, nothing, nothing, adtype, 50, nothing) + compare(bbob_f8, xs, lb, ub, adtype, 50, nothing) + end +end + +Base.delete_method(simd_free_dot) diff --git a/test/qa/qa.jl b/test/qa/qa.jl index 712a035..b9b840e 100644 --- a/test/qa/qa.jl +++ b/test/qa/qa.jl @@ -43,10 +43,20 @@ run_qa( :DefaultOptimizationCache, # SciMLBase, SciML/SciMLBase.jl#1482 :evaluate_f, # NonlinearSolveBase.Utils internal :evaluate_f!!, # NonlinearSolveBase.Utils internal + :derivative, # ForwardDiff, no `public` declarations :gradient, # ForwardDiff, no `public` declarations :sacollect, # StaticArrays, no `public` declarations - :_lbfgs, # SimpleOptimization kernel core, not yet public :__get_threshold, # SimpleOptimization, not yet public + # SimpleOptimization `_lbfgs` and LineSearch Strong-Wolfe internals that the + # lockstep L-BFGS in src/lbfgs.jl reuses so it runs the same arithmetic + :_as_u, + :_feasible_direction, + :_lbfgs_direction, + :_max_feasible_step, + :_project, + :_projected_gradient, + :_store_history, + :_sw_interpolate, ), ), ),