aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuri Victorovich <yuri@FreeBSD.org>2022-08-14 05:10:45 +0000
committerYuri Victorovich <yuri@FreeBSD.org>2022-08-14 05:12:16 +0000
commit8d3f3285e2c0308ba64536f31ec8af82772f6464 (patch)
tree8b327f4241be253748dbe5114a94bf2888a5b90e
parent29ad935bb800a12512d3b5ad319a543a68429737 (diff)
downloadports-8d3f3285e2c0308ba64536f31ec8af82772f6464.tar.gz
ports-8d3f3285e2c0308ba64536f31ec8af82772f6464.zip
science/py-dwave-samplers: New port: DWave: Classical algorithms for solving binary quadratic models
-rw-r--r--science/Makefile1
-rw-r--r--science/py-dwave-samplers/Makefile39
-rw-r--r--science/py-dwave-samplers/distinfo3
-rw-r--r--science/py-dwave-samplers/files/example.py18
-rw-r--r--science/py-dwave-samplers/files/patch-pyproject.toml14
-rw-r--r--science/py-dwave-samplers/pkg-descr17
-rw-r--r--science/py-dwave-samplers/pkg-plist99
7 files changed, 191 insertions, 0 deletions
diff --git a/science/Makefile b/science/Makefile
index 269b4ca052c4..0889a5713634 100644
--- a/science/Makefile
+++ b/science/Makefile
@@ -285,6 +285,7 @@
SUBDIR += py-dimod
SUBDIR += py-dipy
SUBDIR += py-dlib
+ SUBDIR += py-dwave-samplers
SUBDIR += py-eccodes
SUBDIR += py-esda
SUBDIR += py-fresnel
diff --git a/science/py-dwave-samplers/Makefile b/science/py-dwave-samplers/Makefile
new file mode 100644
index 000000000000..46b52f29e30f
--- /dev/null
+++ b/science/py-dwave-samplers/Makefile
@@ -0,0 +1,39 @@
+PORTNAME= dwave-samplers
+DISTVERSION= 1.0.0.dev1
+CATEGORIES= science graphics # quantum-computing
+MASTER_SITES= CHEESESHOP
+PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
+
+MAINTAINER= yuri@FreeBSD.org
+COMMENT= DWave: Classical algorithms for solving binary quadratic models
+
+LICENSE= APACHE20
+LICENSE_FILE= ${WRKSRC}/LICENSE
+
+PY_DEPENDS= ${PYTHON_PKGNAMEPREFIX}dimod>0:science/py-dimod@${PY_FLAVOR} \
+ ${PYNUMPY} \
+ ${PYTHON_PKGNAMEPREFIX}reno>0:textproc/py-reno@${PY_FLAVOR}
+BUILD_DEPENDS= ${PY_DEPENDS}
+RUN_DEPENDS= ${PY_DEPENDS}
+
+USES= python:3.7+
+USE_PYTHON= distutils cython
+
+TEST_ENV= ${MAKE_ENV} PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
+
+post-install:
+ # fix file paths, workaround for https://github.com/dwavesystems/dwave-samplers/issues/31
+ @cd ${STAGEDIR}${PYTHON_SITELIBDIR} && ( \
+ for f in `${FIND} samplers -name "*.so"`; do \
+ echo "YURI moving $$f"; \
+ ${MV} $$f dwave/$$f; \
+ done; \
+ ${RM} -r samplers; \
+ )
+ # strip binaries
+ @${FIND} ${STAGEDIR}${PYTHON_SITELIBDIR}/dwave/samplers -name "*${PYTHON_EXT_SUFFIX}.so" | ${XARGS} ${STRIP_CMD}
+
+do-test:
+ @${SETENV} ${TEST_ENV} ${PYTHON_CMD} ${FILESDIR}/example.py
+
+.include <bsd.port.mk>
diff --git a/science/py-dwave-samplers/distinfo b/science/py-dwave-samplers/distinfo
new file mode 100644
index 000000000000..aeff9a31ab27
--- /dev/null
+++ b/science/py-dwave-samplers/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1660435305
+SHA256 (dwave-samplers-1.0.0.dev1.tar.gz) = 38ec9299851b37c65a6492e4fab4cd73f9426792f2a7641f66d28e8bc8d25e11
+SIZE (dwave-samplers-1.0.0.dev1.tar.gz) = 890511
diff --git a/science/py-dwave-samplers/files/example.py b/science/py-dwave-samplers/files/example.py
new file mode 100644
index 000000000000..bf60934ab7e5
--- /dev/null
+++ b/science/py-dwave-samplers/files/example.py
@@ -0,0 +1,18 @@
+##
+## Tree Decomposition example from README
+##
+
+from dwave.samplers import TreeDecompositionSolver
+solver = TreeDecompositionSolver()
+
+import dimod
+import networkx as nx
+
+tree = nx.balanced_tree(2, 5) # binary tree with a height of five
+bqm = dimod.BinaryQuadraticModel('SPIN')
+bqm.set_linear(0, .5)
+for u, v in tree.edges:
+ bqm.set_quadratic(u, v, 1)
+sampleset = solver.sample(bqm)
+
+print(sampleset)
diff --git a/science/py-dwave-samplers/files/patch-pyproject.toml b/science/py-dwave-samplers/files/patch-pyproject.toml
new file mode 100644
index 000000000000..766ddcf3941f
--- /dev/null
+++ b/science/py-dwave-samplers/files/patch-pyproject.toml
@@ -0,0 +1,14 @@
+--- pyproject.toml.orig 2022-08-14 01:10:52 UTC
++++ pyproject.toml
+@@ -3,9 +3,9 @@ requires = [
+ "setuptools>=46.4.0", # PEP-420 support, PEP-517/518 support, setup.cfg attr: support
+ "wheel>=0.30.0", # limited python api support
+ "cython>=0.29.24,<3.0",
+- 'dimod==0.11.3',
++ 'dimod>=0.11.3',
+ 'numpy==1.19.0;python_version<"3.9"', # C API for numpy.random
+- 'oldest-supported-numpy;python_version>="3.9"',
++ #'oldest-supported-numpy;python_version>="3.9"',
+ ]
+ build-backend = "setuptools.build_meta"
+
diff --git a/science/py-dwave-samplers/pkg-descr b/science/py-dwave-samplers/pkg-descr
new file mode 100644
index 000000000000..e580bf99ce0d
--- /dev/null
+++ b/science/py-dwave-samplers/pkg-descr
@@ -0,0 +1,17 @@
+Ocean software provides a variety of quantum, classical, and quantum-classical
+dimod samplers that run either remotely (for example, in D-Wave's Leap
+environment) or locally on your CPU.
+
+dwave-samplers implements the following classical algorithms for solving binary
+quadratic models (BQM):
+* Random: a sampler that draws uniform random samples.
+* Simulated Annealing: a probabilistic heuristic for optimization and
+ approximate Boltzmann sampling well suited to finding good solutions of large
+ problems.
+* Steepest Descent: a discrete analogue of gradient descent, often used in
+ machine learning, that quickly finds a local minimum.
+* Tabu: a heuristic that employs local search with methods to escape local
+ minima.
+* Tree Decomposition: an exact solver for problems with low treewidth.
+
+WWW: https://github.com/dwavesystems/dwave-samplers
diff --git a/science/py-dwave-samplers/pkg-plist b/science/py-dwave-samplers/pkg-plist
new file mode 100644
index 000000000000..036967b37442
--- /dev/null
+++ b/science/py-dwave-samplers/pkg-plist
@@ -0,0 +1,99 @@
+%%PYTHON_SITELIBDIR%%/dwave/samplers/__init__.py
+%%PYTHON_SITELIBDIR%%/dwave/samplers/__pycache__/__init__%%PYTHON_EXT_SUFFIX%%.opt-1.pyc
+%%PYTHON_SITELIBDIR%%/dwave/samplers/__pycache__/__init__%%PYTHON_EXT_SUFFIX%%.pyc
+%%PYTHON_SITELIBDIR%%/dwave/samplers/greedy/__init__.py
+%%PYTHON_SITELIBDIR%%/dwave/samplers/greedy/__pycache__/__init__%%PYTHON_EXT_SUFFIX%%.opt-1.pyc
+%%PYTHON_SITELIBDIR%%/dwave/samplers/greedy/__pycache__/__init__%%PYTHON_EXT_SUFFIX%%.pyc
+%%PYTHON_SITELIBDIR%%/dwave/samplers/greedy/__pycache__/composite%%PYTHON_EXT_SUFFIX%%.opt-1.pyc
+%%PYTHON_SITELIBDIR%%/dwave/samplers/greedy/__pycache__/composite%%PYTHON_EXT_SUFFIX%%.pyc
+%%PYTHON_SITELIBDIR%%/dwave/samplers/greedy/__pycache__/sampler%%PYTHON_EXT_SUFFIX%%.opt-1.pyc
+%%PYTHON_SITELIBDIR%%/dwave/samplers/greedy/__pycache__/sampler%%PYTHON_EXT_SUFFIX%%.pyc
+%%PYTHON_SITELIBDIR%%/dwave/samplers/greedy/composite.py
+%%PYTHON_SITELIBDIR%%/dwave/samplers/greedy/decl.pxd
+%%PYTHON_SITELIBDIR%%/dwave/samplers/greedy/descent.cpp
+%%PYTHON_SITELIBDIR%%/dwave/samplers/greedy/descent%%PYTHON_EXT_SUFFIX%%.so
+%%PYTHON_SITELIBDIR%%/dwave/samplers/greedy/descent.pyx
+%%PYTHON_SITELIBDIR%%/dwave/samplers/greedy/sampler.py
+%%PYTHON_SITELIBDIR%%/dwave/samplers/greedy/src/descent.cpp
+%%PYTHON_SITELIBDIR%%/dwave/samplers/greedy/src/descent.h
+%%PYTHON_SITELIBDIR%%/dwave/samplers/random/__init__.py
+%%PYTHON_SITELIBDIR%%/dwave/samplers/random/__pycache__/__init__%%PYTHON_EXT_SUFFIX%%.opt-1.pyc
+%%PYTHON_SITELIBDIR%%/dwave/samplers/random/__pycache__/__init__%%PYTHON_EXT_SUFFIX%%.pyc
+%%PYTHON_SITELIBDIR%%/dwave/samplers/random/__pycache__/sampler%%PYTHON_EXT_SUFFIX%%.opt-1.pyc
+%%PYTHON_SITELIBDIR%%/dwave/samplers/random/__pycache__/sampler%%PYTHON_EXT_SUFFIX%%.pyc
+%%PYTHON_SITELIBDIR%%/dwave/samplers/random/cyrandom.cpp
+%%PYTHON_SITELIBDIR%%/dwave/samplers/random/cyrandom%%PYTHON_EXT_SUFFIX%%.so
+%%PYTHON_SITELIBDIR%%/dwave/samplers/random/cyrandom.pyx
+%%PYTHON_SITELIBDIR%%/dwave/samplers/random/sampler.py
+%%PYTHON_SITELIBDIR%%/dwave/samplers/sa/__init__.py
+%%PYTHON_SITELIBDIR%%/dwave/samplers/sa/__pycache__/__init__%%PYTHON_EXT_SUFFIX%%.opt-1.pyc
+%%PYTHON_SITELIBDIR%%/dwave/samplers/sa/__pycache__/__init__%%PYTHON_EXT_SUFFIX%%.pyc
+%%PYTHON_SITELIBDIR%%/dwave/samplers/sa/__pycache__/sampler%%PYTHON_EXT_SUFFIX%%.opt-1.pyc
+%%PYTHON_SITELIBDIR%%/dwave/samplers/sa/__pycache__/sampler%%PYTHON_EXT_SUFFIX%%.pyc
+%%PYTHON_SITELIBDIR%%/dwave/samplers/sa/sampler.py
+%%PYTHON_SITELIBDIR%%/dwave/samplers/sa/simulated_annealing.cpp
+%%PYTHON_SITELIBDIR%%/dwave/samplers/sa/simulated_annealing%%PYTHON_EXT_SUFFIX%%.so
+%%PYTHON_SITELIBDIR%%/dwave/samplers/sa/simulated_annealing.pyx
+%%PYTHON_SITELIBDIR%%/dwave/samplers/sa/src/cpu_sa.cpp
+%%PYTHON_SITELIBDIR%%/dwave/samplers/sa/src/cpu_sa.h
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tabu/__init__.py
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tabu/__pycache__/__init__%%PYTHON_EXT_SUFFIX%%.opt-1.pyc
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tabu/__pycache__/__init__%%PYTHON_EXT_SUFFIX%%.pyc
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tabu/__pycache__/sampler%%PYTHON_EXT_SUFFIX%%.opt-1.pyc
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tabu/__pycache__/sampler%%PYTHON_EXT_SUFFIX%%.pyc
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tabu/__pycache__/utils%%PYTHON_EXT_SUFFIX%%.opt-1.pyc
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tabu/__pycache__/utils%%PYTHON_EXT_SUFFIX%%.pyc
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tabu/sampler.py
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tabu/src/bqp.cpp
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tabu/src/bqp.h
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tabu/src/common.h
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tabu/src/tabu_search.cpp
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tabu/src/tabu_search.h
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tabu/src/tabu_utils.cpp
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tabu/src/tabu_utils.h
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tabu/tabu.pxd
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tabu/tabu_search.cpp
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tabu/tabu_search%%PYTHON_EXT_SUFFIX%%.so
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tabu/tabu_search.pyx
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tabu/utils.py
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tree/__init__.py
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tree/__pycache__/__init__%%PYTHON_EXT_SUFFIX%%.opt-1.pyc
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tree/__pycache__/__init__%%PYTHON_EXT_SUFFIX%%.pyc
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tree/__pycache__/samplers%%PYTHON_EXT_SUFFIX%%.opt-1.pyc
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tree/__pycache__/samplers%%PYTHON_EXT_SUFFIX%%.pyc
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tree/orang.pxd
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tree/sample.cpp
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tree/sample%%PYTHON_EXT_SUFFIX%%.so
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tree/sample.pyx
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tree/samplers.py
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tree/solve.cpp
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tree/solve%%PYTHON_EXT_SUFFIX%%.so
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tree/solve.pyx
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tree/src/include/base.h
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tree/src/include/buckettree.h
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tree/src/include/combine.h
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tree/src/include/exception.h
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tree/src/include/graph.h
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tree/src/include/marginalizer.h
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tree/src/include/merger.h
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tree/src/include/operations/count.h
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tree/src/include/operations/dummy.h
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tree/src/include/operations/logsumprod.h
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tree/src/include/operations/min.h
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tree/src/include/orang.h
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tree/src/include/sample.hpp
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tree/src/include/solve.hpp
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tree/src/include/table.h
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tree/src/include/task.h
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tree/src/include/treedecomp.h
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tree/src/include/utils.hpp
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tree/src/include/varorder.h
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tree/utilities.cpp
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tree/utilities%%PYTHON_EXT_SUFFIX%%.so
+%%PYTHON_SITELIBDIR%%/dwave/samplers/tree/utilities.pyx
+%%PYTHON_SITELIBDIR%%/dwave_samplers-1.0.0.dev1-py%%PYTHON_VER%%.egg-info/PKG-INFO
+%%PYTHON_SITELIBDIR%%/dwave_samplers-1.0.0.dev1-py%%PYTHON_VER%%.egg-info/SOURCES.txt
+%%PYTHON_SITELIBDIR%%/dwave_samplers-1.0.0.dev1-py%%PYTHON_VER%%.egg-info/dependency_links.txt
+%%PYTHON_SITELIBDIR%%/dwave_samplers-1.0.0.dev1-py%%PYTHON_VER%%.egg-info/not-zip-safe
+%%PYTHON_SITELIBDIR%%/dwave_samplers-1.0.0.dev1-py%%PYTHON_VER%%.egg-info/requires.txt
+%%PYTHON_SITELIBDIR%%/dwave_samplers-1.0.0.dev1-py%%PYTHON_VER%%.egg-info/top_level.txt