@@ -41,23 +41,17 @@ p = [sys1.a => 6.0
41
41
sys2. b => 9.0
42
42
β => 10.0 ]
43
43
44
- prob = OptimizationProblem (combinedsys, u0, p, grad = true )
44
+ prob = OptimizationProblem (combinedsys, u0, p, grad = true , hess = true )
45
45
@test prob. f. sys === combinedsys
46
- sol = solve (prob, NelderMead ())
46
+ sol = solve (prob, Ipopt . Optimizer ())
47
47
@test sol. minimum < - 1e5
48
48
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
-
55
49
# inequality constraint, the bounds for constraints lcons !== ucons
56
50
prob = OptimizationProblem (sys2, [x => 0.0 , y => 0.0 ], [a => 1.0 , b => 100.0 ],
57
51
lcons = [- 1.0 , - 1.0 ], ucons = [500.0 , 500.0 ], grad = true ,
58
52
hess = true )
59
53
@test prob. f. sys === sys2
60
- sol = solve (prob, IPNewton (), allow_f_increases = true )
54
+ sol = solve (prob, IPNewton ())
61
55
@test sol. minimum < 1.0
62
56
sol = solve (prob, Ipopt. Optimizer ())
63
57
@test sol. minimum < 1.0
@@ -154,23 +148,17 @@ end
154
148
sys2. b => 9.0
155
149
β => 10.0 ]
156
150
157
- prob = OptimizationProblem (combinedsys, u0, p, grad = true )
151
+ prob = OptimizationProblem (combinedsys, u0, p, grad = true , hess = true )
158
152
@test prob. f. sys === combinedsys
159
- sol = solve (prob, NelderMead ())
153
+ sol = solve (prob, Ipopt . Optimizer ())
160
154
@test sol. minimum < - 1e5
161
155
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
-
168
156
# inequality constraint, the bounds for constraints lcons !== ucons
169
157
prob = OptimizationProblem (sys2, [x => 0.0 , y => 0.0 ], [a => 1.0 , b => 100.0 ],
170
158
lcons = [- 1.0 , - 1.0 ], ucons = [500.0 , 500.0 ], grad = true ,
171
159
hess = true )
172
160
@test prob. f. sys === sys2
173
- sol = solve (prob, IPNewton (), allow_f_increases = true )
161
+ sol = solve (prob, IPNewton ())
174
162
@test sol. minimum < 1.0
175
163
sol = solve (prob, Ipopt. Optimizer ())
176
164
@test sol. minimum < 1.0
0 commit comments