@@ -52,10 +52,10 @@ if VERSION >= v"1.7"
5252 @test (@ballocated benchmark_scalar (sf, csu0)) == 0
5353end
5454
55- # TrustRegion
55+ # SimpleTrustRegion
5656function benchmark_scalar (f, u0)
5757 probN = NonlinearProblem {false} (f, u0)
58- sol = (solve (probN, TrustRegion (10.0 )))
58+ sol = (solve (probN, SimpleTrustRegion (10.0 )))
5959end
6060
6161sol = benchmark_scalar (sf, csu0)
@@ -69,7 +69,7 @@ using ForwardDiff
6969f, u0 = (u, p) -> u .* u .- p, @SVector [1.0 , 1.0 ]
7070
7171for alg in [SimpleNewtonRaphson (), Broyden (), Klement (),
72- TrustRegion (10.0 )]
72+ SimpleTrustRegion (10.0 )]
7373 g = function (p)
7474 probN = NonlinearProblem {false} (f, csu0, p)
7575 sol = solve (probN, alg, abstol = 1e-9 )
8585# Scalar
8686f, u0 = (u, p) -> u * u - p, 1.0
8787for alg in [SimpleNewtonRaphson (), Broyden (), Klement (),
88- TrustRegion (10.0 )]
88+ SimpleTrustRegion (10.0 )]
8989 g = function (p)
9090 probN = NonlinearProblem {false} (f, oftype (p, u0), p)
9191 sol = solve (probN, alg)
@@ -127,7 +127,7 @@ for alg in [Bisection(), Falsi()]
127127end
128128
129129for alg in [SimpleNewtonRaphson (), Broyden (), Klement (),
130- TrustRegion (10.0 )]
130+ SimpleTrustRegion (10.0 )]
131131 global g, p
132132 g = function (p)
133133 probN = NonlinearProblem {false} (f, 0.5 , p)
@@ -144,8 +144,8 @@ probN = NonlinearProblem(f, u0)
144144
145145@test solve (probN, SimpleNewtonRaphson ()). u[end ] ≈ sqrt (2.0 )
146146@test solve (probN, SimpleNewtonRaphson (; autodiff = false )). u[end ] ≈ sqrt (2.0 )
147- @test solve (probN, TrustRegion (10.0 )). u[end ] ≈ sqrt (2.0 )
148- @test solve (probN, TrustRegion (10.0 ; autodiff = false )). u[end ] ≈ sqrt (2.0 )
147+ @test solve (probN, SimpleTrustRegion (10.0 )). u[end ] ≈ sqrt (2.0 )
148+ @test solve (probN, SimpleTrustRegion (10.0 ; autodiff = false )). u[end ] ≈ sqrt (2.0 )
149149@test solve (probN, Broyden ()). u[end ] ≈ sqrt (2.0 )
150150@test solve (probN, Klement ()). u[end ] ≈ sqrt (2.0 )
151151
@@ -159,9 +159,9 @@ for u0 in [1.0, [1, 1.0]]
159159 @test solve (probN, SimpleNewtonRaphson ()). u ≈ sol
160160 @test solve (probN, SimpleNewtonRaphson (; autodiff = false )). u ≈ sol
161161
162- @test solve (probN, TrustRegion (10.0 )). u ≈ sol
163- @test solve (probN, TrustRegion (10.0 )). u ≈ sol
164- @test solve (probN, TrustRegion (10.0 ; autodiff = false )). u ≈ sol
162+ @test solve (probN, SimpleTrustRegion (10.0 )). u ≈ sol
163+ @test solve (probN, SimpleTrustRegion (10.0 )). u ≈ sol
164+ @test solve (probN, SimpleTrustRegion (10.0 ; autodiff = false )). u ≈ sol
165165
166166 @test solve (probN, Broyden ()). u ≈ sol
167167
@@ -205,7 +205,7 @@ sol = solve(probB, Bisection(; exact_left = true, exact_right = true); immutable
205205@test f (sol. right, nothing ) >= 0.0
206206@test f (prevfloat (sol. right), nothing ) <= 0.0
207207
208- # Test that `TrustRegion ` passes a test that `SimpleNewtonRaphson` fails on.
208+ # Test that `SimpleTrustRegion ` passes a test that `SimpleNewtonRaphson` fails on.
209209u0 = [- 10.0 , - 1.0 , 1.0 , 2.0 , 3.0 , 4.0 , 10.0 ]
210210global g, f
211211f = (u, p) -> 0.010000000000000002 .+
@@ -219,15 +219,15 @@ f = (u, p) -> 0.010000000000000002 .+
219219.- p
220220g = function (p)
221221 probN = NonlinearProblem {false} (f, u0, p)
222- sol = solve (probN, TrustRegion (100.0 ))
222+ sol = solve (probN, SimpleTrustRegion (100.0 ))
223223 return sol. u
224224end
225225p = [0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 ]
226226u = g (p)
227227f (u, p)
228228@test all (f (u, p) .< 1e-10 )
229229
230- # Test kwars in `TrustRegion `
230+ # Test kwars in `SimpleTrustRegion `
231231max_trust_radius = [10.0 , 100.0 , 1000.0 ]
232232initial_trust_radius = [10.0 , 1.0 , 0.1 ]
233233step_threshold = [0.0 , 0.01 , 0.25 ]
@@ -242,14 +242,14 @@ list_of_options = zip(max_trust_radius, initial_trust_radius, step_threshold,
242242 expand_factor, max_shrink_times)
243243for options in list_of_options
244244 local probN, sol, alg
245- alg = TrustRegion (options[1 ];
246- initial_trust_radius = options[2 ],
247- step_threshold = options[3 ],
248- shrink_threshold = options[4 ],
249- expand_threshold = options[5 ],
250- shrink_factor = options[6 ],
251- expand_factor = options[7 ],
252- max_shrink_times = options[8 ])
245+ alg = SimpleTrustRegion (options[1 ];
246+ initial_trust_radius = options[2 ],
247+ step_threshold = options[3 ],
248+ shrink_threshold = options[4 ],
249+ expand_threshold = options[5 ],
250+ shrink_factor = options[6 ],
251+ expand_factor = options[7 ],
252+ max_shrink_times = options[8 ])
253253
254254 probN = NonlinearProblem (f, u0, p)
255255 sol = solve (probN, alg)
0 commit comments