Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 13 additions & 8 deletions interfaces/daqp-python/daqp.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -87,24 +89,27 @@ 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:
blower = np.full(m, -DAQP_INF)
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
else:
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,
Expand Down
Loading