{"id":7127,"library":"daqp","title":"DAQP: Dual Active-Set QP Solver","description":"DAQP is a dual active-set solver designed for convex quadratic programs (QPs), including mixed-integer QPs (MIQPs) and hierarchical QPs (HQPs). Written in C and library-free, it provides high-performance interfaces for Python, Julia, and MATLAB. It excels at solving small to medium-scale, dense QP and LP problems, particularly those arising in real-time Model Predictive Control (MPC) applications. The current version is 0.8.5, with frequent releases addressing improvements and bug fixes.","status":"active","version":"0.8.5","language":"python","source_language":"en","source_url":"https://github.com/darnstrom/daqp","tags":["optimization","quadratic programming","QP solver","active-set","control","MPC","mixed-integer QP"],"install":[{"cmd":"pip install daqp","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"note":"The primary interface is typically accessed via the top-level 'daqp' module, with functions like 'daqp.solve'.","wrong":"from daqp import solve","symbol":"daqp","correct":"import daqp"},{"note":"The main QP solver function is 'solve' within the 'daqp' module.","symbol":"solve","correct":"daqp.solve(H, f, A, bl, bu)"}],"quickstart":{"code":"import numpy as np\nimport daqp\n\n# Define a simple QP: min 0.5*x'*H*x + f'*x  s.t. bl <= A*x <= bu, l <= x <= u\nH = np.array([[2.0, 0.0], [0.0, 2.0]]) # Hessian (positive definite)\nf = np.array([-2.0, -2.0])           # Linear term\n\nA = np.array([[1.0, 0.0], [0.0, 1.0], [1.0, 1.0]]) # Constraint matrix\nbl = np.array([0.0, 0.0, 0.0])        # Lower bound for A*x\nbu = np.array([10.0, 10.0, 1.0])       # Upper bound for A*x\n\n# No explicit bounds on x (l, u can be omitted or set to -inf, +inf)\nx_min = np.full(H.shape[0], -np.inf) # Lower bound for x\nx_max = np.full(H.shape[0], np.inf)  # Upper bound for x\n\n# Solve the QP problem\n# Note: H, f, A, bl, bu are the minimum required arguments. l and u can be passed if needed.\nresult = daqp.solve(H, f, A, bl, bu)\n\nif result.exitflag == 1: # exitflag 1 means optimal solution found\n    print(f\"Optimal solution x: {result.x}\")\n    print(f\"Optimal objective value: {result.fval}\")\n    print(f\"Number of iterations: {result.iter}\")\nelse:\n    print(f\"Solver failed with exitflag: {result.exitflag}\")\n    print(f\"Result details: {result}\")","lang":"python","description":"This example demonstrates how to define and solve a basic quadratic programming problem using the `daqp.solve` function. It minimizes `0.5*x'*H*x + f'*x` subject to `bl <= A*x <= bu` and optional box constraints on `x`. The solution `x` and objective value `fval` are extracted from the result object."},"warnings":[{"fix":"Review your code for any direct C API calls from Python or explicit binary constraint definitions and update to use the new Cython-based API and 'sense' flags for binary constraints if applicable.","message":"The Python interface was re-implemented in Cython in v0.5.0, potentially breaking existing code that relied on the previous Python bindings. Additionally, the detection of binary constraints from the 'sense' parameter was introduced.","severity":"breaking","affected_versions":"<=0.4.x"},{"fix":"Assess the scale and sparsity of your QP problems. For large-scale or sparse problems, evaluate alternative QP solvers designed to exploit sparsity.","message":"DAQP is highly optimized for small to medium-scale, dense quadratic programs. Its performance and suitability for large-scale or sparse problems may be significantly limited. For sparse problems, consider other solvers like OSQP.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure that your input Hessian `H` is already symmetric, or that the symmetrization `0.5 * (H + H.T)` is acceptable for your problem formulation. If not, consider explicitly symmetrizing `H` before passing it to DAQP to maintain control over the matrix used by the solver.","message":"Starting from v0.8.3, the Hessian matrix `H` is explicitly symmetrized in-place (as `0.5 * (H + H.T)`) during the solver setup. If your application relies on an asymmetric `H` being passed and processed in a specific non-symmetrized manner, this behavior change might impact results.","severity":"breaking","affected_versions":">=0.8.3"},{"fix":"Upgrade to DAQP v0.8.1 or later to utilize warm-starting capabilities (by providing initial primal/dual iterates) and to enforce a wall-clock time limit for the solver.","message":"Features such as warm-starting with primal/dual iterates and setting a `time_limit` were introduced in v0.8.1. These functionalities are not available in earlier versions of the library.","severity":"deprecated","affected_versions":"<0.8.1"}],"env_vars":null,"search_vec":"'0.8.5':80 'activ':4,13,95 'active-set':3,12,94 'address':84 'applic':75 'aris':66 'bug':87 'c':34 'control':73,97 'convex':18 'current':77 'daqp':1,8 'dens':59 'design':16 'dual':2,11 'excel':51 'fix':88 'free':38 'frequent':82 'hierarch':29 'high':42 'high-perform':41 'hqps':31 'improv':85 'includ':22 'integ':25,101 'interfac':44 'julia':47 'librari':37 'library-fre':36 'lp':62 'matlab':49 'medium':57 'medium-scal':56 'miqp':27 'mix':24,100 'mixed-integ':23,99 'model':71 'mpc':74,98 'optim':89 'particular':64 'perform':43 'predict':72 'problem':63 'program':20,91 'provid':40 'python':46 'qp':6,60,92,102 'qps':21,26,30 'quadrat':19,90 'real':69 'real-tim':68 'releas':83 'scale':58 'set':5,14,96 'small':54 'solv':53 'solver':7,15,93 'time':70 'version':78 'written':32","created_at":"2026-04-16T13:44:38.403631+00:00","updated_at":"2026-04-16T13:44:38.403631+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\n  File \"daqp.pyx\", line 1, in init daqp\nModuleNotFoundError: No module named 'numpy'"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.8.7","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"http://github.com/darnstrom/daqp","docs":null,"changelog":null,"pypi":"https://pypi.org/project/daqp/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["ai-ml"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"skip","verified_at":"2026-06-28","last_verified":"2026-06-28","next_check":"2026-08-01","install_tag":null}}