Add R2N and R2NLS solvers with HSL and QRMumps support - #347
Add R2N and R2NLS solvers with HSL and QRMumps support#347farhadrclass wants to merge 94 commits into
Conversation
dpo
left a comment
There was a problem hiding this comment.
I propose a cleaner subsolver API.
|
@dpo I have refactor the R2NLS, |
dpo
left a comment
There was a problem hiding this comment.
That looks great. Here are a few minor comments.
|
@dpo pushed the R2NLS now, |
dpo
left a comment
There was a problem hiding this comment.
Just a few more comments. Starting to look great!
|
@dpo I didn't move x_init to x0 since by doing so, we would remove the connection between LinearOp jac relying on x to be update to update the Jacobean, I can however add a new x_op to solver structure but that would allocate a memory and at the end do the same thing, In the constructor, I am linking x which will be updated in each iteration to jacobean Let me know what you think |
|
@dpo This is ready for review |
There was a problem hiding this comment.
Pull request overview
This PR adds two new inexact second-order quadratic regularization solvers—R2N (unconstrained NLP) and R2NLS (unconstrained NLS)—including new subsolver backends (HSL MA97/MA57 and QRMumps/Krylov), plus associated documentation and tests.
Changes:
- Introduces
R2N/R2NLSsolver implementations and shared subsolver interfaces. - Adds HSL and QRMumps/Krylov-based subsolvers and integrates them into the package.
- Updates tests, README, and docs; expands solver listings and benchmarks; updates dependencies/compat.
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
src/JSOSolvers.jl |
Wires new solver/subsolver modules into the package entrypoint and updates imports/deps usage. |
src/r2n_subsolver_common.jl |
Adds shared abstract interfaces/utilities for R2N/R2NLS subsolvers. |
src/R2N_subsolvers.jl |
Implements R2N subsolvers (Krylov, Shifted-LBFGS, HSL MA97/MA57). |
src/R2N.jl |
Implements the new R2N solver + parameter set. |
src/R2NLS_subsolvers.jl |
Implements R2NLS subsolvers (QRMumps + Krylov-based). |
src/R2NLS.jl |
Implements the new R2NLS solver + parameter set. |
Project.toml |
Adds new dependencies and compat bounds needed by the new solvers/subsolvers. |
README.md |
Documents the new solvers at a high level and updates usage examples. |
docs/src/index.md |
Updates dependency descriptions to include R2N/R2NLS usage of Krylov + callback_quasi_newton support. |
docs/src/solvers.md |
Adds R2N/R2NLS to solver listings and categorization tables. |
docs/src/benchmark.md |
Adds an example benchmark section for unconstrained solvers (incl. R2N). |
test/runtests.jl |
Hooks new parameter-set tests and new HSL test file into the test runner. |
test/test_solvers.jl |
Extends solver test matrix to cover R2N and R2NLS variants/subsolvers. |
test/test_hsl_subsolver.jl |
Adds HSL-backed R2N solver tests gated by LIBHSL_isfunctional(). |
test/restart.jl |
Extends restart tests to cover R2N and R2NLS solver variants/subsolvers. |
test/incompatible.jl |
Adds incompatible-problem checks for R2N and R2NLS. |
test/consistency.jl |
Adds consistency checks for R2N and R2NLS (incl. shifted-LBFGS and QRMumps). |
test/callback.jl |
Adds callback behavior tests for R2N and R2NLS. |
test/allocs.jl |
Extends allocation tests to include R2N and R2NLS solver variants. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Introduces `finalize_subsolver!` and `reset_subsolver!` to the subsolver interface. The default `reset_subsolver!` finalizes then re-initializes the subsolver, and is now called in `R2NSolver.reset!` to avoid stale state. For `HSLR2NSubsolver`, adds a `_finalized` guard flag and a `finalizer` hook to ensure HSL (Ma97) C/Fortran memory is freed exactly once, preventing double-free bugs on GC collection. Also renames `r2n_subsolver_common.jl` → `R2N_subsolver_common.jl` for naming consistency, and updates the HSL subsolver test to verify explicit cleanup and GC safety.
Introduces new second-order quadratic regularization solvers R2N and R2NLS for unconstrained and nonlinear least-squares optimization. Adds support for HSL (MA97, MA57) and QRMumps direct solvers, updates documentation and README, and extends test coverage for the new solvers. Updates dependencies and compat entries in Project.toml.