git: 06ac78be58f2 - main - science/py-dwave-neal: New port: DWave: Simulated annealing sampler for general Ising model graphs

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Sun, 14 Aug 2022 05:41:54 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=06ac78be58f2c94320969226e8187fa32bdf9815

commit 06ac78be58f2c94320969226e8187fa32bdf9815
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2022-08-14 05:41:24 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2022-08-14 05:41:24 +0000

    science/py-dwave-neal: New port: DWave: Simulated annealing sampler for general Ising model graphs
---
 science/Makefile                       |  1 +
 science/py-dwave-neal/Makefile         | 28 ++++++++++++++++++++++++++++
 science/py-dwave-neal/distinfo         |  3 +++
 science/py-dwave-neal/files/example.py |  9 +++++++++
 science/py-dwave-neal/pkg-descr        | 12 ++++++++++++
 5 files changed, 53 insertions(+)

diff --git a/science/Makefile b/science/Makefile
index b9924879e109..cd0d8cc5ec07 100644
--- a/science/Makefile
+++ b/science/Makefile
@@ -284,6 +284,7 @@
     SUBDIR += py-dimod
     SUBDIR += py-dipy
     SUBDIR += py-dlib
+    SUBDIR += py-dwave-neal
     SUBDIR += py-dwave-samplers
     SUBDIR += py-eccodes
     SUBDIR += py-esda
diff --git a/science/py-dwave-neal/Makefile b/science/py-dwave-neal/Makefile
new file mode 100644
index 000000000000..5bb7dad7ae25
--- /dev/null
+++ b/science/py-dwave-neal/Makefile
@@ -0,0 +1,28 @@
+PORTNAME=	dwave-neal
+DISTVERSION=	0.6.0.dev0
+CATEGORIES=	science graphics # quantum-computing
+MASTER_SITES=	CHEESESHOP
+PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
+
+MAINTAINER=	yuri@FreeBSD.org
+COMMENT=	DWave: Simulated annealing sampler for general Ising model graphs
+
+LICENSE=	APACHE20
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+PY_DEPENDS=	${PYTHON_PKGNAMEPREFIX}dimod>0:science/py-dimod@${PY_FLAVOR} \
+		${PYNUMPY}
+BUILD_DEPENDS=	${PY_DEPENDS}
+RUN_DEPENDS=	${PY_DEPENDS}
+
+USES=		python:3.7+
+USE_PYTHON=	distutils autoplist unittest
+
+TEST_ENV=	${MAKE_ENV} PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
+
+NO_ARCH=	yes
+
+do-test:
+	@${SETENV} ${TEST_ENV} ${PYTHON_CMD} ${FILESDIR}/example.py
+
+.include <bsd.port.mk>
diff --git a/science/py-dwave-neal/distinfo b/science/py-dwave-neal/distinfo
new file mode 100644
index 000000000000..3affefba0cad
--- /dev/null
+++ b/science/py-dwave-neal/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1660454526
+SHA256 (dwave-neal-0.6.0.dev0.tar.gz) = 209e872c325cbdd79f05364624ff562abdf7e3cd0c52ac8b7657fa4ae165b742
+SIZE (dwave-neal-0.6.0.dev0.tar.gz) = 6500
diff --git a/science/py-dwave-neal/files/example.py b/science/py-dwave-neal/files/example.py
new file mode 100644
index 000000000000..be734d9f7229
--- /dev/null
+++ b/science/py-dwave-neal/files/example.py
@@ -0,0 +1,9 @@
+import neal
+
+sampler = neal.SimulatedAnnealingSampler()
+
+h = {0: -1, 1: -1}
+J = {(0, 1): -1}
+sampleset = sampler.sample_ising(h, J)
+
+print(sampleset)
diff --git a/science/py-dwave-neal/pkg-descr b/science/py-dwave-neal/pkg-descr
new file mode 100644
index 000000000000..4232cdcfec2a
--- /dev/null
+++ b/science/py-dwave-neal/pkg-descr
@@ -0,0 +1,12 @@
+An implementation of a simulated annealing sampler.
+
+A simulated annealing sampler can be used for approximate Boltzmann sampling or
+heuristic optimization. This implementation approaches the equilibrium
+distribution by performing updates at a sequence of increasing beta values,
+beta_schedule, terminating at the target beta. Each spin is updated once in a
+fixed order per point in the beta_schedule according to a Metropolis- Hastings
+update. When beta is large the target distribution concentrates, at equilibrium,
+over ground states of the model. Samples are guaranteed to match the equilibrium
+for long 'smooth' beta schedules.
+
+WWW: https://github.com/dwavesystems/dwave-neal