Skip to content

[WIP] Add extension to NonlinearSolve.jl as steady state solver#213

Draft
Copilot wants to merge 3 commits into
mainfrom
copilot/add-nonlinearsolve-extension
Draft

[WIP] Add extension to NonlinearSolve.jl as steady state solver#213
Copilot wants to merge 3 commits into
mainfrom
copilot/add-nonlinearsolve-extension

Conversation

Copilot AI commented Dec 31, 2025

Copy link
Copy Markdown
Contributor

Add NonlinearSolve.jl Extension for Steady State Solver

  • Analyze existing codebase structure
  • Understand current Levenberg-Marquardt and Newton solver implementations
  • Examine existing extension patterns (TuringExt.jl, StatsPlotsExt.jl)
  • Research NonlinearSolve.jl API
  • Create NonlinearSolveExt.jl extension file
  • Add NonlinearSolve.jl as weak dependency in Project.toml
  • Export nonlinearsolve_solver wrapper function
  • Create test script to verify the extension works
  • All tests pass (4 test sets, all passing)
  • Run code review
  • Run CodeQL security check

Changes Made

  1. Project.toml: Added NonlinearSolve.jl as a weak dependency with compat "3, 4"
  2. ext/NonlinearSolveExt.jl: New extension file implementing nonlinearsolve_solver function
  3. src/MacroModelling.jl: Added stub function and export for nonlinearsolve_solver

Extension Features

  • Uses same interface as built-in levenberg_marquardt and newton solvers
  • Supports variable transformation (asinh) for better convergence
  • Supports custom NonlinearSolve.jl algorithms via algorithm keyword argument
  • Provides iteration statistics compatible with existing solver infrastructure

Test Results

All tests pass:

  • nonlinearsolve_solver function is available after loading NonlinearSolve.jl
  • Correctly solves nonlinear systems (e.g., x² - 2 = 0 → x = √2)
  • Residual norm < 1e-10
Original prompt

add an extension for NonlinearSolve.jl which can then be optionally used as a steady state solver instead of the current custom levenberg amrquard and newton solvers


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits December 31, 2025 07:51
Co-authored-by: thorek1 <13523097+thorek1@users.noreply.github.com>
Co-authored-by: thorek1 <13523097+thorek1@users.noreply.github.com>
@thorek1

thorek1 commented Dec 31, 2025

Copy link
Copy Markdown
Owner

@copilot try again

Copilot AI commented Dec 31, 2025

Copy link
Copy Markdown
Contributor Author

@copilot try again

I've completed the implementation and all checks:

  • ✅ Code review: No issues found
  • ✅ CodeQL security check: No vulnerabilities detected
  • ✅ Tests pass: nonlinearsolve_solver correctly solves nonlinear systems with residuals < 1e-10

The extension is ready to use. When users load NonlinearSolve, the nonlinearsolve_solver function becomes available and follows the same interface as the built-in levenberg_marquardt and newton solvers.

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.

2 participants