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

Refactor get_reason #395

Merged
merged 25 commits into from
Jun 13, 2024
Merged

Refactor get_reason #395

merged 25 commits into from
Jun 13, 2024

Conversation

kellertuer
Copy link
Member

@kellertuer kellertuer commented Jun 10, 2024

This resolves #389.
I had a bit of a boring train ride today and worked through all stopping criteria, removed .reason fields and when necessary introduced values to store obtained values being printed when generating the string.

There are two small things left

  • for the Lagrange Multiplier criterion in the bundle methods the symbols should maybe be strings since they might also be -\xi (and not just \xi like now)
  • somehow I have to check what happens with JuMP their 3 checks for reasons return now empty strings and I do no directly see why

@kellertuer kellertuer marked this pull request as ready for review June 10, 2024 10:34
src/solvers/convex_bundle_method.jl Outdated Show resolved Hide resolved
src/solvers/proximal_bundle_method.jl Outdated Show resolved Hide resolved
Copy link

codecov bot commented Jun 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.77%. Comparing base (4ec57f5) to head (ce56f47).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #395   +/-   ##
=======================================
  Coverage   99.77%   99.77%           
=======================================
  Files          72       72           
  Lines        7491     7586   +95     
=======================================
+ Hits         7474     7569   +95     
  Misses         17       17           

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

kellertuer and others added 2 commits June 10, 2024 15:11
Co-authored-by: Mateusz Baran <mateuszbaran89@gmail.com>
Co-authored-by: Mateusz Baran <mateuszbaran89@gmail.com>
@mateuszbaran
Copy link
Member

  • for the Lagrange Multiplier criterion in the bundle methods the symbols should maybe be strings since they might also be -\xi (and not just \xi like now)

That can be saved in a separate field in the criterion but leaving the string in this one place would be fine too.

src/solvers/Lanczos.jl Outdated Show resolved Hide resolved
src/plans/stopping_criterion.jl Outdated Show resolved Hide resolved
@kellertuer kellertuer added the Ready-for-Review A label for pull requests that are feature-ready label Jun 12, 2024
@kellertuer
Copy link
Member Author

Oh, I missed one solver, in CMA-ES, which has quite a few stopping criteria, they always returned a reason even if they were not active.

For now I think I did rewrite them, but testing them is still missing.
We might take the chance and change the is_active fields in these and change them to at_iteration in order to provide the iteration number in the reason (at which the stopping criterion indicated to stop).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@mateuszbaran
Copy link
Member

We might take the chance and change the is_active fields in these and change them to at_iteration in order to provide the iteration number in the reason (at which the stopping criterion indicated to stop).

Yes, I think changing it to at_iteration would make sense.

@kellertuer
Copy link
Member Author

We might take the chance and change the is_active fields in these and change them to at_iteration in order to provide the iteration number in the reason (at which the stopping criterion indicated to stop).

Yes, I think changing it to at_iteration would make sense.

Did that. Also tried to use the same tests for get_reason as for others and noticed that on construction, the StopWhenEvolutionStagnatess show method errors (not affecting tests for now, but on REPL it did); since one of the means to compute is (on construction) over an empty array.

@kellertuer
Copy link
Member Author

Hopefully also fixed the last error I mentioned above, which was mainly that the median of an empty vector does not exist, so I introduced a check and tested that as well.

@kellertuer kellertuer merged commit befce29 into master Jun 13, 2024
15 checks passed
@kellertuer kellertuer deleted the kellertuer/refactor-get-reason branch June 28, 2024 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready-for-Review A label for pull requests that are feature-ready
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Built-in stopping criterions allocate new error strings on each check, even when not required
2 participants