-
-
Notifications
You must be signed in to change notification settings - Fork 24
Implementation of a Trust-Region solver #25
Conversation
Codecov Report
@@ Coverage Diff @@
## main #25 +/- ##
==========================================
- Coverage 91.49% 91.30% -0.20%
==========================================
Files 8 9 +1
Lines 247 322 +75
==========================================
+ Hits 226 294 +68
- Misses 21 28 +7
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
src/trustRegion.jl
Outdated
Δ = Δₘₐₓ / 11 # Initial trust region radius. | ||
η₁ = 0.1 # Threshold for taking a step. | ||
η₂ = 0.25 # Threshold for shrinking the trust region. | ||
η₃ = 0.75 # Threshold for expanding the trust region. | ||
t₁ = 0.25 # Factor to shrink the trust region with. | ||
t₂ = 2.0 # Factor to expand the trust region with. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these should be kwargs in the alg
.
src/trustRegion.jl
Outdated
|
||
# Compute the ratio of the actual to predicted reduction. | ||
model = -(δ' * g + 0.5 * δ' * H * δ) | ||
r = (fₖ - fₖ₊₁) / model |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the same as model \ (fₖ - fₖ₊₁)
? \
is much more normal for this kind of thing.
src/trustRegion.jl
Outdated
if r < η₂ | ||
Δ = t₁ * Δ | ||
counter += 1 | ||
if counter > 32 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if counter > 32 | |
if counter > 32 |
That 32 should be a kwarg in the algorithm.
If you're up for it, it would be nice to add trust regions to the complete Newton method. |
This is an implementation of a Trust-Region solver.
The
raphson.jl
solver was used as a template.This source was used to some extent.
I'm happy to change things in the code or to document it better, just tell me whats needed :)