5555 maxtime
5656 retcode:: ReturnCode.T
5757 force_stop:: Bool
58+ maxiters:: Int
59+ end
60+
61+ function Base. show (io:: IO ,
62+ cache:: NonlinearSolvePolyAlgorithmCache{pType, N} ) where {pType, N}
63+ problem_kind = ifelse (pType == :NLS , " NonlinearProblem" , " NonlinearLeastSquaresProblem" )
64+ println (io, " NonlinearSolvePolyAlgorithmCache for $(problem_kind) with $(N) algorithms" )
65+ best_alg = ifelse (cache. best == - 1 , " nothing" , cache. best)
66+ println (io, " Best algorithm: $(best_alg) " )
67+ println (io, " Current algorithm: $(cache. current) " )
68+ println (io, " nsteps: $(cache. nsteps) " )
69+ println (io, " retcode: $(cache. retcode) " )
70+ __show_cache (io, cache. caches[cache. current], 0 )
5871end
5972
6073function reinit_cache! (cache:: NonlinearSolvePolyAlgorithmCache , args... ; kwargs... )
@@ -68,11 +81,11 @@ for (probType, pType) in ((:NonlinearProblem, :NLS), (:NonlinearLeastSquaresProb
6881 algType = NonlinearSolvePolyAlgorithm{pType}
6982 @eval begin
7083 function SciMLBase. __init (prob:: $probType , alg:: $algType{N} , args... ;
71- maxtime = nothing , kwargs... ) where {N}
84+ maxtime = nothing , maxiters = 1000 , kwargs... ) where {N}
7285 return NonlinearSolvePolyAlgorithmCache {isinplace(prob), N, maxtime !== nothing} (
7386 map (solver -> SciMLBase. __init (prob, solver, args... ; maxtime, kwargs... ),
7487 alg. algs), alg, - 1 , 1 , 0 , 0.0 , maxtime,
75- ReturnCode. Default, false )
88+ ReturnCode. Default, false , maxiters )
7689 end
7790 end
7891end
124137 return Expr (:block , calls... )
125138end
126139
127- @generated function __step! (
128- cache :: NonlinearSolvePolyAlgorithmCache{iip, N} , args ... ; kwargs... ) where {iip, N}
140+ @generated function __step! (cache :: NonlinearSolvePolyAlgorithmCache{iip, N} , args ... ;
141+ kwargs... ) where {iip, N}
129142 calls = []
130143 cache_syms = [gensym (" cache" ) for i in 1 : N]
131144 for i in 1 : N
134147 $ (cache_syms[i]) = cache. caches[$ (i)]
135148 if $ (i) == cache. current
136149 __step! ($ (cache_syms[i]), args... ; kwargs... )
150+ $ (cache_syms[i]). nsteps += 1
137151 if ! not_terminated ($ (cache_syms[i]))
138152 if SciMLBase. successful_retcode ($ (cache_syms[i]). retcode)
139153 cache. best = $ (i)
157171 cache. force_stop = true
158172 return
159173 end
160- end
161- )
174+ end )
162175
163176 return Expr (:block , calls... )
164177end
0 commit comments