Skip to content

Add C code generation for implicit parametric DAQP solver#33

Draft
Copilot wants to merge 6 commits intodouble-sidedfrom
copilot/add-c-code-generation-for-daqp
Draft

Add C code generation for implicit parametric DAQP solver#33
Copilot wants to merge 6 commits intodouble-sidedfrom
copilot/add-c-code-generation-for-daqp

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 20, 2026

Implements the missing C code generation needed to deploy a compiled parametric QP solver using DAQP, given an mpQP defined via a JuMP/MOI model.

Changes

Merged double-sided branch foundation

  • preprocess.jl: equality elimination and double-sided → single-sided conversion
  • MathOptInterfaceExt.jl: moi2mpqp extracts a double-sided mpQP from a MOI model; get_mpp exposes this to users
  • JuMPExt.jl: forwards get_mpp and updated mpsolve to JuMP models

Implemented C code generation in render_pdaqp_workspace

Three C functions are now emitted by codegen_implicit:

pdaqp_update_qp — updates DAQP's LDP bounds for a given parameter vector:

dupper[i] = du[i] + Dth[i*N_PARAMETERS + j]*th[j];
dlower[i] = dl[i] + Dth[i*N_PARAMETERS + j]*th[j];

pdaqp_get_solution — affine back-transform from the DAQP QP solution to the nominal variable:

solution[i] = xstar[i] + Z_offset[i + j*N_DECISION]*th[j] + z_offset[i];

pdaqp_compute_solution — top-level entry point: updates bounds, resets workspace (skipped if warm_start=true), calls daqp_ldp + ldp2qp_solution, then applies the back-transform.

Header generation fixes

  • Added PDAQP_N_CONSTRAINTS and PDAQP_N_DECISION #defines
  • Added function declarations for all three new functions
  • Corrected output-variable count to use size(mpldp.HinvF, 2) (respects out_vars selection)
  • Added #include "daqp.h" in the generated source for DAQP workspace access

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:

  • pkg.julialang.org
    • Triggering command: /usr/bin/julia julia --project -e import Pkg; Pkg.status() -j ACCEPT (dns block)

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


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

darnstrom and others added 4 commits January 11, 2026 14:28
Copilot AI changed the title [WIP] Add C code generation for DAQP solver from mpQP Add C code generation for implicit parametric DAQP solver Mar 20, 2026
Copilot AI requested a review from darnstrom March 20, 2026 23:37
@darnstrom darnstrom changed the base branch from main to double-sided March 20, 2026 23:57
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.

3 participants