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

Add new Broyden version: #287

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JohannesNaegele
Copy link

In my use case the approximate norm descents slows down the computation by factor 10. Moreover, I can just initialize the inverse Jacobian with it's true value at the initial x without noticable additional costs.

I, however, don't know whether this is the proper approach to modify the API...

Initialize Jinv with autodiff and avoid norm descent
@ChrisRackauckas
Copy link
Contributor

Interesting, what's the timing vs the Broydens in NonlinearSolve.jl? https://docs.sciml.ai/NonlinearSolve/stable/solvers/NonlinearSystemSolvers/

@JohannesNaegele
Copy link
Author

Interesting, what's the timing vs the Broydens in NonlinearSolve.jl? https://docs.sciml.ai/NonlinearSolve/stable/solvers/NonlinearSystemSolvers/

Good point, I should probably just switch. TrustRegion() is about as fast as my NLsolve-modification (0.5s), however GeneralBroyden() is quite slow (3.5s). For LimitedMemoryBroyden() I get a DomainError; the solvers from SimpleNonlinearSolve apparently support only out-of-place functions (which took me quite some time to figure out lol).

@ChrisRackauckas
Copy link
Contributor

ChrisRackauckas commented Nov 15, 2023

@avik-pal take a look?

@avik-pal
Copy link

For LimitedMemoryBroyden() I get a DomainError

LimitedMemoryBroyden diverging is not surprising.

Moreover, I can just initialize the inverse Jacobian with it's true value at the initial x without noticable additional costs.

We can support a version of Broyden that initializes and resets with the true jacobian, without much difficulties. And I feel that can be the default for small problems that are diffentiable.

he solvers from SimpleNonlinearSolve apparently support only out-of-place functions (which took me quite some time to figure out lol).

SimpleNonlinearSolve supporting in place problems will land in the next few weeks (hopefully)

however GeneralBroyden() is quite slow (3.5s).

Is the GeneralBroyden problem, that it is not converging and hence taking 3.5s? (you can check with sol.retcode)

If you have the test problem somewhere public, I can take a look

@JohannesNaegele
Copy link
Author

We can support a version of Broyden that initializes and resets with the true jacobian, without much difficulties. And I feel that can be the default for small problems that are diffentiable.

That would be great!

however GeneralBroyden() is quite slow (3.5s).

Is the GeneralBroyden problem, that it is not converging and hence taking 3.5s? (you can check with sol.retcode)

If you have the test problem somewhere public, I can take a look

I was unprecise in the sense that the reported times reflect 350 recursive solutions of a NL system. But nevertheless your guess is correct: Many of these solutions show no convergence. When I set maxiters to 350 (magic number copied from R package that implements the same economic models) the time reduces to 1.5s which is nevertheless still much slower than trust region.
https://github.com/JohannesNaegele/Consistent.jl/blob/1ffc0e966d8f0b9726c0f9f74b9785c2e1d69014/src/models/GROWTH.jl

@avik-pal
Copy link

Awesome, I will take a look at it!

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

Successfully merging this pull request may close these issues.

3 participants