Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

Conversation

Deltadahl
Copy link
Contributor

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 :)

@codecov
Copy link

codecov bot commented Jan 10, 2023

Codecov Report

Merging #25 (95b2f40) into main (d6e4633) will decrease coverage by 0.19%.
The diff coverage is 97.33%.

@@            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     
Impacted Files Coverage Δ
src/SimpleNonlinearSolve.jl 0.00% <ø> (ø)
src/trustRegion.jl 96.66% <96.66%> (ø)
src/utils.jl 100.00% <100.00%> (ø)
src/falsi.jl 84.09% <0.00%> (-11.37%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Comment on lines 49 to 54
Δ = Δₘₐₓ / 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.
Copy link
Member

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.


# Compute the ratio of the actual to predicted reduction.
model = -(δ' * g + 0.5 * δ' * H * δ)
r = (fₖ - fₖ₊₁) / model
Copy link
Member

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.

if r < η₂
Δ = t₁ * Δ
counter += 1
if counter > 32
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if counter > 32
if counter > 32

That 32 should be a kwarg in the algorithm.

@ChrisRackauckas ChrisRackauckas merged commit 10ce0fa into SciML:main Jan 11, 2023
@ChrisRackauckas
Copy link
Member

If you're up for it, it would be nice to add trust regions to the complete Newton method.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants