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 2 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
2 changes: 1 addition & 1 deletion src/cr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -402,10 +402,10 @@ 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")

# 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 nonpositive curvature when radius > 0
A, b = symmetric_indefinite(FC=FC, shift = 5)
x, stats = cr(A, b, radius = one(Float64))
@test stats.status == "nonpositive curvature"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, but in trust-region methods, we would want “on trust-region boundary” to be the final status.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dpo so the issue here is that we want “on trust-region boundary” be the status?
In CR the flag is only set once

 elseif pAp > 0 && ρ > 0  # no negative curvature
          (verbose > 0) && @printf(iostream, "positive curvatures along p and r. pᴴAp = %8.1e and rᴴAr = %8.1e\n", pAp, ρ)
          α = ρ / kdotr(n, q, Mq)
          if α  t1
            α = t1
            on_boundary = true
          end

which is not the case in this test, since A is a diagonal with very -ve values

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dpo ?


# 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