Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Negative Curvature Status Overriding in CR.jl #970

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/cr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ kwargs_cr = (:M, :ldiv, :radius, :linesearch, :γ, :atol, :rtol, :itmax, :timema

kaxpy!(n, α, p, x)
xNorm = knorm(n, x)
xNorm ≈ radius && (on_boundary = true)
xNorm ≈ radius > 0 && (on_boundary = true)
kaxpy!(n, -α, Mq, r) # residual
if MisI
rNorm² = kdotr(n, r, r)
Expand Down Expand Up @@ -401,11 +401,11 @@ kwargs_cr = (:M, :ldiv, :radius, :linesearch, :γ, :atol, :rtol, :itmax, :timema

# Termination status
tired && (status = "maximum number of iterations exceeded")
on_boundary && (status = "on trust-region boundary")
npcurv && (status = "nonpositive curvature")
solved && (status = "solution good enough given atol and rtol")
user_requested_exit && (status = "user-requested exit")
overtimed && (status = "time limit exceeded")
npcurv && (status = "nonpositive curvature")
on_boundary && (status = "on trust-region boundary")

# Update x
warm_start && kaxpy!(n, one(FC), Δx, x)
Expand Down
5 changes: 5 additions & 0 deletions test/test_cr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@
x, stats = cr(A, b, linesearch=true)
@test stats.status == "nonpositive curvature"

#test on trust-region boundary when radius > 0
A, b = symmetric_indefinite(FC=FC, shift = 5)
x, stats = cr(A, b, radius = one(Float64))
@test stats.status == "on trust-region boundary"

# Test Linesearch which would stop on the first call since A is negative definite
A, b = symmetric_indefinite(FC=FC; shift = 5)
x, stats = cr(A, b, linesearch=true)
Expand Down
Loading