@@ -138,8 +138,8 @@ function SciMLBase.__init(prob::NonlinearProblem{uType, iip}, alg::FastShortcutN
138
138
)
139
139
end
140
140
141
- function SciMLBase. __solve (prob:: NonlinearProblem{uType, iip } , alg:: FastShortcutNonlinearPolyalg , args... ;
142
- kwargs... ) where {uType, iip }
141
+ function SciMLBase. __solve (prob:: NonlinearProblem{uType, false } , alg:: FastShortcutNonlinearPolyalg , args... ;
142
+ kwargs... ) where {uType}
143
143
144
144
adkwargs = alg. adkwargs
145
145
linsolve = alg. linsolve
@@ -190,6 +190,58 @@ function SciMLBase.__solve(prob::NonlinearProblem{uType, iip}, alg::FastShortcut
190
190
191
191
end
192
192
193
+ function SciMLBase. __solve (prob:: NonlinearProblem{uType, true} , alg:: FastShortcutNonlinearPolyalg , args... ;
194
+ kwargs... ) where {uType}
195
+
196
+ adkwargs = alg. adkwargs
197
+ linsolve = alg. linsolve
198
+ precs = alg. precs
199
+
200
+ sol1 = SciMLBase. __solve (prob, NewtonRaphson (;linsolve, precs, adkwargs... ), args... ; kwargs... )
201
+ if SciMLBase. successful_retcode (sol1)
202
+ return SciMLBase. build_solution (prob, alg, sol1. u, sol1. resid;
203
+ sol1. retcode, sol1. stats)
204
+ end
205
+
206
+ sol2 = SciMLBase. __solve (prob, NewtonRaphson (;linsolve, precs, linesearch= BackTracking (), adkwargs... ), args... ; kwargs... )
207
+ if SciMLBase. successful_retcode (sol2)
208
+ return SciMLBase. build_solution (prob, alg, sol2. u, sol2. resid;
209
+ sol2. retcode, sol2. stats)
210
+ end
211
+
212
+ sol3 = SciMLBase. __solve (prob, TrustRegion (;linsolve, precs, adkwargs... ), args... ; kwargs... )
213
+ if SciMLBase. successful_retcode (sol3)
214
+ return SciMLBase. build_solution (prob, alg, sol3. u, sol3. resid;
215
+ sol3. retcode, sol3. stats)
216
+ end
217
+
218
+ sol4 = SciMLBase. __solve (prob, TrustRegion (;linsolve, precs, radius_update_scheme = RadiusUpdateSchemes. Bastin, adkwargs... ), args... ; kwargs... )
219
+ if SciMLBase. successful_retcode (sol4)
220
+ return SciMLBase. build_solution (prob, alg, sol4. u, sol4. resid;
221
+ sol4. retcode, sol4. stats)
222
+ end
223
+
224
+ resids = (sol1. resid, sol2. resid, sol3. resid, sol4. resid)
225
+ minfu, idx = findmin (DEFAULT_NORM, resids)
226
+
227
+ if idx == 1
228
+ SciMLBase. build_solution (prob, alg, sol1. u, sol1. resid;
229
+ sol1. retcode, sol1. stats)
230
+ elseif idx == 2
231
+ SciMLBase. build_solution (prob, alg, sol2. u, sol2. resid;
232
+ sol2. retcode, sol2. stats)
233
+ elseif idx == 3
234
+ SciMLBase. build_solution (prob, alg, sol3. u, sol3. resid;
235
+ sol3. retcode, sol3. stats)
236
+ elseif idx == 4
237
+ SciMLBase. build_solution (prob, alg, sol4. u, sol4. resid;
238
+ sol4. retcode, sol4. stats)
239
+ else
240
+ error (" Unreachable reached, 박정석" )
241
+ end
242
+
243
+ end
244
+
193
245
# # General shared polyalg functions
194
246
195
247
function perform_step! (cache:: Union{RobustMultiNewtonCache, FastShortcutNonlinearPolyalgCache} )
0 commit comments