Skip to content

AL display wrong constraints violation. #336

Description

@BenjaminPINEAU

Describe the bug 🐞

It looks like AL_alg.jl does not update constraints violation when we use R2N or R2 as subsolver and these subsolvers do 0 iteration. Then if cviol = 0.0 at the first AL iteration, constraints violation are never updated so cviol is always equal to 0 even if the iterates induce constraints violation.
At the end, the solution can violate constraints but cviol = 0 is is displayed by the AL solver.

Expected behavior

If the iterates violate constraints, the solver should not display cviol = 0.
In addition, if cviol = 0, the condition

if cviol > max(ctol, factor_primal_linear_improvement * cviol_old)
   mu *= factor_penalty_up
end

is never respected so iterates will make it difficult to meet the constraints later on, even if that isn't the case.

Minimal Reproducible Example 👇

In this exemple AL return cviol = 0 even if the real cviol is equal to 4.4.

h = NormL1(2.5)
meta = OptimizationProblems.meta
problem = "hs6"
nlp = OptimizationProblems.ADNLPProblems.eval(Meta.parse(problem))()

quadratic_model = QuadraticModel(nlp, nlp.meta.x0, name = nlp.meta.name)
nlp_quadra = RegularizedNLPModel(quadratic_model, h)
b = nlp_quadra.model.meta.lcon

solver = ALSolver(nlp_quadra; subsolver = R2Solver)
stats = GenericExecutionStats(nlp_quadra.model)

RegularizedOptimization.solve!(solver, nlp_quadra, stats, verbose = 1)

println("b: ", b)
println("cons: ", cons(nlp_quadra.model, stats.solution))
println("cviol: ", norm(cons(nlp_quadra.model, stats.solution) - b))

Error & Stacktrace ⚠️

[ Info:   iter  sub_it       obj     cviol         μ     normy   sub_tol       sub_status  
[ Info:      0       0   2.4e+00   0.0e+00   1.0e+01   0.0e+00   1.0e-01
[ Info:      1       0   2.4e+00   0.0e+00   1.0e+01   0.0e+00   1.0e-01      first_order
[ Info:      2       0   2.4e+00   0.0e+00   1.0e+01   0.0e+00   2.5e-02      first_order
[ Info:      3       0   2.4e+00   0.0e+00   1.0e+01   0.0e+00   6.3e-03      first_order
[ Info:      4       0   2.4e+00   0.0e+00   1.0e+01   0.0e+00   1.6e-03      first_order
[ Info:      5       0   2.4e+00   0.0e+00   1.0e+01   0.0e+00   3.9e-04      first_order
[ Info:      6       0   2.4e+00   0.0e+00   1.0e+01   0.0e+00   9.8e-05      first_order
[ Info:      7       0   2.4e+00   0.0e+00   1.0e+01   0.0e+00   2.4e-05      first_order
[ Info:      8       0   2.4e+00   0.0e+00   1.0e+01   0.0e+00   6.1e-06      first_order
[ Info:      9       0   2.4e+00   0.0e+00   1.0e+01   0.0e+00   6.1e-06      first_order
b: [4.399]
cons: [0.0]
cviol: 4.399

Environment (please complete the following information):

  • Output of using Pkg; Pkg.status()
  [54578032] ADNLPModels v0.8.13
  [a4795742] NLPModels v0.21.12
  [5049e819] OptimizationProblems v0.9.3
  [a725b495] ProximalOperators v0.16.1
  [f468eda6] QuadraticModels v0.9.16
  [20620ad1] RegularizedOptimization v0.3.2
  [ea076b23] RegularizedProblems v0.1.5
  [ff4d7338] SolverCore v0.3.10
  [37e2e46d] LinearAlgebra v1.12.0
  • Output of using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
[54578032] ADNLPModels v0.8.13
  [47edcb42] ADTypes v1.22.0
  [621f4979] AbstractFFTs v1.5.0
  [79e6a3ab] Adapt v4.6.1
  [66dad0bd] AliasTables v1.1.3
  [7d9fca2a] Arpack v0.5.4
  [d360d2e6] ChainRulesCore v1.26.1
  [0b6fb165] ChunkCodecCore v1.0.1
  [4c0bbee4] ChunkCodecLibZlib v1.0.0
  [55437552] ChunkCodecLibZstd v1.0.0
  [523fee87] CodecBzip2 v0.8.5
  [944b1d66] CodecZlib v0.7.8
⌅ [3da002f7] ColorTypes v0.11.5
⌅ [5ae59095] Colors v0.12.11
  [38540f10] CommonSolve v0.2.7
  [bbf7d656] CommonSubexpressions v0.3.1
  [34da2185] Compat v4.18.1
  [187b0558] ConstructionBase v1.6.0
  [a8cc5b0e] Crayons v4.1.1
  [9a962f9c] DataAPI v1.16.0
  [a93c6f00] DataFrames v1.8.2
  [864edb3b] DataStructures v0.19.5
  [e2d170a0] DataValueInterfaces v1.0.0
  [163ba53b] DiffResults v1.1.0
  [b552c78f] DiffRules v1.16.0
  [31c24e10] Distributions v0.25.126
  [ffbed154] DocStringExtensions v0.9.5
  [e2ba6199] ExprTools v0.1.10
  [9aa1b823] FastClosures v0.3.2
  [5789e2e9] FileIO v1.19.0
  [1a297f60] FillArrays v1.16.0
⌅ [53c48c17] FixedPointNumbers v0.8.6
  [f6369f11] ForwardDiff v1.4.0
  [069b7b12] FunctionWrappers v1.1.3
  [a2bd30eb] Graphics v1.1.3
  [076d061b] HashArrayMappedTries v0.2.0
  [34004b35] HypergeometricFunctions v0.3.28
⌅ [a09fc81d] ImageCore v0.8.22
  [842dd82b] InlineStrings v1.4.5
  [41ab1584] InvertedIndices v1.3.1
  [92d709cd] IrrationalConstants v0.2.6
  [42fd0dbc] IterativeSolvers v0.9.4
  [82899510] IteratorInterfaceExtensions v1.0.0
  [033835bb] JLD2 v0.6.4
  [692b3bcd] JLLWrappers v1.8.0
  [682c06a0] JSON v1.6.1
  [10dff2fc] JSOSolvers v0.14.8
  [4076af6c] JuMP v1.30.1
  [ba0b0d4f] Krylov v0.10.6
  [b964fa9f] LaTeXStrings v1.4.0
  [5c8ed15e] LinearOperators v2.14.1
⌅ [2ab3a3ac] LogExpFunctions v0.3.29
  [1914dd2f] MacroTools v0.5.16
  [30dfa513] ManualNLPModels v0.2.0
  [dbb5928d] MappedArrays v0.4.3
  [b8f27783] MathOptInterface v1.51.1
  [e1d29d7a] Missings v1.2.0
  [e94cdb99] MosaicViews v0.3.4
  [d8a4904e] MutableArithmetics v1.8.0
  [a4795742] NLPModels v0.21.12
⌅ [e01155f1] NLPModelsModifiers v0.7.4
  [77ba4419] NaNMath v1.1.3
⌅ [81d43f40] Noise v0.2.2
  [ab2f91bb] OSQP v0.8.1
  [6fe1bfb0] OffsetArrays v1.17.0
  [5049e819] OptimizationProblems v0.9.3
⌅ [bac558e1] OrderedCollections v1.8.2
  [90014a1f] PDMats v0.11.37
  [5432bcbf] PaddedViews v0.5.12
  [69de0a69] Parsers v2.8.5
  [01435c0c] Percival v0.7.6
  [e409e4f3] PoissonRandom v0.4.9
  [2dfb63ee] PooledArrays v1.4.3
  [aea7be01] PrecompileTools v1.3.4
  [21216c6a] Preferences v1.5.2
  [08abe8d2] PrettyTables v3.3.2
⌅ [dc4f5ac2] ProximalCore v0.1.2
  [a725b495] ProximalOperators v0.16.1
  [43287f4e] PtrArrays v1.4.0
  [422b30a1] QRMumps v0.3.2
  [1fd47b50] QuadGK v2.11.3
  [f468eda6] QuadraticModels v0.9.16
  [3cdcf5f2] RecipesBase v1.3.4
  [189a3867] Reexport v1.2.2
  [20620ad1] RegularizedOptimization v0.3.2
  [ea076b23] RegularizedProblems v0.1.5
  [ae029012] Requires v1.3.1
  [37e2e3b7] ReverseDiff v1.16.2
  [79098fc4] Rmath v0.9.0
⌅ [f2b01f46] Roots v1.4.1
  [7e506255] ScopedValues v1.6.2
  [91c51154] SentinelArrays v1.4.10
⌅ [efcf1570] Setfield v0.8.3
  [d4fd37fa] ShiftedProximalOperators v0.2.4
  [ff4d7338] SolverCore v0.3.10
  [d076d87d] SolverParameters v0.1.2
  [b5612192] SolverTools v0.10.1
  [a2af1166] SortingAlgorithms v1.2.2
  [9f842d2f] SparseConnectivityTracer v1.2.1
  [fa32481b] SparseMatricesCOO v0.2.6
  [0a514795] SparseMatrixColorings v0.4.27
  [276daf66] SpecialFunctions v2.8.0
  [cae243ae] StackViews v0.1.2
  [90137ffa] StaticArrays v1.9.18
  [1e83bf80] StaticArraysCore v1.4.4
  [10745b16] Statistics v1.11.1
  [82ae8749] StatsAPI v1.8.0
  [2913bbd2] StatsBase v0.34.11
  [4c63d2b9] StatsFuns v2.1.0
  [892a3eda] StringManipulation v0.4.4
  [ec057cc2] StructUtils v2.8.2
  [9449cd9e] TSVD v0.4.4
  [3783bdb8] TableTraits v1.0.1
  [bd369af6] Tables v1.12.1
  [a759f4b9] TimerOutputs v0.5.29
  [3bb67fe8] TranscodingStreams v0.11.3
⌅ [68821587] Arpack_jll v3.5.2+0
  [6e34b625] Bzip2_jll v1.0.9+0
  [d00139f3] METIS_jll v5.1.3+0
  [9c4f68bf] OSQP_jll v0.600.200+0
  [656ef2d0] OpenBLAS32_jll v0.3.33+1
  [efe28fd5] OpenSpecFun_jll v0.5.6+0
  [f50d1b31] Rmath_jll v0.5.1+0
  [a8d0f55d] SCOTCH_jll v7.0.11+0
  [ffd25f8a] XZ_jll v5.8.3+0
  [3161d3a3] Zstd_jll v1.5.7+1
  [e37b5aa0] qr_mumps_jll v3.1.1+0
  [0dad84c5] ArgTools v1.1.2
  [56f22d72] Artifacts v1.11.0
  [2a0f44e3] Base64 v1.11.0
  [ade2ca70] Dates v1.11.0
  [f43a241f] Downloads v1.7.0
  [7b1f6079] FileWatching v1.11.0
  [9fa8497b] Future v1.11.0
  [b77e0a4c] InteractiveUtils v1.11.0
  [ac6e5ff7] JuliaSyntaxHighlighting v1.12.0
  [b27032c2] LibCURL v0.6.4
  [76f85450] LibGit2 v1.11.0
  [8f399da3] Libdl v1.11.0
  [37e2e46d] LinearAlgebra v1.12.0
  [56ddb016] Logging v1.11.0
  [d6f4376e] Markdown v1.11.0
  [a63ad114] Mmap v1.11.0
  [ca575930] NetworkOptions v1.3.0
  [44cfe95a] Pkg v1.12.1
  [de0858da] Printf v1.11.0
  [3fa0cd96] REPL v1.11.0
  [9a3f8284] Random v1.11.0
  [ea8e919c] SHA v0.7.0
  [9e88b42a] Serialization v1.11.0
  [6462fe0b] Sockets v1.11.0
  [2f01184e] SparseArrays v1.12.0
  [f489334b] StyledStrings v1.11.0
  [4607b0f0] SuiteSparse
  [fa267f1f] TOML v1.0.3
  [a4e569a6] Tar v1.10.0
  [8dfed614] Test v1.11.0
  [cf7118a7] UUIDs v1.11.0
  [4ec0a83e] Unicode v1.11.0
  [e66e0078] CompilerSupportLibraries_jll v1.3.0+1
  [deac9b47] LibCURL_jll v8.15.0+0
  [e37daf67] LibGit2_jll v1.9.0+0
  [29816b5a] LibSSH2_jll v1.11.3+1
  [14a3606d] MozillaCACerts_jll v2025.11.4
  [4536629a] OpenBLAS_jll v0.3.29+0
  [05823500] OpenLibm_jll v0.8.7+0
  [458c3c95] OpenSSL_jll v3.5.4+0
  [bea87d4a] SuiteSparse_jll v7.8.3+2
  [83775a58] Zlib_jll v1.3.1+2
  [8e850b90] libblastrampoline_jll v5.15.0+0
  [8e850ede] nghttp2_jll v1.64.0+1
  [3f19e933] p7zip_jll v17.7.0+0
  • Output of versioninfo()
Julia Version 1.12.6
Commit 15346901f00 (2026-04-09 19:20 UTC)
Build Info:
  Official https://julialang.org release
Platform Info:
  OS: macOS (arm64-apple-darwin24.0.0)
  CPU: 8 × Apple M1
  WORD_SIZE: 64
  LLVM: libLLVM-18.1.7 (ORCJIT, apple-m1)
  GC: Built with stock GC
Threads: 1 default, 1 interactive, 1 GC (on 4 virtual cores)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions