Skip to content

@lencheck macro - #216

Closed
arnavk23 wants to merge 9 commits into
JuliaSmoothOptimizers:mainfrom
arnavk23:main
Closed

@lencheck macro#216
arnavk23 wants to merge 9 commits into
JuliaSmoothOptimizers:mainfrom
arnavk23:main

Conversation

@arnavk23

@arnavk23 arnavk23 commented Nov 4, 2025

Copy link
Copy Markdown
Contributor

Implements @lencheck macro for runtime length checks(fixes #188).

@arnavk23 arnavk23 changed the title Add @lencheck macro and tests (#188) Add @lencheck macro Nov 4, 2025
@arnavk23

arnavk23 commented Nov 5, 2025

Copy link
Copy Markdown
Contributor Author

@tmigot please review this pr.

@tmigot tmigot left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This macro is already defined in NLPModels.jl. The issue is more about using it in the package.

@arnavk23
arnavk23 requested a review from tmigot November 5, 2025 18:00
Comment thread test/lencheck.jl Outdated
Comment thread src/moi_nls_model.jl Outdated
Comment thread src/moi_nls_model.jl Outdated
Comment thread src/moi_nls_model.jl Outdated
Comment thread src/moi_nls_model.jl Outdated
Comment thread src/moi_nlp_model.jl Outdated
Comment thread src/moi_nlp_model.jl Outdated
@arnavk23 arnavk23 changed the title Add @lencheck macro @lencheck macro Nov 6, 2025
@arnavk23

arnavk23 commented Nov 6, 2025

Copy link
Copy Markdown
Contributor Author

Seeing

Precompiling packages finished.
  1 dependency successfully precompiled in 5 seconds. 54 already precompiled.
     Testing Running tests...

Testing MathOptNLPModel
Problem          nvar  ncon     |f(x₀)|∇f(x₀)‖     ‖c(x₀)‖
brownden            4     0  7.9267e+06  2.1405e+06          NA
hs5                 2     0  1.0000e+00  3.5355e+00          NA
hs6                 2     1  4.8400e+00  4.4000e+00  4.4000e+00
hs10                2     1  2.0000e+01  1.4142e+00  6.0000e+02
hs11                2     1  2.4980e+01  2.8284e-01  2.3910e+01
hs13                2     1  2.0000e+01  8.9443e+00  2.9000e+01
hs14                2     2  1.0000e+00  2.0000e+00  5.3852e+00
lincon             15    11  1.2000e+02  0.0000e+00  0.0000e+00
linsv               2     2  0.0000e+00  1.0000e+00  0.0000e+00
nohesspb            2     0  3.0000e+00  0.0000e+00          NA
hs61                3     2  0.0000e+00  4.3829e+01  0.0000e+00
hs100               7     4  7.1400e+02  1.1024e+02  3.3151e+01
hs219               4     2  1.0000e+01  1.0000e+00  1.0900e+03
quadcon             3     6  0.0000e+00  0.0000e+00  0.0000e+00
operatorspb         6     4  4.2090e+04  3.1000e+01  1.4321e+03
nf                  2     2  0.0000e+00  0.0000e+00  0.0000e+00


Testing MathOptNLSModel
Problem          nequ  nvar  ncon    ‖F(x₀)‖²       ‖JᵀF‖     ‖c(x₀)‖
lls                 3     2     1  8.0000e+00  4.4721e+00  0.0000e+00
mgh01               2     2     0  2.4200e+01  1.1643e+02          NA
bndrosenbrock       2     2     0  2.4200e+01  1.1643e+02          NA
nlshs20             2     2     3  9.0900e+02  1.2398e+03  7.1414e+00
nlslc              15    15    11  1.7831e+05  0.0000e+00  0.0000e+00
nlsnohesspb         5     5     0  4.8422e+03  1.1010e+04          NA
hs30                3     3     1  3.0000e+00  1.7321e+00  1.0000e+00
hs43                4     4     3  7.9875e+01  1.1619e+01  1.3748e+01
mgh07               3     3     0  2.5000e+03  9.3982e+02          NA
nlsqc               3     3     6  9.8000e+01  0.0000e+00  0.0000e+00

Testing 2d cat array on NLS
Testing Dense JuMP container on NLS
Testing Sparse JuMP container on NLS
Testing array of JuMP containers on NLS

@arnavk23
arnavk23 requested a review from tmigot November 6, 2025 09:54
Comment thread src/NLPModelsJuMP.jl
@@ -1,5 +1,7 @@
module NLPModelsJuMP

import NLPModels: @lencheck

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it's just the import now ? But no use of the macro in the model?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tmigot I have added changes. If there is anything else you have on mind or any part of the issue I am not understanding, please describe here further.

@arnavk23
arnavk23 requested a review from tmigot November 13, 2025 21:14
@arnavk23 arnavk23 closed this Feb 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add lencheck

2 participants