@@ -21,10 +21,10 @@ using SparseArrays
2121 prob = OptimizationProblem (optfunc, x0, p)
2222
2323 # Test with tight tolerances
24- sol = solve (prob, IpoptOptimizer ();
25- reltol = 1e-10 ,
24+ sol = solve (prob, IpoptOptimizer (
2625 acceptable_tol = 1e-8 ,
27- acceptable_iter = 5 )
26+ acceptable_iter = 5 );
27+ reltol = 1e-10 )
2828
2929 @test SciMLBase. successful_retcode (sol)
3030 @test sol. u ≈ [1.0 , 1.0 ] atol= 1e-8
@@ -46,8 +46,8 @@ using SparseArrays
4646 lcons = [0.0 , 0.0 ],
4747 ucons = [0.0 , 0.0 ])
4848
49- sol = solve (prob, IpoptOptimizer ();
50- constr_viol_tol = 1e-8 )
49+ sol = solve (prob, IpoptOptimizer (
50+ constr_viol_tol = 1e-8 ))
5151
5252 @test SciMLBase. successful_retcode (sol)
5353 @test sol. u[1 ] + sol. u[2 ] ≈ 2.0 atol= 1e-7
@@ -64,9 +64,11 @@ using SparseArrays
6464 prob = OptimizationProblem (optfunc, [0.1 , 0.1 ], nothing )
6565
6666 # Run with derivative test level 1 (first derivatives only)
67- sol = solve (prob, IpoptOptimizer ();
68- derivative_test = " first-order" ,
69- derivative_test_tol = 1e-4 )
67+ sol = solve (prob, IpoptOptimizer (
68+ additional_options = Dict (
69+ " derivative_test" => " first-order" ,
70+ " derivative_test_tol" => 1e-4
71+ )))
7072
7173 @test SciMLBase. successful_retcode (sol)
7274 end
@@ -92,8 +94,8 @@ using SparseArrays
9294 prob = OptimizationProblem (optfunc, x0, p)
9395
9496 # Test with different linear solver strategies
95- sol = solve (prob, IpoptOptimizer ();
96- linear_solver = " mumps" ) # or "ma27", "ma57", etc. if available
97+ sol = solve (prob, IpoptOptimizer (
98+ linear_solver = " mumps" )) # or "ma27", "ma57", etc. if available
9799
98100 @test SciMLBase. successful_retcode (sol)
99101 # Check that odd indices are close to 1
@@ -117,8 +119,8 @@ using SparseArrays
117119 ucons = [0.0 ])
118120
119121 # Solve with automatic scaling
120- sol = solve (prob, IpoptOptimizer ();
121- nlp_scaling_method = " gradient-based" )
122+ sol = solve (prob, IpoptOptimizer (
123+ nlp_scaling_method = " gradient-based" ))
122124
123125 @test SciMLBase. successful_retcode (sol)
124126 # Check constraint satisfaction
@@ -145,8 +147,10 @@ using SparseArrays
145147 lcons = [0.0 , 0.0 ],
146148 ucons = [0.0 , 0.0 ])
147149
148- sol = solve (prob, IpoptOptimizer ();
149- required_infeasibility_reduction = 0.9 )
150+ sol = solve (prob, IpoptOptimizer (
151+ additional_options = Dict (
152+ " required_infeasibility_reduction" => 0.9
153+ )))
150154
151155 if SciMLBase. successful_retcode (sol)
152156 # Check constraint satisfaction if successful
@@ -167,16 +171,16 @@ using SparseArrays
167171 prob = OptimizationProblem (optfunc, x0, p)
168172
169173 # Test adaptive mu strategy
170- sol = solve (prob, IpoptOptimizer ();
174+ sol = solve (prob, IpoptOptimizer (
171175 mu_strategy = " adaptive" ,
172- mu_init = 0.1 )
176+ mu_init = 0.1 ))
173177
174178 @test SciMLBase. successful_retcode (sol)
175179 @test sol. u ≈ [1.0 , 1.0 ] atol= 1e-4
176180
177181 # Test monotone mu strategy
178- sol2 = solve (prob, IpoptOptimizer ();
179- mu_strategy = " monotone" )
182+ sol2 = solve (prob, IpoptOptimizer (
183+ mu_strategy = " monotone" ))
180184
181185 @test SciMLBase. successful_retcode (sol2)
182186 @test sol2. u ≈ [1.0 , 1.0 ] atol= 1e-4
@@ -194,8 +198,10 @@ using SparseArrays
194198 lb = [- Inf , 2.0 , - Inf ],
195199 ub = [Inf , 2.0 , Inf ])
196200
197- sol = solve (prob, IpoptOptimizer ();
198- fixed_variable_treatment = " make_parameter" )
201+ sol = solve (prob, IpoptOptimizer (
202+ additional_options = Dict (
203+ " fixed_variable_treatment" => " make_parameter"
204+ )))
199205
200206 @test SciMLBase. successful_retcode (sol)
201207 @test sol. u ≈ [1.0 , 2.0 , 3.0 ] atol= 1e-6
@@ -213,9 +219,9 @@ using SparseArrays
213219 prob = OptimizationProblem (optfunc, zeros (n), nothing ;
214220 sense = Optimization. MaxSense)
215221
216- sol = solve (prob, IpoptOptimizer ();
222+ sol = solve (prob, IpoptOptimizer (
217223 acceptable_tol = 1e-4 ,
218- acceptable_iter = 10 ,
224+ acceptable_iter = 10 );
219225 maxiters = 50 )
220226
221227 @test SciMLBase. successful_retcode (sol)
240246 end
241247
242248 @testset " Timing statistics" begin
243- sol = solve (prob, IpoptOptimizer (); print_timing_statistics = " yes" )
249+ sol = solve (prob, IpoptOptimizer (print_timing_statistics = " yes" ) )
244250 @test SciMLBase. successful_retcode (sol)
245251 end
246252end
0 commit comments