-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSolveModelNLSST_TR.jl
More file actions
37 lines (33 loc) · 942 Bytes
/
SolveModelNLSST_TR.jl
File metadata and controls
37 lines (33 loc) · 942 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
function solve_model!(
PData::PDataNLSST{S, T, Fatol, Frtol},
Jx,
Fx,
norm_∇f,
calls,
max_calls,
δ::T,
) where {S, T, Fatol, Frtol}
# cas particulier Steihaug-Toint
# ϵ = sqrt(eps(T)) # * 100.0 # old
# cgtol = max(ϵ, min(cgtol, 9 * cgtol / 10, 0.01 * norm(g)^(1.0 + PData.ζ))) # old
ζ, ξ, maxtol, mintol = PData.ζ, PData.ξ, PData.maxtol, PData.mintol
n = length(Fx)
# precision = max(1e-12, min(0.5, (norm_∇f^ζ)))
# Tolerance used in Assumption 2.6b in the paper ( ξ > 0, 0 < ζ ≤ 1 )
cgatol = PData.cgatol(ζ, ξ, maxtol, mintol, norm_∇f)
cgrtol = PData.cgrtol(ζ, ξ, maxtol, mintol, norm_∇f)
solver = PData.solver
krylov_solve!(
solver,
Jx,
Fx,
atol = cgatol,
rtol = cgrtol,
radius = δ,
itmax = min(max_calls - sum(calls), max(2 * n, 50)),
verbose = 0,
)
@. PData.d = -solver.x
PData.OK = solver.stats.solved
return PData.d, PData.λ
end