Skip to content

Commit 0490417

Browse files
authored
Merge pull request #1882 from SciML/myb/fix
Call the right solver in tests
2 parents 64fe609 + 297d674 commit 0490417

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

test/optimizationsystem.jl

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,17 @@ p = [sys1.a => 6.0
4141
sys2.b => 9.0
4242
β => 10.0]
4343

44-
prob = OptimizationProblem(combinedsys, u0, p, grad = true)
44+
prob = OptimizationProblem(combinedsys, u0, p, grad = true, hess = true)
4545
@test prob.f.sys === combinedsys
46-
sol = solve(prob, NelderMead())
46+
sol = solve(prob, Ipopt.Optimizer())
4747
@test sol.minimum < -1e5
4848

49-
prob2 = remake(prob, u0 = sol.minimizer)
50-
sol = solve(prob, BFGS(initial_stepnorm = 0.0001), allow_f_increases = true)
51-
@test sol.minimum < -1e8
52-
sol = solve(prob2, BFGS(initial_stepnorm = 0.0001), allow_f_increases = true)
53-
@test sol.minimum < -1e9
54-
5549
#inequality constraint, the bounds for constraints lcons !== ucons
5650
prob = OptimizationProblem(sys2, [x => 0.0, y => 0.0], [a => 1.0, b => 100.0],
5751
lcons = [-1.0, -1.0], ucons = [500.0, 500.0], grad = true,
5852
hess = true)
5953
@test prob.f.sys === sys2
60-
sol = solve(prob, IPNewton(), allow_f_increases = true)
54+
sol = solve(prob, IPNewton())
6155
@test sol.minimum < 1.0
6256
sol = solve(prob, Ipopt.Optimizer())
6357
@test sol.minimum < 1.0
@@ -154,23 +148,17 @@ end
154148
sys2.b => 9.0
155149
β => 10.0]
156150

157-
prob = OptimizationProblem(combinedsys, u0, p, grad = true)
151+
prob = OptimizationProblem(combinedsys, u0, p, grad = true, hess = true)
158152
@test prob.f.sys === combinedsys
159-
sol = solve(prob, NelderMead())
153+
sol = solve(prob, Ipopt.Optimizer())
160154
@test sol.minimum < -1e5
161155

162-
prob2 = remake(prob, u0 = sol.minimizer)
163-
sol = solve(prob, BFGS(initial_stepnorm = 0.0001), allow_f_increases = true)
164-
@test sol.minimum < -1e8
165-
sol = solve(prob2, BFGS(initial_stepnorm = 0.0001), allow_f_increases = true)
166-
@test sol.minimum < -1e9
167-
168156
#inequality constraint, the bounds for constraints lcons !== ucons
169157
prob = OptimizationProblem(sys2, [x => 0.0, y => 0.0], [a => 1.0, b => 100.0],
170158
lcons = [-1.0, -1.0], ucons = [500.0, 500.0], grad = true,
171159
hess = true)
172160
@test prob.f.sys === sys2
173-
sol = solve(prob, IPNewton(), allow_f_increases = true)
161+
sol = solve(prob, IPNewton())
174162
@test sol.minimum < 1.0
175163
sol = solve(prob, Ipopt.Optimizer())
176164
@test sol.minimum < 1.0

0 commit comments

Comments
 (0)