Skip to content

Fix missing critical regions caused by DAQPBase 0.4.1 early-exit optimization bug#34

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/debug-parametricdaqp-issue
Draft

Fix missing critical regions caused by DAQPBase 0.4.1 early-exit optimization bug#34
Copilot wants to merge 2 commits into
mainfrom
copilot/debug-parametricdaqp-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 25, 2026

DAQPBase 0.4.1 (daqp commit 49bc1408) introduced an early-exit in daqp_update_ldp that is triggered when H and f are NULL (pure LDP calls). After a pointer swap, work->x points to uninitialized malloc'd memory (xold), but the code assumes it is zeroed. This corrupts the feasibility check and the d (slack) values used by the subsequent daqp_ldp solve, producing wrong exitflags.

In ParametricDAQP, get_ignore_masks and compute_AS0 call DAQPBase.quadprog(zeros(0,0), zeros(0), ...) which triggers this path. The result: 5 valid constraint pairs are incorrectly marked infeasible, pruning valid active-set combinations from the combinatorial search and leaving 116 missing critical regions (holes in the partition).

Changes

  • src/utils.jl — Added ldp_quadprog() helper that replaces quadprog(zeros(0,0), zeros(0), A, b, ...) with an explicit identity Hessian:
function ldp_quadprog(A, b, blower=Float64[], senses=Cint[])
    n = size(A, 2)
    return DAQPBase.quadprog(Matrix{Float64}(I, n, n), zeros(n), A, b, blower, senses)
end

H = I(n), f = zeros(n) is mathematically equivalent to the LDP (identical KKT conditions, solutions, and dual variables), but forces daqp_update_ldp to compute x_unc explicitly as 0 rather than reading from garbage memory. Applied to all 5 affected quadprog calls in compute_AS0 (MPLDP and MPQP/MPVI paths) and get_ignore_masks.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/FluxML/MacroTools.jl/tarball/1e0228a030642014fe5cfe68c2c0a818f9e3f522
    • Triggering command: /usr/bin/julia julia --project=/home/REDACTED/work/ParametricDAQP.jl/ParametricDAQP.jl -e using Pkg; Pkg.instantiate() (http block)
  • https://api.github.com/repos/JuliaBinaryWrappers/DAQP_jll.jl/tarball/e9cfcc76474c4a3afdaaa582ec3f862120d93224
    • Triggering command: /usr/bin/julia julia --project=/home/REDACTED/work/ParametricDAQP.jl/ParametricDAQP.jl -e using Pkg; Pkg.instantiate() (http block)
  • https://api.github.com/repos/JuliaCI/BenchmarkTools.jl/tarball/7fecfb1123b8d0232218e2da0c213004ff15358d
    • Triggering command: /usr/bin/julia julia --project -e using Pkg; Pkg.test() (http block)
  • https://api.github.com/repos/JuliaCollections/OrderedCollections.jl/tarball/05868e21324cede2207c6f0f466b4bfef6d5e7ee
    • Triggering command: /usr/bin/julia julia --project=/home/REDACTED/work/ParametricDAQP.jl/ParametricDAQP.jl -e using Pkg; Pkg.instantiate() (http block)
  • https://api.github.com/repos/JuliaData/DataAPI.jl/tarball/abe83f3a2f1b857aac70ef8b269080af17764bbe
    • Triggering command: /usr/bin/julia julia --project=/home/REDACTED/work/ParametricDAQP.jl/ParametricDAQP.jl -e using Pkg; Pkg.instantiate() (http block)
  • https://api.github.com/repos/JuliaData/Parsers.jl/tarball/7d2f8f21da5db6a806faf7b9b292296da42b2810
    • Triggering command: /usr/bin/julia julia --project -e using Pkg; Pkg.test() (http block)
  • https://api.github.com/repos/JuliaData/Tables.jl/tarball/f2c1efbc8f3a609aadf318094f8fc5204bdaf344
    • Triggering command: /usr/bin/julia julia --project=/home/REDACTED/work/ParametricDAQP.jl/ParametricDAQP.jl -e using Pkg; Pkg.instantiate() (http block)
  • https://api.github.com/repos/JuliaDocs/DocStringExtensions.jl/tarball/7442a5dfe1ebb773c29cc2962a8980f47221d76c
    • Triggering command: /usr/bin/julia julia --project=/home/REDACTED/work/ParametricDAQP.jl/ParametricDAQP.jl -e using Pkg; Pkg.instantiate() (http block)
  • https://api.github.com/repos/JuliaIO/JSON.jl/tarball/b3ad4a0255688dcb895a52fafbaae3023b588a90
    • Triggering command: /usr/bin/julia julia --project -e using Pkg; Pkg.test() (http block)
  • https://api.github.com/repos/JuliaLang/Compat.jl/tarball/9d8a54ce4b17aa5bdce0ea5c34bc5e7c340d16ad
    • Triggering command: /usr/bin/julia julia --project -e using Pkg; Pkg.test() (http block)
  • https://api.github.com/repos/JuliaLang/PrecompileTools.jl/tarball/07a921781cab75691315adc645096ed5e370cb77
    • Triggering command: /usr/bin/julia julia --project=/home/REDACTED/work/ParametricDAQP.jl/ParametricDAQP.jl -e using Pkg; Pkg.instantiate() (http block)
  • https://api.github.com/repos/JuliaPackaging/JLLWrappers.jl/tarball/0533e564aae234aff59ab625543145446d8b6ec2
    • Triggering command: /usr/bin/julia julia --project=/home/REDACTED/work/ParametricDAQP.jl/ParametricDAQP.jl -e using Pkg; Pkg.instantiate() (http block)
  • https://api.github.com/repos/JuliaPackaging/Preferences.jl/tarball/8b770b60760d4451834fe79dd483e318eee709c4
    • Triggering command: /usr/bin/julia julia --project=/home/REDACTED/work/ParametricDAQP.jl/ParametricDAQP.jl -e using Pkg; Pkg.instantiate() (http block)
  • https://api.github.com/repos/JuliaPackaging/Requires.jl/tarball/62389eeff14780bfe55195b7204c0d8738436d64
    • Triggering command: /usr/bin/julia julia --project=/home/REDACTED/work/ParametricDAQP.jl/ParametricDAQP.jl -e using Pkg; Pkg.instantiate() (http block)
  • https://api.github.com/repos/JuliaPlots/Plots.jl/tarball/5c3d09cc4f31f5fc6af001c250bf1278733100ff
    • Triggering command: /usr/bin/julia julia --project=/home/REDACTED/work/ParametricDAQP.jl/ParametricDAQP.jl -e using Pkg; Pkg.instantiate() (http block)
  • https://api.github.com/repos/JuliaServices/StructUtils.jl/tarball/fa95b3b097bcef5845c142ea2e085f1b2591e92c
    • Triggering command: /usr/bin/julia julia --project -e using Pkg; Pkg.test() (http block)
  • https://api.github.com/repos/JuliaStats/Statistics.jl/tarball/ae3bb1eb3bba077cd276bc5cfc337cc65c3075c0
    • Triggering command: /usr/bin/julia julia --project -e using Pkg; Pkg.test() (http block)
  • https://api.github.com/repos/KristofferC/PGFPlotsX.jl/tarball/e5df51ffc01f8771d94c8db2d164be1f6927849c
    • Triggering command: /usr/bin/julia julia --project=/home/REDACTED/work/ParametricDAQP.jl/ParametricDAQP.jl -e using Pkg; Pkg.instantiate() (http block)
  • https://api.github.com/repos/darnstrom/PolyDAQP.jl/tarball/b44aa329d124e2098a27be78ba008eca596ae4c6
    • Triggering command: /usr/bin/julia julia --project=/home/REDACTED/work/ParametricDAQP.jl/ParametricDAQP.jl -e using Pkg; Pkg.instantiate() (http block)
  • https://api.github.com/repos/darnstrom/daqp/tarball/52046f50338206658e3c082ab7f9dfff108525a2
    • Triggering command: /usr/bin/julia julia --project=/home/REDACTED/work/ParametricDAQP.jl/ParametricDAQP.jl -e using Pkg; Pkg.instantiate() (http block)
  • https://api.github.com/repos/jw3126/ArgCheck.jl/tarball/f9e9a66c9b7be1ad7372bbd9b062d9230c30c5ce
    • Triggering command: /usr/bin/julia julia --project=/home/REDACTED/work/ParametricDAQP.jl/ParametricDAQP.jl -e using Pkg; Pkg.instantiate() (http block)
  • https://api.github.com/repos/mauro3/Parameters.jl/tarball/34c0e9ad262e5f7fc75b10a9952ca7692cfc5fbe
    • Triggering command: /usr/bin/julia julia --project=/home/REDACTED/work/ParametricDAQP.jl/ParametricDAQP.jl -e using Pkg; Pkg.instantiate() (http block)
  • https://api.github.com/repos/mauro3/UnPack.jl/tarball/387c1f73762231e86e0c9c5443ce3b4a0a9a0c2b
    • Triggering command: /usr/bin/julia julia --project=/home/REDACTED/work/ParametricDAQP.jl/ParametricDAQP.jl -e using Pkg; Pkg.instantiate() (http block)
  • https://api.github.com/repos/queryverse/DataValueInterfaces.jl/tarball/bfc1187b79289637fa0ef6d4436ebdfe6905cbd6
    • Triggering command: /usr/bin/julia julia --project=/home/REDACTED/work/ParametricDAQP.jl/ParametricDAQP.jl -e using Pkg; Pkg.instantiate() (http block)
  • https://api.github.com/repos/queryverse/IteratorInterfaceExtensions.jl/tarball/a3f24677c21f5bbe9d2a714f95dcd58337fb2856
    • Triggering command: /usr/bin/julia julia --project=/home/REDACTED/work/ParametricDAQP.jl/ParametricDAQP.jl -e using Pkg; Pkg.instantiate() (http block)
  • https://api.github.com/repos/queryverse/TableTraits.jl/tarball/c06b2f539df1c6efa794486abfb6ed2022561a39
    • Triggering command: /usr/bin/julia julia --project=/home/REDACTED/work/ParametricDAQP.jl/ParametricDAQP.jl -e using Pkg; Pkg.instantiate() (http block)
  • https://api.github.com/repos/rfourquet/BitIntegers.jl/tarball/091d591a060e43df1dd35faab3ca284925c48e46
    • Triggering command: /usr/bin/julia julia --project=/home/REDACTED/work/ParametricDAQP.jl/ParametricDAQP.jl -e using Pkg; Pkg.instantiate() (http block)
  • https://api.github.com/repos/timholy/ProgressMeter.jl/tarball/fbb92c6c56b34e1a2c4c36058f68f332bec840e7
    • Triggering command: /usr/bin/julia julia --project=/home/REDACTED/work/ParametricDAQP.jl/ParametricDAQP.jl -e using Pkg; Pkg.instantiate() (http block)
  • https://api.github.com/repos/tpapp/DefaultApplication.jl/tarball/c0dfa5a35710a193d83f03124356eef3386688fc
    • Triggering command: /usr/bin/julia julia --project=/home/REDACTED/work/ParametricDAQP.jl/ParametricDAQP.jl -e using Pkg; Pkg.instantiate() (http block)
  • pkg.julialang.org
    • Triggering command: /usr/bin/julia julia --project=/home/REDACTED/work/ParametricDAQP.jl/ParametricDAQP.jl -e using Pkg; Pkg.status() (dns block)
    • Triggering command: /usr/bin/julia julia -e using Pkg; Pkg.status("DAQPBase"; io=stdout) (dns block)
    • Triggering command: /usr/bin/julia julia --project=/home/REDACTED/work/ParametricDAQP.jl/ParametricDAQP.jl -e using Pkg; Pkg.instantiate() (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

The early-exit optimization added in DAQPBase 0.4.1 (daqp commit 49bc1408)
contains a bug: when H and f are empty (NULL), uninitialized xold memory is
incorrectly used as x_unc after a pointer swap, while the code assumes it is
already zeroed. This causes wrong feasibility results in get_ignore_masks and
compute_AS0, leading to some valid critical regions being incorrectly pruned
and producing holes in the solution.

The fix adds a helper function ldp_quadprog() that solves the LDP
min ||x||^2/2 s.t. Ax <= b using an explicit identity Hessian H=I(n).
This is mathematically equivalent but forces the correct code path in
daqp_update_ldp where x_unc is computed explicitly (as 0 when f=0),
rather than being assumed zero from potentially garbage memory.

Co-authored-by: darnstrom <55484604+darnstrom@users.noreply.github.com>
Agent-Logs-Url: https://github.com/darnstrom/ParametricDAQP.jl/sessions/5c8838e7-3862-4f21-8333-723fa4523b6b
Copilot AI changed the title [WIP] Investigate test failures in ParametricDAQP.jl due to DAQPBase update Fix missing critical regions caused by DAQPBase 0.4.1 early-exit optimization bug Mar 25, 2026
Copilot AI requested a review from darnstrom March 25, 2026 02:11
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.

2 participants