11abstract type AbstractInitialLinesearchGuess end
22
3+ struct ConstantInitialGuess{TF} <: AbstractInitialLinesearchGuess
4+ α:: TF
5+ end
6+ ConstantInitialGuess () = ConstantInitialGuess (1.0 )
7+
8+ function (cig:: ConstantInitialGuess )(
9+ mp:: AbstractManoptProblem , s:: AbstractManoptSolverState , :: Int , l:: Real , η; kwargs...
10+ )
11+ return cig. α
12+ end
13+
14+
315struct ArmijoInitialGuess <: AbstractInitialLinesearchGuess end
416
517"""
@@ -49,10 +61,31 @@ _doc_stepsize_initial_guess(default = "") = """
4961
5062"""
5163
52- default_point_norm ( :: AbstractManifold , p) = one ( number_eltype (p))
53- default_point_norm ( :: DefaultManifold , p) = norm (p, Inf )
64+ """
65+ default_point_distance(::AbstractManifold, p )
5466
55- default_vector_norm (M:: AbstractManifold , p, X) = norm (M, p, X)
67+ The default Hager-Zhang guess for distance between `p` the solution to the optimization
68+ problem. The default is 0, which deactivates heuristic I0 (a).
69+ On each manifold with `default_point_distance`, you need to also implement `default_vector_norm`.
70+ """
71+ default_point_distance (:: AbstractManifold , p) = zero (number_eltype (p))
72+
73+ """
74+ default_point_distance(::DefaultManifold, p)
75+
76+ Following [HagerZhang:2006:2](@cite), the expected distance to the optimal solution from `p`
77+ on `DefaultManifold` is the `Inf` norm of `p`.
78+ """
79+ default_point_distance (:: DefaultManifold , p) = norm (p, Inf )
80+
81+ """
82+ default_point_distance(::AbstractManifold, p)
83+
84+ The default Hager-Zhang guess for distance between `p` the solution to the optimization
85+ problem along the descent direction. There is no default implementation because it is only
86+ needed for manifolds with a specific `default_point_distance` method.
87+ """
88+ default_vector_norm (M:: AbstractManifold , p, X)
5689default_vector_norm (:: DefaultManifold , p, X) = norm (p, Inf )
5790
5891
@@ -69,7 +102,7 @@ struct HagerZhangInitialGuess{TF <: Real, TPN, TVN} <: AbstractInitialLinesearch
69102 ψ2:: TF
70103 constant_guess:: TF
71104 quadstep:: Bool
72- point_norm :: TPN
105+ point_distance :: TPN
73106 vector_norm:: TVN
74107 zero_abstol:: TF
75108 alphamax:: TF
@@ -82,14 +115,14 @@ function HagerZhangInitialGuess{TF}(;
82115 ψ2:: TF = 2.0 ,
83116 constant_guess:: TF = NaN ,
84117 quadstep:: Bool = true ,
85- point_norm :: TPN = default_point_norm ,
118+ point_distance :: TPN = default_point_distance ,
86119 vector_norm:: TVN = default_vector_norm,
87120 zero_abstol:: TF = eps (TF),
88121 alphamax:: TF = Inf ,
89122 ) where {TF <: Real , TPN, TVN}
90123 return HagerZhangInitialGuess {TF, TPN, TVN} (
91124 ψ0, ψ1, ψ2, constant_guess, quadstep,
92- point_norm , vector_norm, zero_abstol, alphamax
125+ point_distance , vector_norm, zero_abstol, alphamax
93126 )
94127end
95128
@@ -106,12 +139,12 @@ function (hzi::HagerZhangInitialGuess{TF})(
106139 alphamax = min (hzi. alphamax, max_stepsize (M, p))
107140
108141 if k == 1
109- pn = hzi. point_norm (M, p)
110- ηn = hzi. vector_norm (M, p, η)
142+ pn = hzi. point_distance (M, p)
111143 # Step I0
112144 if isnan (hzi. constant_guess)
113145 if pn > hzi. zero_abstol
114146 # I0.(a)
147+ ηn = hzi. vector_norm (M, p, η)
115148 return min (hzi. ψ0 * pn / ηn, alphamax)
116149 elseif abs_lf0 > hzi. zero_abstol
117150 # I0.(b)
0 commit comments