Skip to content

Commit

Permalink
Fix bug in add default options (#1043)
Browse files Browse the repository at this point in the history
  • Loading branch information
pkofod authored Jun 12, 2023
1 parent 1fc8255 commit 1f79069
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/multivariate/optimize/interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ end
default_options(method::AbstractOptimizer) = NamedTuple()

function add_default_opts!(opts::Dict{Symbol, Any}, method::AbstractOptimizer)
for newopt in default_options(method)
for newopt in pairs(default_options(method))
if !haskey(opts, newopt[1])
opts[newopt[1]] = newopt[2]
end
Expand Down
5 changes: 5 additions & 0 deletions test/multivariate/optimize/interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,8 @@ end
@test res.method isa Optim.KrylovTrustRegion

end

@testset "issue 1041 and 1038" begin
g(x) = -exp(-(x-pi)^2)
@test_nowarn optimize(x->g(x[1]),[0.],method = AcceleratedGradientDescent())
end

0 comments on commit 1f79069

Please sign in to comment.