Welcome to Dynex SDK’s documentation!
Note: The latest files are availabe in our GitHub DynexSDK
Getting Started with the Dynex SDK
The Dynex SDK is a collection of open-source Python tools designed to tackle difficult problems using n.quantum computing. It helps adapt your application’s challenges for resolution on the Dynex platform and manages the communication between your application code and the n.quantum system seamlessly. This section introduces the Dynex Neuromorphic Computing Platform and the Dynex SDK, describes the basics of how it works, and explains with simple examples how to use it to solve problems and how to use it for Machine Learning.
You can also join the Dynex workspace on Slack to learn more and to interact with the developer community.
Videos
The following videos are available to explain how to use the Dynex SDK:
Guides
Computing on Quantum or neuromorphic systems is fundamentally different than using traditional hardware and is a very active area of research with new algorithms surfacing almost on a weekly basis. Our guides are step-by-step instructions on how to utilise neuromorphic computing with the Dynex SDK. These examples are just some of multiple possibilities to perform machine learning tasks. However, they can be easily adopted to other use cases.
Medium: Computing on the Dynex Neuromorphic Platform: Image Classification
Medium: Computing on the Dynex Neuromorphic Platform: IBM Qiskit 4-Qubit Full Adder Circuit
Medium: Benchmarking the Dynex Neuromorphic Platform with the Q-Score
Medium: Enhancing MaxCut Solutions: Dynex’s Benchmark Performance on G70 Using Quantum Computing
Book
Neuromorphic Computing for Computer Scientists: A complete guide to Neuromorphic Computing on the Dynex Neuromorphic Cloud Computing Platform, Dynex Developers, 2024, 249 pages, available as eBook, paperback and hardcover
Dynex Scientific Papers
Advancements in Unsupervised Learning: Mode-Assisted Quantum Restricted Boltzmann Machines Leveraging Neuromorphic Computing on the Dynex Platform; Adam Neumann, Dynex Developers; International Journal of Bioinformatics & Intelligent Computing. 2024; Volume 3(1):91- 103, ISSN 2816-8089
HUBO & QUBO and Prime Factorization; Samer Rahmeh, Cali Technology Solutions, Dynex Developers; International Journal of Bioinformatics & Intelligent Computing. 2024; Volume 3(1):45-69, ISSN 2816-8089
Framework for Solving Harrow-Hassidim-Lloyd Problems with Neuromorphic Computing using the Dynex Cloud Computing Platform; Samer Rahmeh, Cali Technology Solutions, Dynex Developers; 112871175; Academia.edu; 2023
Quantum Frontiers on Dynex: Elevating Deep Restricted Boltzmann Machines with Quantum Mode-Assisted Training; Adam Neumann, Dynex Developers; 116660843, Academia.edu; 2024
Using the Dynex SDK
Introduces the Dynex SDK and provides references to usage information. The Dynex Platform is intended to solve arbitrary application problems formulated as quadratic models. Problems submitted directly to the Dynex Platform are in the binary quadratic model format, unconstrained with binary-valued variables and structured for the topology of the Dynex Chips. They also accept arbitrarily structured quadratic models, constrained or unconstrained, with real, integer, and binary variables. The Dynex Platform, which implement state-of-the-art neuromorphic computations, is designed to accommodate even very large problems.
Pricing
Free prototyping and testing
A free sampler designed for prototyping and testing, enabling users to sample computing problems locally on their machines before deploying to the Dynex Neuromorphic Computing cloud is available. This tool is particularly useful for developers and researchers who are in the initial stages of project development, allowing them to fine-tune and test their code in a controlled, cost-free environment. By providing this capability, we aim to facilitate seamless code development and ensure that your applications are fully optimized and error-free prior to scaling up operations on the cloud. This not only enhances development efficiency but also helps in significantly reducing potential overheads associated with live deployments.
Customers can also experience the power of Dynex n.quantum computing with just one click by trying out a variety of examples for free. Simply register an account to access these advanced computational capabilities. The user-friendly platform makes it easy to get started, allowing exploration of the potential of neuromorphic quantum computing through practical, real-world examples.
Dynex subscription plans
Dynex’ subscription model is designed to provide users with continuous access to its advanced neuromorphic computing platform. This model allows businesses and researchers to leverage Dynex’s powerful computing capabilities through a recurring payment structure, offering a scalable and cost-effective solution for complex computational needs. Subscribers can choose from various tiers, each tailored to different usage requirements and budgets, ensuring that users only pay for the computing power they need. This subscription model not only simplifies budgeting and planning but also ensures that users can consistently rely on Dynex for high-performance computing resources without the need for large upfront investments. Each tier provides progressively more powerful computing capabilities and enhanced support features to meet the diverse needs of our users, from individual developers to large enterprises.
Sampler Properties and Parameters
This guide details limitations on problem size, the range of time allowed for solving problems, etc and input arguments that enable you to configure execution. The following example shows sampling of a QUBO problem:
import dynex
import dimod
from pyqubo import Array
N = 15
K = 3
numbers = [4.8097315016016315, 4.325157567810298, 2.9877429101815127,
3.199880179616316, 0.5787939511978596, 1.2520928214246918,
2.262867466401502, 1.2300003067401255, 2.1601079352817925,
3.63753899583021, 4.598232793833491, 2.6215815162575646,
3.4227134835783364, 0.28254151584552023, 4.2548151473817075]
q = Array.create('q', N, 'BINARY')
H = sum(numbers[i] * q[i] for i in range(N)) + 5.0 * (sum(q) - K)**2
model = H.compile()
Q, offset = model.to_qubo(index_label=True)
sampleset = dynex.sample_qubo(Q, offset, mainnet=False, num_reads=50000, annealing_time = 200);
print('Result:')
print(sampleset)
[DYNEX] PRECISION SET TO 0.001
[DYNEX] SAMPLER INITIALISED
[DYNEX|TESTNET] *** WAITING FOR READS ***
╭────────────┬─────────────┬───────────┬───────────────────────────┬─────────┬─────────┬────────────────╮
│ DYNEXJOB │ BLOCK FEE │ ELAPSED │ WORKERS READ │ CHIPS │ STEPS │ GROUND STATE │
├────────────┼─────────────┼───────────┼───────────────────────────┼─────────┼─────────┼────────────────┤
│ -1 │ 0 │ │ *** WAITING FOR READS *** │ │ │ │
╰────────────┴─────────────┴───────────┴───────────────────────────┴─────────┴─────────┴────────────────╯
[DYNEX] FINISHED READ AFTER 0.00 SECONDS
[DYNEX] SAMPLESET READY
Result:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 energy num_oc.
0 0 1 0 0 0 0 0 1 0 0 1 0 0 0 0 2.091336 1
['BINARY', 1 rows, 1 samples, 15 variables]
AutoQUBO: Automated Conversion from Python functions to QUBO
AUTOmated QUBO Generator (by Fujitsu Research) is an automatic tool for converting a high-level description of an optimization problem, written in Python, into an equivalent QUBO representation. It is doing this by using a novel data driven translation method that can completely decouple the input and output representation. The QUBO framework provides a way to model, in principle, any combinatorial optimization problem and enables the use of Ising machines, like available on the Dynex Platform, to solve it. It introduces symbolic sampling, which provides QUBO formulations for entire problem classes.
The following example shows a portfolio optimisation problem:
import csv
import numpy as np
import dynex
from autoqubo import Binarization, SamplingCompiler, SearchSpace, Utils
with open('data/portfolio.txt') as csv_file:
csv_reader = csv.reader(csv_file, delimiter=',')
n, budget = map(int, next(csv_reader))
cov_matrix = np.zeros((n, n))
mean_vector = np.zeros(n)
for row in csv_reader:
if len(row) == 2:
i, v = map(int, row)
mean_vector[i] = v
elif len(row) == 3:
i, j, v = map(int, row)
cov_matrix[i, j] = v
else:
raise ValueError
def variance(x):
"""
Variance
"""
return x@cov_matrix@x
def mean(x):
"""
Mean return
"""
return x@mean_vector
def constraint(x):
"""
Budget constraint
"""
return (x.sum() - budget)**2
# Optimisation function
A, B, C = 1, -1, 100
# Mean-variance portfolio optimization model
def f(x):
return A*variance(x) + B*mean(x) + C*constraint(x)
# Automatically generate the QUBO problem:
s = SearchSpace()
weights_vector = Binarization.get_uint_vector_type(3, 3)
s.add('x', weights_vector, 3 * 3)
qubo, offset = SamplingCompiler.generate_qubo_matrix(fitness_function=f, input_size=s.size, searchspace=s, use_multiprocessing=False)
# Compute on Dynex:
print("Best solutions (minimize):")
sampleset = dynex.sample_qubo(qubo, offset, mainnet=False, num_reads=1024, annealing_time=200)
print(sampleset)
# Output Solution:
sol = sampleset.record[0][0]
x = s.decode_dict(sol)['x']
e = sampleset.first.energy
print(
f"x={x}, "
f"energy={e}, "
f"obj={variance(x)-mean(x)}, "
f"constraint={constraint(x)}"
)
Output:
Best solutions (minimize):
[DYNEX] PRECISION SET TO 0.1
[DYNEX] SAMPLER INITIALISED
[DYNEX|TESTNET] *** WAITING FOR READS ***
╭────────────┬─────────────┬───────────┬───────────────────────────┬─────────┬─────────┬────────────────╮
│ DYNEXJOB │ BLOCK FEE │ ELAPSED │ WORKERS READ │ CHIPS │ STEPS │ GROUND STATE │
├────────────┼─────────────┼───────────┼───────────────────────────┼─────────┼─────────┼────────────────┤
│ -1 │ 0 │ │ *** WAITING FOR READS *** │ │ │ │
╰────────────┴─────────────┴───────────┴───────────────────────────┴─────────┴─────────┴────────────────╯
[DYNEX] FINISHED READ AFTER 0.00 SECONDS
[DYNEX] SAMPLESET READY
0 1 2 3 4 5 6 7 8 energy num_oc.
0 1 0 0 0 0 0 1 1 0 20.0 1
['BINARY', 1 rows, 1 samples, 9 variables]
x=[1 0 3], energy=20.0, obj=20.0, constraint=0
Qubolite: light-weight toolbox for working with QUBO instances in NumPy
Quantum Computing (QC) has ushered in a new era of computation, promising to solve problems that are practically infeasible for classical computers. One of the most exciting applications of quantum computing is its ability of solving combinatorial optimization problems, such as Quadratic Unconstrained Binary Optimization (QUBO). This problem class has regained significant attention with the advent of Quantum Computing. These hard-to-solve combinatorial problems appear in many different domains, including finance, logistics, Machine Learning and Data Mining. To harness the power of Quantum Computing for QUBO, The Lamarr Institute introduced qubolite, a Python package comprising utilities for creating, analyzing, and solving QUBO instances, which incorporates current research algorithms developed by scientists at the Lamarr Institute. Qubolite is a light-weight toolbox for working with QUBO instances in NumPy. This fork showcases the use of Qubolite to compute on the Dynex Neuromorphic computing platform.
The following examples shows a k-means clustering algorithm:
import dynex
from sklearn.datasets import make_blobs
from qubolite.embedding import Kernel2MeansClustering
# Generate a dataset:
X, y = make_blobs(n_samples=300, centers=2, random_state=42)
# Create QUBO:
Q = Kernel2MeansClustering(X).qubo
# Compute on Dynex:
sampleset = dynex.sample_qubo(Q.m, mainnet=False, num_reads=1024, annealing_time=200, debugging=False, bnb=False)
print(sampleset)
# Visualize result:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
x1,y1 = np.array(X).T
for i in range(0,len(X)):
if sampleset.first.sample[i]==0:
plt.plot(X[i][0],X[i][1], 'o', color='blue');
else:
plt.plot(X[i][0],X[i][1], 'o', color='red');
Output:
[DYNEX] PRECISION SET TO 0.01
[DYNEX] SAMPLER INITIALISED
[DYNEX|TESTNET] *** WAITING FOR READS ***
╭────────────┬─────────────┬───────────┬───────────────────────────┬─────────┬─────────┬────────────────╮
│ DYNEXJOB │ BLOCK FEE │ ELAPSED │ WORKERS READ │ CHIPS │ STEPS │ GROUND STATE │
├────────────┼─────────────┼───────────┼───────────────────────────┼─────────┼─────────┼────────────────┤
│ -1 │ 0 │ │ *** WAITING FOR READS *** │ │ │ │
╰────────────┴─────────────┴───────────┴───────────────────────────┴─────────┴─────────┴────────────────╯
[DYNEX] FINISHED READ AFTER 0.00 SECONDS
[DYNEX] SAMPLESET READY
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 ... 299 energy num_oc.
0 1 1 0 1 1 1 0 1 0 0 0 0 0 0 1 ... 1 -577035.387644 1
['BINARY', 1 rows, 1 samples, 300 variables]
PyQUBO: QUBOs or Ising Models from Flexible Mathematical Expressions
PyQUBO allows you to create QUBOs or Ising models from flexible mathematical expressions easily. It is Python based (C++ backend), fully integrated with Ocean SDK, supports automatic validation of constraints and features placeholder for parameter tuning.
import dynex
import dimod
from pyqubo import Array
N = 15
K = 3
numbers = [4.8097315016016315, 4.325157567810298, 2.9877429101815127,
3.199880179616316, 0.5787939511978596, 1.2520928214246918,
2.262867466401502, 1.2300003067401255, 2.1601079352817925,
3.63753899583021, 4.598232793833491, 2.6215815162575646,
3.4227134835783364, 0.28254151584552023, 4.2548151473817075]
q = Array.create('q', N, 'BINARY')
H = sum(numbers[i] * q[i] for i in range(N)) + 5.0 * (sum(q) - K)**2
model = H.compile()
Q, offset = model.to_qubo(index_label=True)
sampleset = dynex.sample_qubo(Q, offset, mainnet=False, description='Dynex SDK job', num_reads=50000, annealing_time = 200);
print('Result:')
print(sampleset)
Result:
[DYNEX] PRECISION SET TO 0.001
[DYNEX] SAMPLER INITIALISED
[DYNEX|TESTNET] *** WAITING FOR READS ***
╭────────────┬─────────────┬───────────┬───────────────────────────┬─────────┬─────────┬────────────────╮
│ DYNEXJOB │ BLOCK FEE │ ELAPSED │ WORKERS READ │ CHIPS │ STEPS │ GROUND STATE │
├────────────┼─────────────┼───────────┼───────────────────────────┼─────────┼─────────┼────────────────┤
│ -1 │ 0 │ │ *** WAITING FOR READS *** │ │ │ │
╰────────────┴─────────────┴───────────┴───────────────────────────┴─────────┴─────────┴────────────────╯
[DYNEX] FINISHED READ AFTER 0.00 SECONDS
[DYNEX] SAMPLESET READY
Result:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 energy num_oc.
0 0 1 0 0 0 0 0 1 0 0 1 0 0 0 0 2.091336 1
['BINARY', 1 rows, 1 samples, 15 variables]
Problem-Solving Handbook
Provides advanced guidance on using the Dynex Platform, in particular the Dynex SDK. It lists, explains, and demonstrates techniques of problem formulation and configuring parameters to optimize performance.
Neuromorphic Machine Learning
Demonstrates various examples of neuromorphic enhanced Machine Learning techniques, for example Quantum-Boltzmann-Machines or feature optimisation with QBoost. Quantum computing algorithms for machine learning harness the power of quantum mechanics to enhance various aspects of machine learning tasks. As both, quantum computing and neuromorphic computing are sharing similar features, these algorithms can also be computed efficiently on the Dynex platform – but without the limitations of limited qubits, error correction or availability.
Here are some example of these algorithms implemented on the Dynex Platform:
Example: Quantum-Support-Vector-Machine Implementation on Dynex | Scientific background: Rounds, Max and Phil Goddard. “Optimal feature selection in credit scoring and classification using a quantum annealer.” (2017)
Example: Quantum-Boltzmann-Machine (PyTorch) on Dynex | Scientific background: Dixit V, Selvarajan R, Alam MA, Humble TS and Kais S (2021) Training Restricted Boltzmann Machines With a D-Wave Quantum Annealer. Front. Phys. 9:589626. doi: 10.3389/fphy.2021.589626; Sleeman, Jennifer, John E. Dorband and Milton Halem. “A Hybrid Quantum enabled RBM Advantage: Convolutional Autoencoders For Quantum Image Compression and Generative Learning.” Defense + Commercial Sensing (2020)
Example: Quantum-Boltzmann-Machine Implementation (3-step QUBO) on Dynex | Scientific background: Dixit V, Selvarajan R, Alam MA, Humble TS and Kais S (2021) Training Restricted Boltzmann Machines With a D-Wave Quantum Annealer. Front. Phys. 9:589626. doi: 10.3389/fphy.2021.589626; Sleeman, Jennifer, John E. Dorband and Milton Halem. “A Hybrid Quantum enabled RBM Advantage: Convolutional Autoencoders For Quantum Image Compression and Generative Learning.” Defense + Commercial Sensing (2020)
Example: Quantum-Boltzmann-Machine (Collaborative Filtering) on Dynex | Scientific background: Dixit V, Selvarajan R, Alam MA, Humble TS and Kais S (2021) Training Restricted Boltzmann Machines With a D-Wave Quantum Annealer. Front. Phys. 9:589626. doi: 10.3389/fphy.2021.589626; Sleeman, Jennifer, John E. Dorband and Milton Halem. “A Hybrid Quantum enabled RBM Advantage: Convolutional Autoencoders For Quantum Image Compression and Generative Learning.” Defense + Commercial Sensing (2020)
Example: Quantum-Boltzmann-Machine Implementation on Dynex | Scientific background: Dixit V, Selvarajan R, Alam MA, Humble TS and Kais S (2021) Training Restricted Boltzmann Machines With a D-Wave Quantum Annealer. Front. Phys. 9:589626. doi: 10.3389/fphy.2021.589626; Sleeman, Jennifer, John E. Dorband and Milton Halem. “A Hybrid Quantum enabled RBM Advantage: Convolutional Autoencoders For Quantum Image Compression and Generative Learning.” Defense + Commercial Sensing (2020)
Example: Feature Selection - Titanic Survivals | Scientific background: Xuan Vinh Nguyen, Jeffrey Chan, Simone Romano, and James Bailey. 2014. Effective global approaches for mutual information based feature selection. In Proceedings of the 20th ACM SIGKDD international conference on Knowledge discovery and data mining (KDD ‘14). Association for Computing Machinery, New York, NY, USA, 512–521
Example: Breast Cancer Prediction using the Dynex scikit-learn Plugin | Scientific background: Bhatia, H.S., Phillipson, F. (2021). Performance Analysis of Support Vector Machine Implementations on the D-Wave Quantum Annealer. In: Paszynski, M., Kranzlmüller, D., Krzhizhanovskaya, V.V., Dongarra, J.J., Sloot, P.M.A. (eds) Computational Science – ICCS 2021. ICCS 2021. Lecture Notes in Computer Science(), vol 12747. Springer, Cham
Dynex TensorFlow Library
Details how to work with Dynex Neuromorphic torch layers, which can be used in any NN model, in Google Tensorflow. Examples include hybrid models, neuromorphic-, transfer- and federated-learning.
Dynex PyTorch Library
Details how to work with Dynex Neuromorphic torch layers, which can be used in any NN model, in PyTorch. Examples include hybrid models, neuromorphic-, transfer- and federated-learning.
Dynex Quantum-CFD Library
This repository provides a Python class used to converting the Harrow-Hassidim-Lloyd (HHL) algorithm, typically used for solving linear systems on quantum computers, into a Quadratic Uncon- strained Binary Optimization (QUBO) model termed as ”QCFD” to be computed on DYNEX Neuromorphic Network. This adaptation allows the use of classical and quantum-inspired solvers (a.k.a Simulated Annealing Sampler) and DYNEX Network users for finding solutions.
Dynex Quantum-SISR Library
Implementation of a Quantum Single Image Super-Resolution algorithm to use on the Dynex platform. One of the well-known classical approaches for SISR relies on the well-established patch-wise sparse modeling of the problem. Yet, this field’s current state of affairs is that deep neural networks (DNNs) have demonstrated far superior results than traditional approaches. Nevertheless, quantum computing is expected to become increasingly prominent for machine learning problems soon. Among the two paradigms of quantum computing, namely universal gate quantum computing and adiabatic quantum computing (AQC), the latter has been successfully applied to practical computer vision problems, in which quantum parallelism has been exploited to solve combinatorial optimization efficiently.
Dynex Qiskit class
Recent advances in quantum hardware have resulted in the first systems becoming publicly available. On one hand, gate-based quantum computers have been designed, such as the IBM Q, Rigetti’s Aspen, or IonQ’s systems using using superconducting transmons or ion tubes. On the other hand, adibiatic quantum computing and neuromorphic computing has emerged as another possibility to leverage physics inspired computations. It was shown that adiabatic quantum computing can solve the same problems as gate-based (universal) quantum computing given at least two degrees of freedom for 2-local Hamiltonian [3,4,5]. The Dynex Neuromorphic platform supports a 2-local Ising Hamiltonian with a single degree of freedom, which is why it is believed to only solve a subset of the problems that can be expressed by gate-based (universal) quantum machines. In 2014, Warren outlined how a set of universal quantum gates could be realized in adiabatic form using D-Wave’s annealing abstraction [1]. This is demonstrated, among others, for C-NOT, Toffoli (CC-NOT), Swap and C-Swap (Fredkin) gates in a {0, 1} base of qubit states, and for the Hadamard gate in a two-vector 0i,1i base.
Thanks to groundbreaking research from Richard H. Warren, it is possible to directly translate Qiskit quantum circuits into Dynex Neuromorphic chips. The concept behind is a direct translation of Qiskit objects, but instead of running on IBM Q, the circuits are executed on the Dynex Neuromorphic platform. Here is an example of a one-qubit adder circuit using this approach:
from dynexsdk.qiskit import QuantumRegister, ClassicalRegister
from dynexsdk.qiskit import QuantumCircuit, execute
# Input Registers: a = qi[0]; b = qi[1]; ci = qi[2]
qi = QuantumRegister(3)
ci = ClassicalRegister(3)
# Output Registers: s = qo[0]; co = qo[1]
qo = QuantumRegister(2)
co = ClassicalRegister(2)
circuit = QuantumCircuit(qi,qo,ci,co)
# Define adder circuit
for idx in range(3):
circuit.ccx(qi[idx], qi[(idx+1)%3], qo[1])
for idx in range(3):
circuit.cx(qi[idx], qo[0])
circuit.measure(qo, co)
# Run
execute(circuit)
# Print
print(circuit)
Dynex Scikit-Learn Plugin
This package provides a scikit-learn transformer for feature selection using the Dynex Neuromorphic Computing Platform. It is built to integrate seamlessly with scikit-learn, an industry-standard, state-of-the-art ML library for Python. This plug-in makes it easier to use the Dynex platform for the feature selection piece of ML workflows. Feature selection – a key building block of machine learning – is the problem of determining a small set of the most representative characteristics to improve model training and performance in ML. With this new plug-in, ML developers need not be experts in optimization or hybrid solving to get the business and technical benefits of both. Developers creating feature selection applications can build a pipeline with scikit-learn and then embed the Dynex Platform into this workflow more easily and efficiently. The package’s main class, SelectFromQuadraticModel, can be used in any existing sklearn pipeline.