From 2bcff680a9739943742f3d4236faa5d02dee126b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Arnstr=C3=B6m?= Date: Tue, 25 Nov 2025 23:57:38 +0100 Subject: [PATCH 1/4] Add break points in Python interface --- interfaces/daqp-python/daqp.pyx | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/interfaces/daqp-python/daqp.pyx b/interfaces/daqp-python/daqp.pyx index be19857..9d5c7f4 100644 --- a/interfaces/daqp-python/daqp.pyx +++ b/interfaces/daqp-python/daqp.pyx @@ -2,13 +2,15 @@ import numpy as np cimport daqp def solve(double[:, :] H, double[:] f, double[:, :] A, - double[:] bupper, double[:] blower=None, int[:] sense =None, - primal_tol = DEFAULT_PRIM_TOL, dual_tol = DEFAULT_DUAL_TOL, zero_tol = DEFAULT_ZERO_TOL, - pivot_tol = DEFAULT_PIVOT_TOL, progress_tol = DEFAULT_PROG_TOL, - cycle_tol = DEFAULT_CYCLE_TOL, iter_limit = DEFAULT_ITER_LIMIT, fval_bound = DAQP_INF, - eps_prox= 0, eta_prox = DEFAULT_ETA, rho_soft = DEFAULT_RHO_SOFT, - rel_subopt = DEFAULT_REL_SUBOPT, abs_subopt = DEFAULT_ABS_SUBOPT, - sing_tol = DEFAULT_SING_TOL, refactor_tol = DEFAULT_REFACTOR_TOL): + double[:] bupper, double[:] blower=None, + int[:] sense =None, int[:] break_points=np.zeros(0,dtype=np.intc), + primal_tol = DEFAULT_PRIM_TOL, dual_tol = DEFAULT_DUAL_TOL, + zero_tol = DEFAULT_ZERO_TOL, pivot_tol = DEFAULT_PIVOT_TOL, + progress_tol = DEFAULT_PROG_TOL, cycle_tol = DEFAULT_CYCLE_TOL, + iter_limit = DEFAULT_ITER_LIMIT, fval_bound = DAQP_INF, + eps_prox= 0, eta_prox = DEFAULT_ETA, rho_soft = DEFAULT_RHO_SOFT, + rel_subopt = DEFAULT_REL_SUBOPT, abs_subopt = DEFAULT_ABS_SUBOPT, + sing_tol = DEFAULT_SING_TOL, refactor_tol = DEFAULT_REFACTOR_TOL): """ Solve the quadratic program minimize 0.5 x'*H*x + f' x subject to blower <= A x <= bupper @@ -87,6 +89,7 @@ def solve(double[:, :] H, double[:] f, double[:, :] A, A = np.ascontiguousarray(A) mA, n = np.shape(A) m = np.size(bupper) + nh = np.size(break_points) # By default, set lower bounds to -inf and interpret constraints as inequalities if blower is None: @@ -94,9 +97,11 @@ def solve(double[:, :] H, double[:] f, double[:, :] A, if sense is None: sense = np.zeros(m, dtype=np.intc) + H_ptr = NULL if H is None else &H[0,0] f_ptr = NULL if f is None else &f[0] A_ptr = NULL if mA == 0 else &A[0,0] + bp_ptr = NULL if nh == 0 else &break_points[0] if m == 0: bu_ptr, bl_ptr, sense_ptr = NULL, NULL, NULL @@ -104,7 +109,7 @@ def solve(double[:, :] H, double[:] f, double[:, :] A, bu_ptr, bl_ptr, sense_ptr = &bupper[0], &blower[0], &sense[0] - cdef DAQPProblem problem = [n,m,m-mA, H_ptr, f_ptr, A_ptr, bu_ptr, bl_ptr, sense_ptr, NULL, 0] + cdef DAQPProblem problem = [n,m,m-mA, H_ptr, f_ptr, A_ptr, bu_ptr, bl_ptr, sense_ptr, bp_ptr, nh] # Setup settings cdef DAQPSettings settings = [primal_tol, dual_tol, zero_tol, pivot_tol, From 64e898526dacd6a39b39b0fc5c2f372daf42c0ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Arnstr=C3=B6m?= Date: Wed, 26 Nov 2025 00:03:18 +0100 Subject: [PATCH 2/4] Python versions in test --- .github/workflows/ci_python.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_python.yml b/.github/workflows/ci_python.yml index d0ec0b5..9696ac7 100644 --- a/.github/workflows/ci_python.yml +++ b/.github/workflows/ci_python.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] steps: - uses: actions/checkout@v3 From 48aebc9c93a7d800cf5f02a70dfd0eb908cc5685 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Arnstr=C3=B6m?= Date: Wed, 26 Nov 2025 00:09:11 +0100 Subject: [PATCH 3/4] Make path more robust in setup.py --- interfaces/daqp-python/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interfaces/daqp-python/setup.py b/interfaces/daqp-python/setup.py index 3244434..55f2ba9 100644 --- a/interfaces/daqp-python/setup.py +++ b/interfaces/daqp-python/setup.py @@ -9,7 +9,7 @@ # Copy C source try: - src_path = pathlib.Path(os.environ["PWD"], "../../../daqp") + src_path = pathlib.Path(__file__).resolve().parent.parent.parent except: src_path = [] csrc_dir = pathlib.Path('./csrc') From 8dc6bf86b33730bfe8c33d2c59074bf9b2639e43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Arnstr=C3=B6m?= Date: Wed, 26 Nov 2025 00:45:13 +0100 Subject: [PATCH 4/4] Revert to other more restrictive src_path --- interfaces/daqp-python/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interfaces/daqp-python/setup.py b/interfaces/daqp-python/setup.py index 55f2ba9..3244434 100644 --- a/interfaces/daqp-python/setup.py +++ b/interfaces/daqp-python/setup.py @@ -9,7 +9,7 @@ # Copy C source try: - src_path = pathlib.Path(__file__).resolve().parent.parent.parent + src_path = pathlib.Path(os.environ["PWD"], "../../../daqp") except: src_path = [] csrc_dir = pathlib.Path('./csrc')