Add warnings when dimension is modified#406
Add warnings when dimension is modified#406arnavk23 wants to merge 6 commits intoJuliaSmoothOptimizers:mainfrom
Conversation
…d on NZF1, spmsrtls, and bearing - NZF1: Warn when n is not a multiple of 13 (adjusted to nearest multiple) - spmsrtls: Warn when n is adjusted due to minimum dimension requirement (n >= 100) - bearing: Warn when grid dimensions are adjusted to ensure nx > 0 and ny > 0 These warnings follow the pattern already established in dixmaan* problems.
There was a problem hiding this comment.
Pull request overview
This pull request adds warning messages to three optimization problems when their dimension parameters are automatically adjusted. The changes ensure users are informed when the problem dimensions differ from their input values.
Changes:
- Added warnings to NZF1 when n is adjusted to be a multiple of 13
- Added warnings to spmsrtls when n is adjusted due to minimum dimension requirements (n must result in at least 100 variables)
- Added warnings to bearing when grid dimensions nx or ny are adjusted to ensure they are positive
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/ADNLPProblems/NZF1.jl | Adds warnings before dimension adjustment in both nlp and nls variants to alert when n is not a multiple of 13 |
| src/ADNLPProblems/spmsrtls.jl | Adds dimension tracking and warnings after adjustment in both nlp and nls variants, showing original and adjusted values |
| src/ADNLPProblems/bearing.jl | Adds validation and warning for grid dimensions to ensure nx > 0 and ny > 0 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Created @adjust_nvar_warn macro in ADNLPProblems module to standardize
dimension adjustment warnings across all problems
- Updated warning messages to consistently show both original and adjusted
values following pattern: 'problem_name: number of variables adjusted
from {n_orig} to {n}'
- Applied macro to all problems with dimension adjustments:
- NZF1 (multiple of 13)
- spmsrtls (adjusted formula)
- chainwoo (multiple of 4, both :nlp and :nls variants)
- woods (multiple of 4)
- srosenbr (multiple of 2)
- catenary (multiple of 3, minimum 6)
- clplatea, clplateb, clplatec (perfect squares)
- fminsrf2 (minimum 4, then perfect square)
- powellsg (multiple of 4, both :nlp and :nls variants)
- watson (clamped between 2 and 31, both :nlp and :nls variants)
Addresses issue JuliaSmoothOptimizers#354
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Ensures consistent warning messages between :nlp and :nls variants, showing both original and adjusted dimension values.
|
@tmigot whenever you are free, do take a look. Thanks! |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #406 +/- ##
===========================================
- Coverage 99.80% 54.41% -45.39%
===========================================
Files 1084 1138 +54
Lines 12319 13406 +1087
===========================================
- Hits 12295 7295 -5000
- Misses 24 6111 +6087 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| @adjust_nvar_warn("woods", n_orig, n) | ||
| ``` | ||
| """ | ||
| macro adjust_nvar_warn(problem_name, n_orig, n) |
There was a problem hiding this comment.
Why is it only in the ADNLPProblems and not in the PureJump ?
| push!(msg_parts, "ny from $(ny_orig) to $(ny)") | ||
| end | ||
| @warn("bearing: grid dimensions adjusted: " * join(msg_parts, ", ")) | ||
| end |
There was a problem hiding this comment.
Why not use the macro ? it's n we are interested in, not nx and ny.
Fixes #354
Applied the macro to all problems with automatic dimension adjustments:
:nlp,:nlsm*3-2:nlp,:nls:nlp,:nls:nlp,:nls:nlp,:nls