|
67 | 67 | end |
68 | 68 | end |
69 | 69 |
|
70 | | -@testset "MTK cache" begin |
71 | | - @variables x |
72 | | - @parameters a = 1.0 |
73 | | - @named sys = OptimizationSystem((x - a)^2, [x], [a];) |
74 | | - sys = complete(sys) |
75 | | - prob = OptimizationProblem(sys, [x => 0.0]; grad = true, hess = true) |
76 | | - cache = init(prob, IpoptOptimizer(); verbose = false) |
77 | | - @test cache isa OptimizationIpopt.IpoptCache |
78 | | - sol = solve!(cache) |
79 | | - @test sol.u ≈ [1.0] # ≈ [1] |
80 | | - |
81 | | - @test_broken begin # needs reinit/remake fixes |
82 | | - cache = Optimization.reinit!(cache; p = [2.0]) |
83 | | - sol = solve!(cache) |
84 | | - @test sol.u ≈ [2.0] # ≈ [2] |
85 | | - end |
86 | | -end |
| 70 | +# Include additional tests based on Ipopt examples |
| 71 | +include("additional_tests.jl") |
| 72 | +include("advanced_features.jl") |
| 73 | +include("problem_types.jl") |
87 | 74 |
|
88 | 75 | @testset "tutorial" begin |
89 | 76 | rosenbrock(x, p) = (p[1] - x[1])^2 + p[2] * (x[2] - x[1]^2)^2 |
|
108 | 95 | @test SciMLBase.successful_retcode(sol) |
109 | 96 | end |
110 | 97 |
|
111 | | -# Include additional tests based on Ipopt examples |
112 | | -include("additional_tests.jl") |
113 | | -include("advanced_features.jl") |
114 | | -include("problem_types.jl") |
| 98 | +@testset "MTK cache" begin |
| 99 | + @variables x |
| 100 | + @parameters a = 1.0 |
| 101 | + @named sys = OptimizationSystem((x - a)^2, [x], [a];) |
| 102 | + sys = complete(sys) |
| 103 | + prob = OptimizationProblem(sys, [x => 0.0]; grad = true, hess = true) |
| 104 | + cache = init(prob, IpoptOptimizer(); verbose = false) |
| 105 | + @test cache isa OptimizationIpopt.IpoptCache |
| 106 | + sol = solve!(cache) |
| 107 | + @test sol.u ≈ [1.0] # ≈ [1] |
| 108 | + |
| 109 | + @test_broken begin # needs reinit/remake fixes |
| 110 | + cache = Optimization.reinit!(cache; p = [2.0]) |
| 111 | + sol = solve!(cache) |
| 112 | + @test sol.u ≈ [2.0] # ≈ [2] |
| 113 | + end |
| 114 | +end |
0 commit comments