Skip to content

Commit

Permalink
add cold skewed start
Browse files Browse the repository at this point in the history
  • Loading branch information
bzhangcw committed Apr 16, 2024
1 parent 01b4b50 commit 8bc2bbf
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/algorithms/hsodm.jl
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ function Base.show(io::IO, t::T) where {T<:HSODMIteration}
@printf io " inner iteration limit := %s\n" t.itermax
@printf io " line-search algorithm := %s\n" t.linesearch
@printf io " adaptive strategy := %s\n" t.adaptive
@printf io " eigenvalue init := %s\n" t.direction
if t.hvp !== nothing
@printf io " second-order info := using provided Hessian-vector product\n"
elseif t.H !== nothing
Expand Down
13 changes: 9 additions & 4 deletions src/utilities/homogeneous.jl
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,13 @@ function _eigenvalue(
n = length(state.x)
# _reltol = state.ϵ > 1e-4 ? 1e-5 : iter.eigtol
# _tol = _reltol * state.ϵ
_tol = state.ϵ > 1e-3 ? 1e-5 : max(iter.eigtol, 1e-3 * state.ϵ)
_tol = state.ϵ > 1e-3 ? 1e-5 : max(iter.eigtol, 1e-2 * state.ϵ)
if bg == :krylov
if iter.direction == :cold
vals, vecs, info = KrylovKit.eigsolve(B, n + 1, 1, :SR, Float64; tol=_tol, issymmetric=true, eager=true)
q = zeros(n+1)
q[end]=1.0
# vals, vecs, info = KrylovKit.eigsolve(B, n + 1, 1, :SR, Float64; tol=_tol, issymmetric=true, eager=true)
vals, vecs, info = KrylovKit.eigsolve(B, q, 1, :SR; tol=_tol, issymmetric=true, eager=true)
else
vals, vecs, info = KrylovKit.eigsolve(B, state.ξ, 1, :SR; tol=_tol, issymmetric=true, eager=true)
end
Expand All @@ -285,11 +288,13 @@ end


function _eigenvalue(f::Function, iter, state; bg=:krylov)
_tol = state.ϵ > 1e-3 ? 1e-5 : max(iter.eigtol, 1e-3 * state.ϵ)
_tol = state.ϵ > 1e-3 ? 1e-5 : max(iter.eigtol, 1e-2 * state.ϵ)
if bg == :krylov
if iter.direction == :cold
n = length(state.x)
vals, vecs, info = KrylovKit.eigsolve(f, n + 1, 1, :SR, Float64; tol=_tol, issymmetric=true, eager=true)
q = zeros(n+1)
q[end]=1.0
vals, vecs, info = KrylovKit.eigsolve(f, q, 1, :SR; tol=_tol, issymmetric=true, eager=true)
else
vals, vecs, info = KrylovKit.eigsolve(f, state.ξ, 1, :SR; tol=_tol, issymmetric=true, eager=true)
end
Expand Down
2 changes: 1 addition & 1 deletion src/utilities/trustregion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const lsa::HagerZhangEx = HagerZhangEx(
const lsb::BackTrackingEx = BackTrackingEx(
ρ_hi=0.8,
ρ_lo=0.1,
order=2
order=3
)

@doc raw"""
Expand Down
2 changes: 1 addition & 1 deletion test/tools.jl
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ if add_hsodm
x0=copy(x), f=loss, g=g,
linesearch=:hagerzhang,
# linesearch=:backtrack,
direction=:warm,
direction=:cold,
adaptive=:mishchenko,
kwargs...,
options...
Expand Down

0 comments on commit 8bc2bbf

Please sign in to comment.