Add chebyquad#414
Conversation
…gration - Make Cheby function robust for AD and floating-point noise - Add all necessary chebyquad overloads for type=Val(T), type=T, positional and keyword arguments, and model selection - Ensure chebyquad works for both NLP and NLS forms - Add fallback for keyword-only calls - Confirmed gradient is valid and tests now run to completion
|
There was a problem hiding this comment.
Pull request overview
Adds the Moré–Garbow–Hillstrom “chebyquad” test problem (Problem 35) to the OptimizationProblems.jl catalog, providing both a JuMP (PureJuMP) and AD-based (ADNLPProblems) implementation plus metadata for discovery via OptimizationProblems.meta.
Changes:
- Added
chebyquadimplementation insrc/PureJuMP/chebyquad.jl. - Added
chebyquadNLP/NLS implementations insrc/ADNLPProblems/chebyquad.jl(withuse_nlsswitch). - Added metadata and size getters in
src/Meta/chebyquad.jl.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| src/PureJuMP/chebyquad.jl | Introduces a JuMP nonlinear objective formulation for chebyquad. |
| src/ADNLPProblems/chebyquad.jl | Introduces AD-based NLP + in-place NLS residual formulations for chebyquad. |
| src/Meta/chebyquad.jl | Registers chebyquad metadata and getter functions (including NLS residual count). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…T) for typed constants and builds x0 from a typed step, which keeps Float32 inputs and the objective result in Float32 without forcing constructor conversions.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #414 +/- ##
===========================================
- Coverage 99.80% 54.42% -45.38%
===========================================
Files 1084 1141 +57
Lines 12319 13425 +1106
===========================================
- Hits 12295 7307 -4988
- Misses 24 6118 +6094 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
tmigot
left a comment
There was a problem hiding this comment.
Just a small comments. Have you tried solving both with Ipopt ?
To move a JuMP model to NLPModel you have to use NLPModelsJuMP.jl with the function MathOptNLPModel
|
On checking |
|
Also @tmigot |
|
@tmigot Tangi I think this is done too. |
| # In case register signature or availability differs, fall back silently. | ||
| end | ||
|
|
||
| @NLobjective( |
There was a problem hiding this comment.
We use the more recent JuMP API that no longer use NLobjective
| try | ||
| JuMP.register(nlp, :cheby, 2, _cheby_recurrence; autodiff = true) | ||
| catch | ||
| # In case register signature or availability differs, fall back silently. |
| kwargs..., | ||
| ) where {T} | ||
| m = max(m, n) | ||
| function F!(r, x; n = length(x), m = length(r), chebyshev = chebyshev) |
| return chebyquad(Val(model); kwargs...) | ||
| end | ||
|
|
||
| function Cheby(xj, i::Integer) |
There was a problem hiding this comment.
I would suggest a name like _cheby_recurrence and this should be uniform with the jump implementation
| get_chebyquad_nvar(; n::Integer = default_nvar, kwargs...) = n | ||
| get_chebyquad_ncon(; n::Integer = default_nvar, kwargs...) = 0 | ||
| get_chebyquad_nlin(; n::Integer = default_nvar, kwargs...) = 0 | ||
| get_chebyquad_nnln(; n::Integer = default_nvar, kwargs...) = 0 | ||
| get_chebyquad_nequ(; n::Integer = default_nvar, kwargs...) = 0 | ||
| get_chebyquad_nineq(; n::Integer = default_nvar, kwargs...) = 0 | ||
| get_chebyquad_nls_nequ(; n::Integer = default_nvar, m::Int = n, kwargs...) = max(m, n) |
| :best_known_upper_bound => 500.0, | ||
| :is_feasible => true, | ||
| :defined_everywhere => missing, | ||
| :origin => :unknown, |
There was a problem hiding this comment.
Can you add the new fields ? Take example from other problems with the same testset
| :objtype => :least_squares, | ||
| :contype => :unconstrained, | ||
| :best_known_lower_bound => -Inf, | ||
| :best_known_upper_bound => 500.0, |
Closes #115
Builds on #280