Skip to content

Commit

Permalink
Fix reset of LBFGS. (#891)
Browse files Browse the repository at this point in the history
* Fix reset of LBFGS.

* And add a test for NelderMead.

* Test begin
  • Loading branch information
pkofod authored Dec 17, 2020
1 parent 691ba54 commit ac7e850
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/multivariate/solvers/first_order/l_bfgs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ function reset!(method, state::LBFGSState, obj, x)
value_gradient!(obj, x)
project_tangent!(method.manifold, gradient(obj), x)

pseudo_iteration = 0
state.pseudo_iteration = 0
end
function initial_state(method::LBFGS, options, d, initial_x)
T = real(eltype(initial_x))
Expand Down
4 changes: 4 additions & 0 deletions test/multivariate/solvers/constrained/fminbox.jl
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,8 @@ end
optimize(x -> sqrt(x[1]), (g,x)->(g[1]=1/(2*sqrt(x[1]))), [0.0], [10.0], [1.0], Fminbox(m))
optimize(x -> sqrt(x[1]), [0.0], [10.0], [1.0], Fminbox(m); autodiff=:forwarddiff)
end
end

@testset "#865" begin
optimize(x -> sum(x), [0.,0.0], [2.0,2.0], [1.,1.0], Fminbox(NelderMead()))
end

0 comments on commit ac7e850

Please sign in to comment.