Skip to content

Commit 4825430

Browse files
committed
test: tweak ad backend tests
1 parent 2b1548c commit 4825430

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

lib/OptimizationIpopt/test/runtests.jl

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ using Symbolics
44
using Test
55
using SparseArrays
66
using ModelingToolkit
7+
using ReverseDiff
78

89
rosenbrock(x, p) = (p[1] - x[1])^2 + p[2] * (x[2] - x[1]^2)^2
910
x0 = zeros(2)
@@ -54,10 +55,11 @@ function _test_sparse_derivatives_hs071(backend, optimizer)
5455
end
5556

5657
@testset "backends" begin
57-
backends = (Optimization.AutoModelingToolkit(false, false),
58-
Optimization.AutoModelingToolkit(true, false),
59-
Optimization.AutoModelingToolkit(false, true),
60-
Optimization.AutoModelingToolkit(true, true))
58+
backends = (
59+
AutoForwardDiff(),
60+
AutoReverseDiff(),
61+
AutoSparse(AutoForwardDiff())
62+
)
6163
for backend in backends
6264
@testset "$backend" begin
6365
_test_sparse_derivatives_hs071(backend, IpoptOptimizer())
@@ -71,7 +73,7 @@ end
7173
@named sys = OptimizationSystem((x - a)^2, [x], [a];)
7274
sys = complete(sys)
7375
prob = OptimizationProblem(sys, [x => 0.0]; grad = true, hess = true)
74-
cache = init(prob, IpoptOptimizer(); print_level = 0)
76+
cache = init(prob, IpoptOptimizer(); verbose = false)
7577
@test cache isa OptimizationIpopt.IpoptCache
7678
sol = solve!(cache)
7779
@test sol.u [1.0] # ≈ [1]
@@ -105,3 +107,8 @@ end
105107

106108
@test SciMLBase.successful_retcode(sol)
107109
end
110+
111+
# Include additional tests based on Ipopt examples
112+
include("additional_tests.jl")
113+
include("advanced_features.jl")
114+
include("problem_types.jl")

0 commit comments

Comments
 (0)