Skip to content

Feat: Class-based solvers#252

Merged
mrava87 merged 42 commits into
PyLops:devfrom
mrava87:feat-classsolver
Jul 5, 2026
Merged

Feat: Class-based solvers#252
mrava87 merged 42 commits into
PyLops:devfrom
mrava87:feat-classsolver

Conversation

@mrava87

@mrava87 mrava87 commented Apr 18, 2026

Copy link
Copy Markdown
Contributor

This PR creates class-based solvers following PyLops' pylops.optimization.basesolver.Solver base class.

As part of this effort, all function-based solvers are modified to have the same set of tolerances exposed to the users:

  • tol: tolerance on objective function change between iterations (as (cost_previous - cost_current ) / cost_previous < too directly handled in the step method
  • rtol: relative tolerance on objective function vs initial value (handled as callback)
  • xtol: absolute tolerance on change of solution - currently parked as requires a new PyLops release that fixes https://github.com/PyLops/pylops/pull/762/changes. This will simply require adding
    if xtol is not None:
         callbacks.append(ModuleUpdateCallback(xtol))
    
    to each function based solver.

Note that a breaking change is introduced in PPXA and ConsensusADMM as xtol was used to check a change in the solution, whilst now it becomes aligned with all other solvers for cost function update. Similarly, xtol in the AdaptivePrimalDual was previously used for x/y updates and is not used for cost function update (whilst a new tolerance xytol is added for x/y update).

@codacy-production

codacy-production Bot commented Apr 18, 2026

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 4 high · 7 medium

Alerts:
⚠ 11 issues (≤ 0 issues of at least minor severity)

Results:
11 new issues

Category Results
ErrorProne 4 high
Complexity 7 medium

View in Codacy

🟢 Metrics -28 complexity · 34 duplication

Metric Results
Complexity -28
Duplication 34

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@mrava87 mrava87 marked this pull request as ready for review July 1, 2026 21:39
@mrava87 mrava87 added the enhancement New feature or request label Jul 5, 2026
@mrava87 mrava87 self-assigned this Jul 5, 2026
@mrava87 mrava87 merged commit 99fc09b into PyLops:dev Jul 5, 2026
17 of 18 checks passed
@mrava87 mrava87 deleted the feat-classsolver branch July 5, 2026 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant