Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
Vaibhavdixit02 committed Mar 27, 2024
1 parent 28a4d8e commit dfa1cca
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/lbfgsb.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ References
- J.L. Morales and J. Nocedal. L-BFGS-B: Remark on Algorithm 778: L-BFGS-B, FORTRAN routines for large scale bound constrained optimization (2011), to appear in ACM Transactions on Mathematical Software.
"""
@kwdef struct LBFGS
m::Int=10
m::Int = 10
end

SciMLBase.supports_opt_cache_interface(::LBFGS) = true
Expand Down Expand Up @@ -85,7 +85,6 @@ function SciMLBase.__solve(cache::OptimizationCache{
t1 = time()
stats = Optimization.OptimizationStats(; iterations = maxiters,
time = t1 - t0, fevals = maxiters, gevals = maxiters)

return SciMLBase.build_solution(cache, cache.opt, res[2], res[1], stats = stats)
end

4 changes: 2 additions & 2 deletions test/lbfgsb.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ optf = OptimizationFunction(rosenbrock, AutoForwardDiff())
prob = OptimizationProblem(optf, x0)
res = solve(prob, Optimization.LBFGS(), maxiters = 100)

@test res.u [1.0, 1.0] atol=1e-3
@test res.u[1.0, 1.0] atol=1e-3

optf = OptimizationFunction(rosenbrock, AutoZygote())
prob = OptimizationProblem(optf, x0, lb = [0.0, 0.0], ub = [0.3, 0.3])
res = solve(prob, Optimization.LBFGS(), maxiters = 100)

@test res.u [0.3, 0.09] atol=1e-3
@test res.u[0.3, 0.09] atol=1e-3

0 comments on commit dfa1cca

Please sign in to comment.