add getter functions in solve_problems#197
Conversation
There was a problem hiding this comment.
Pull request overview
This PR replaces direct field access on AbstractNLPModel instances with getter functions from the NLPModels package in solve_problems. This makes the function compatible with more general subtypes of AbstractNLPModels (such as AbstractRegularizedNLPModels) that may not expose the same internal field structure.
Changes:
- Replaced
problem.meta.name,problem.meta.nvar,problem.meta.nconwithget_name(problem),get_nvar(problem),get_ncon(problem)for problem info gathering. - Replaced direct counter field access (
problem.counters.counters/problem.counters) with dynamic getter function calls viagetfield(NLPModels, f)(problem)for both regular and NLS counters.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #197 +/- ##
==========================================
+ Coverage 76.71% 86.19% +9.48%
==========================================
Files 12 10 -2
Lines 292 297 +5
==========================================
+ Hits 224 256 +32
+ Misses 68 41 -27 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@dpo, again, this one is not on me, it looks like it has been a while since the |
@tmigot, @amontoison, @dpo
This is safer, it allows to run this with more general subtypes of
AbstractNLPModels.@dpo, this allows to use the benchmarks for
AbstractRegularizedNLPModels.Can one of you review when you have some time ?
I'd need a release afterwards. Thank you!