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

Long output from init(NonlinearProblem(...)) #362

Closed
jamblejoe opened this issue Feb 1, 2024 · 4 comments · Fixed by #378
Closed

Long output from init(NonlinearProblem(...)) #362

jamblejoe opened this issue Feb 1, 2024 · 4 comments · Fixed by #378
Labels
good first issue Good for newcomers

Comments

@jamblejoe
Copy link

Describe the bug 🐞

The output from init(NonlinearProblem(...)) in the REPL seems a bit excessive. I cannot copy the complete out here, as it reaches the github limitation of 65536 characters. The full output is here https://pastebin.com/RBsB8C7f.

Expected behavior

Shorter output.

Minimal Reproducible Example 👇

f(u, p) = u .* u .- 2
u0 = @SVector[1.0, 1.0]
prob = NonlinearProblem(f, u0)
init(prob)

outputs the following. This seems a bit too long for a REPL output.

julia> init(prob)
NonlinearSolve.NonlinearSolvePolyAlgorithmCache{false, 7, Tuple{NonlinearSolve.ApproximateJacobianSolveCache{true, :LineSearch, false, false, SVector{2, Float64}, SVector{2, Float64}, SVector{2, Float64}, SciMLBase.NullParameters, SVector{2, Float64}, SMatrix{2, 2, Float64, 4}, ApproximateJacobianSolveAlgorithm{false, :Broyden, NoLineSearch, Missing, NewtonDescent{Nothing, typeof(NonlinearSolve.DEFAULT_PRECS)}, NonlinearSolve.GoodBroydenUpdateRule, NonlinearSolve.NoChangeInStateReset{Nothing}, NonlinearSolve.IdentityInitialization{Nothing, NonlinearSolve.FullStructure}}, NonlinearProblem{SVector{2, Float64}, false, SciMLBase.NullParameters, NonlinearFunction{false, SciMLBase.FullSpecialize, 
.... 
!!!!TRUNCATED!!!!
....
Tracing Disabled, SciMLBase.ReturnCode.Default, false)), NonlinearSolvePolyAlgorithm for NonlinearProblem with 7 algorithms
  [1]: Broyden(
           descent = NewtonDescent(),
           update_rule = GoodBroydenUpdateRule(),
           reinit_rule = NoChangeInStateReset(),
           max_resets = 100,
           initialization = IdentityInitialization(structure = FullStructure()),
           inverse_jacobian = true
       )
  [2]: Broyden(
           descent = NewtonDescent(),
           update_rule = GoodBroydenUpdateRule(),
           reinit_rule = NoChangeInStateReset(),
           max_resets = 100,
           initialization = TrueJacobianInitialization(structure = FullStructure()),
           inverse_jacobian = true
       )
  [3]: Klement(
           descent = NewtonDescent(),
           update_rule = KlementUpdateRule(),
           reinit_rule = IllConditionedJacobianReset(),
           max_resets = 100,
           initialization = IdentityInitialization(structure = DiagonalStructure())
       )
  [4]: NewtonRaphson(
          descent = NewtonDescent()
       )
  [5]: NewtonRaphson(
          linesearch = LineSearchesJL(method = BackTracking()),
          descent = NewtonDescent()
       )
  [6]: TrustRegion(
          trustregion = GenericTrustRegionScheme(method = RadiusUpdateSchemes.Simple),
          descent = Dogleg(newton_descent = NewtonDescent(), steepest_descent = SteepestDescent())
       )
  [7]: TrustRegion(
          trustregion = GenericTrustRegionScheme(method = RadiusUpdateSchemes.Bastin),
          descent = Dogleg(newton_descent = NewtonDescent(), steepest_descent = SteepestDescent())
       ), 1)

Environment (please complete the following information):

  • Output of using Pkg; Pkg.status()
NonlinearSolve v3.5.3 `https://github.com/SciML/NonlinearSolve.jl.git#master`
  • Output of versioninfo()
julia> versioninfo()
Julia Version 1.10.0
Commit 3120989f39b (2023-12-25 18:01 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (arm64-apple-darwin22.4.0)
  CPU: 8 × Apple M1
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, apple-m1)
  Threads: 1 on 4 virtual cores

julia> 
@jamblejoe jamblejoe added the bug Something isn't working label Feb 1, 2024
@avik-pal avik-pal added good first issue Good for newcomers and removed bug Something isn't working labels Feb 2, 2024
@avik-pal
Copy link
Member

avik-pal commented Feb 2, 2024

Not really a bug 😅. But if anyone wants to create a PR for pretty printing the caches, I will gladly accept them.

@avik-pal
Copy link
Member

avik-pal commented Feb 2, 2024

We can potentially use https://github.com/curtd/AutoPrettyPrinting.jl for this

@jamblejoe
Copy link
Author

jamblejoe commented Feb 2, 2024

Agree, it's not really a bug. But it is annoying in interactive sessions and, at least for me, does not provide any useful information. If there is any in the above output, it vanishes in the vast majority of stuff, which is printed.
For comparison: imagine, whenever you define an array in Julia, it prints the whole content. Sure, you can append ; but it would be annoying. It just doesn't make sense.

So while it is probably not top priority, it should be addressed eventually.

EDIT: I forgot: The work put into this package and the whole SciML ecosystem has been awesome. Great job!

@oscardssmith
Copy link
Contributor

Specifically, for me at least, the important things to see the method and the autodiff settings, but pretty much everything else is fairly useless.

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

Successfully merging a pull request may close this issue.

3 participants