-
Notifications
You must be signed in to change notification settings - Fork 21
Add counter validation against CUTEst native reporting #463
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
base: main
Are you sure you want to change the base?
Conversation
…n permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Potential fix for code scanning alert no. 8: Workflow does not contain permissions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks ! I made a couple of comments.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #463 +/- ##
===========================================
- Coverage 89.11% 73.95% -15.16%
===========================================
Files 5 7 +2
Lines 790 1678 +888
===========================================
+ Hits 704 1241 +537
- Misses 86 437 +351 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-authored-by: Tangi Migot <tangi.migot@gmail.com>
Co-authored-by: Tangi Migot <tangi.migot@gmail.com>
Co-authored-by: Tangi Migot <tangi.migot@gmail.com>
# CUTEst's constrained problem implementation has specific counting behavior | ||
@test julia_increments.neval_obj == 1 | ||
@test cutest_increments.neval_obj == 0 # CUTEst doesn't count obj in constrained setup | ||
|
||
@test julia_increments.neval_cons == 1 | ||
@test cutest_increments.neval_cons == 2 # CUTEst counts 1 extra constraint call | ||
|
||
@test julia_increments.neval_jac == 1 | ||
@test cutest_increments.neval_jac == 2 # CUTEst counts 1 extra jacobian call | ||
|
||
@test julia_increments.neval_hess == 1 | ||
@test cutest_increments.neval_hess == 2 # CUTEst counts 1 extra hessian call | ||
|
||
@test julia_increments.neval_jprod == 1 | ||
@test cutest_increments.neval_jprod == 2 # CUTEst counts 1 extra jprod call |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@amontoison Any idea why we have these differences?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The differences between the NLPModels.jl counters and CUTEst’s native counters come from how each system tracks function evaluations internally.
- NLPModels.jl increments its counters every time a Julia wrapper function is called, so it reflects exactly what the user code requests.
- CUTEst, on the other hand, sometimes counts extra internal calls (for things like Hessian, Jacobian, or constraint evaluations) or may skip counting certain evaluations, depending on whether the problem is constrained or unconstrained and how its Fortran backend is implemented.
- For example, in constrained problems, CUTEst might not increment the objective counter, or it might count an extra call for Jacobian or constraint evaluations due to its internal logic. These differences are expected and are documented in the test file.
Co-authored-by: Tangi Migot <tangi.migot@gmail.com>
test_counters.jl """
@amontoison please see the checks below. |
@amontoison any thoughts on this. |
This PR implements comprehensive validation of evaluation counters by comparing CUTEst.jl's internal counter tracking with CUTEst's native reporting functions.
test/test_counters.jl
: Complete test suite for counter validationget_cutest_counters()
: Utility function that extracts counters from CUTEst's native reporting functionstest_counter_validation()
: Main test function with separate validation for unconstrained and constrained problemsCloses #278
Closes #465