mirror of
https://git.freebsd.org/ports.git
synced 2025-06-01 19:06:28 -04:00
math/py-daqp: New port: DAQP: A dual active-set QP solver
This commit is contained in:
parent
5d36a85f4a
commit
ddf031fc0c
5 changed files with 54 additions and 0 deletions
|
@ -958,6 +958,7 @@
|
|||
SUBDIR += py-cvxpy
|
||||
SUBDIR += py-cyipopt
|
||||
SUBDIR += py-cypari2
|
||||
SUBDIR += py-daqp
|
||||
SUBDIR += py-deap
|
||||
SUBDIR += py-dgl
|
||||
SUBDIR += py-diffcp
|
||||
|
|
25
math/py-daqp/Makefile
Normal file
25
math/py-daqp/Makefile
Normal file
|
@ -0,0 +1,25 @@
|
|||
PORTNAME= daqp
|
||||
DISTVERSION= 0.6.0
|
||||
CATEGORIES= math python
|
||||
MASTER_SITES= PYPI
|
||||
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
|
||||
|
||||
MAINTAINER= yuri@FreeBSD.org
|
||||
COMMENT= DAQP: A dual active-set QP solver
|
||||
WWW= https://github.com/darnstrom/daqp
|
||||
|
||||
LICENSE= MIT
|
||||
LICENSE_FILE= ${WRKSRC}/LICENSE
|
||||
|
||||
USES= python
|
||||
USE_PYTHON= distutils cython autoplist
|
||||
|
||||
TEST_ENV= ${MAKE_ENV} PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
|
||||
|
||||
post-install:
|
||||
@${STRIP_CMD} ${STAGEDIR}${PYTHON_SITELIBDIR}/daqp${PYTHON_EXT_SUFFIX}.so
|
||||
|
||||
do-test:
|
||||
@${SETENV} ${TEST_ENV} ${PYTHON_CMD} ${FILESDIR}/test.py
|
||||
|
||||
.include <bsd.port.mk>
|
3
math/py-daqp/distinfo
Normal file
3
math/py-daqp/distinfo
Normal file
|
@ -0,0 +1,3 @@
|
|||
TIMESTAMP = 1740123369
|
||||
SHA256 (daqp-0.6.0.tar.gz) = baf8b25fe7cbdbb09da0783cb47479d2dcb2bc927ceffc15836766529d3c962f
|
||||
SIZE (daqp-0.6.0.tar.gz) = 169992
|
18
math/py-daqp/files/test.py
Normal file
18
math/py-daqp/files/test.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
# Import relevant modules
|
||||
import daqp
|
||||
import numpy as np
|
||||
from ctypes import *
|
||||
import ctypes.util
|
||||
|
||||
# Define the problem
|
||||
H = np.array([[1, 0], [0, 1]],dtype=c_double)
|
||||
f = np.array([1, 1],dtype=c_double)
|
||||
A = np.array([[1, 2], [1, -1]],dtype=c_double)
|
||||
bupper = np.array([1,2,3,4],dtype=c_double)
|
||||
blower = np.array([-1,-2,-3,-4],dtype=c_double)
|
||||
sense = np.array([0,0,0,0],dtype=c_int)
|
||||
|
||||
print('solving ...')
|
||||
(xstar,fval,exitflag,info) = daqp.solve(H,f,A,bupper,blower,sense)
|
||||
|
||||
print(f'solution: xstar={xstar} fval={fval} exitflag={exitflag} info={info}')
|
7
math/py-daqp/pkg-descr
Normal file
7
math/py-daqp/pkg-descr
Normal file
|
@ -0,0 +1,7 @@
|
|||
DAQP is a dual active-set solver that solves convex quadratic programs
|
||||
of the form:
|
||||
|
||||
minimize 0.5 x' H x + f' x
|
||||
|
||||
subject to l <= x <= u
|
||||
bl <= Ax <= bu.
|
Loading…
Add table
Reference in a new issue