Skip to content

Commit

Permalink
Add tests related to issue #19
Browse files Browse the repository at this point in the history
  • Loading branch information
emmt committed Jan 29, 2024
1 parent 46b84ee commit 7ca1e4b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,19 @@ end
end
end
end

@testset "User examples" begin
# See https://github.com/libprima/PRIMA.jl/issues/19
let cost_func(x) = sum(abs2, x), x0 = randn(4),
opts = (rhobeg=0.1, rhoend=1e-8)
@testset "$algo" for algo in (:uobyqa, :newuoa, :bobyqa,
:cobyla, :lincoa, :prima)
optim = optimizer(algo)
x1, res = @inferred optim(cost_func, x0; opts...)
@test maximum(abs.(x1)) 1e-8
end
end
end
end

nothing

0 comments on commit 7ca1e4b

Please sign in to comment.