Skip to content

Conversation

@MohamedLaghdafHABIBOULLAH
Copy link
Collaborator

Add monotonicity parameter to LMSolver and TRSolver with history tracking, maybe we should do the same in LMTR

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds monotonicity parameter support to both LMSolver and TRSolver with history tracking functionality. By default, both solvers remain monotone (parameter value 1), but non-monotone variants can be enabled by setting m_monotone > 1.

  • Add m_monotone parameter to both solver constructors with default value of 1
  • Implement history tracking via m_fh_hist arrays to store objective function values
  • Update objective function decrease calculations to use maximum historical values for non-monotone variants

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
src/TR_alg.jl Add monotonicity parameter and history tracking to TRSolver with updated objective decrease calculation
src/LM_alg.jl Add monotonicity parameter and history tracking to LMSolver with updated objective decrease calculation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

set_solver_specific!(stats, :smooth_obj, fk)
set_solver_specific!(stats, :nonsmooth_obj, hk)
set_solver_specific!(stats, :prox_evals, prox_evals + 1)
m_monotone > 1 && (m_fh_hist[stats.iter % (m_monotone - 1) + 1] = fk + hk)
Copy link

Copilot AI Sep 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The history update logic is duplicated in two places. Consider extracting this into a helper function or variable to reduce code duplication and improve maintainability.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe in a future PR

Co-authored-by: Copilot <[email protected]>
Copy link
Collaborator

@MaxenceGollier MaxenceGollier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All tests are failing please fix @MohamedLaghdafHABIBOULLAH

@MohamedLaghdafHABIBOULLAH
Copy link
Collaborator Author

Working on it, first the tests are not reproducible and second the opnorm is having an unstable issue...

Copy link
Collaborator

@MaxenceGollier MaxenceGollier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weird, all test produced

bpdn-with-bounds-ls-LM-l0: Error During Test at /home/runner/work/RegularizedOptimization.jl/RegularizedOptimization.jl/test/test_bounds.jl:45
  Got exception outside of a @test
  DimensionMismatch: array could not be broadcast to match destination

From the stacktrace, it seems that the problematic line is

RegularizedOptimization ~/work/RegularizedOptimization.jl/RegularizedOptimization.jl/src/LM_alg.jl:387

which is

@. u_bound_m_x = u_bound - xk

I guess this is because u_bound_m_x is wrongly initialized which is the case! (see my fix below)

Co-authored-by: Maxence Gollier <[email protected]>
@codecov
Copy link

codecov bot commented Sep 27, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.28%. Comparing base (e0f214d) to head (04beb5d).
⚠️ Report is 187 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master     #226       +/-   ##
===========================================
+ Coverage   61.53%   86.28%   +24.74%     
===========================================
  Files          11       13        +2     
  Lines        1292     1589      +297     
===========================================
+ Hits          795     1371      +576     
+ Misses        497      218      -279     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Collaborator

@MaxenceGollier MaxenceGollier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, does the feature work with m_monotone > 1 at least locally on your side ? If so, then you can rebase in my opinion

@dpo dpo merged commit a1b4a56 into JuliaSmoothOptimizers:master Sep 29, 2025
13 of 14 checks passed
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