Skip to main content

NEC

NEC is developing quantum annealers using superconducting parametron qubits with a greater number of all-to-all connected qubits.

Solver

ModelSolvers
Quadratic Unconstrained Binary Optimization (QUBO)nec.vector_annealer, nec_3.vector_annealer

QUBO

import strangeworks as sw
from strangeworks_optimization import StrangeworksOptimizer
from strangeworks_optimization_models.parameter_models import NEC2ParameterModel
from dimod import BinaryQuadraticModel

sw.authenticate(api_key)

linear = {1: -2, 2: -2, 3: -3, 4: -3, 5: -2}
quadratic = {(1, 2): 2, (1, 3): 2, (2, 4): 2, (3, 4): 2, (3, 5): 2, (4, 5): 2}
model = BinaryQuadraticModel(linear, quadratic, "BINARY")

options = NEC2ParameterModel(offset=0, num_reads=2, num_results=2, timeout=100)

solver = "nec.vector_annealer"

so = StrangeworksOptimizer(
model=model,
solver=solver,
options=options)
sw_job = so.run()

print(f"Job slug: {sw_job.slug}")
print(f"Job status: {so.status(sw_job.slug)}")

results = so.results(sw_job.slug)

Native QUBO

The native NEC QUBO Dictionary is a representation of a Quadratic Unconstrained Binary Optimization (QUBO) problem. In the QUBO Dictionary, each key-value pair represents a term in the QUBO problem. The keys are tuples that represent the variables involved in the term, and the values represent the coefficients of those terms.

For example, a QUBO Dictionary may look like this:

QuboDict({("x1", "x1"): 1.0, ("x1", "x2"): -2.0})

In this case, the QUBO problem has two variables, x1 and x2. The first term (x1, x1) has a coefficient of 1.0, and the second term (x1, x2) has a coefficient of -2.0.

import strangeworks as sw
from strangeworks_optimization import StrangeworksOptimizer
from strangeworks_optimization_models.parameter_models import NECParameterModel
from strangeworks_optimization_models.problem_models import QuboDict

sw.authenticate(api_key)

model = QuboDict({("x1", "x1"): 1.0, ("x1", "x2"): -2.0})

options = NECParameterModel(offset=0, num_reads=2, num_results=2, timeout=100)

solver = "nec.vector_annealer"

so = StrangeworksOptimizer(
model=model,
solver=solver,
options=options)
sw_job = so.run()

print(f"Job slug: {sw_job.slug}")
print(f"Job status: {so.status(sw_job.slug)}")

results = so.results(sw_job.slug)

Results

As with other solvers, the results are returned as a sample set.

NEC includes additional information for each sample in the vectors field, an array-like structure containing data fields for spin constraint satisfaction (constraint), memory usage (memory_usage), and Vector Annealer operation time (time). This allows for detailed analysis and aggregation using dimod.SampleSet methods.

sampleset = so.results(sw_job.slug).solution
for datum in sampleset.data(fields=["vectors"]):
print(datum)

Notebooks

Traveling Salesman Problem

Number Problem

NEC 2.0

Parameters

from strangeworks_optimization_models.parameter_models import NEC2ParameterModel

options = NEC2ParameterModel(.....)
NameDescriptionDefaultValues (Range)
offsetOffset to normalize weights in the QUBO formulation.0.0[-3.402823E+38, 3.402823E+38]
num_readsNumber of annealing sweeps to perform, determining solution attempts.1[1, 20]
num_resultsNumber of top solutions to retrieve from the annealing process.1[1, num_reads]
num_sweepsNumber of sweeps per annealing.500[1, 100000]
beta_rangeBeta value range for VA in [start, end, steps].[10.0, 100.0, 200]start: [1.1754945E-38, 3.402823E+38], end: [1.1754945E-38, 3.402823E+38], steps: [1, 100000]
beta_listArray of beta values for the annealing schedule.None[1.1754945E-38, 3.402823E+38]
denseMatrix mode for VA. True for dense, False for sparse.None[None, True, False]
vector_modeMode during VA annealing: speed or accuracy.speed[speed, accuracy]
timeoutTime limit in seconds for job execution.1800[1, 7200]
Ve_numNumber of Vector Engines (VEs) engaged in the annealing process.1[1, max VE available]
onehotOne-hot encoding constraints.[]Example: [["x[0]", "x[1]"], ["x[2]", "x[3]"]]
fixedFixed value constraints for variables.{}Example: {"x[0]": 1, "x[1]": 0}
andzeroConstraints ensuring combinations result in zero.[]Example: [["x[0]", "x[1]"], ["x[2]", "x[3]"]]
oroneConstraints ensuring at least one variable equals one.[]Example: [["x[0]", "x[1]"], ["x[2]", "x[3]"]]
supplementAdditional constraints for solution space exploration.[]Example: [["x[0]", "x[1]"], ["x[2]", "x[3]"]]
maxoneMax number of ones in a solution subset.[]Example: [[1, ["x[0]", "x[1]"]], [2, ["x[2]", "x[3]"]]]
minmaxoneMin limit on max number of ones in a subset.[]Example: [[1, ["x[0]", "x[1]"]], [2, ["x[2]", "x[3]"]]]
init_spinInitial spin settings for the annealing process.{}Example: {"x[0]": 1, "x[1]": 0}
spin_listList of initial spin values used to define constraints or initial conditions.[]Example: ["x[0]", "x[1]", "x[2]"]

Solvers

  • nec.vector_annealer

NEC 3.0

Parameters

from strangeworks_optimization_models.parameter_models import NEC3ParameterModel

options = NEC3ParameterModel(.....)
NameDescriptionDefaultValues (Range)
offsetOffset to normalize weights in the QUBO formulation.0.0[-3.402823E+38, 3.402823E+38]
num_readsNumber of annealing sweeps to perform, determining solution attempts.1[1, 20]
num_resultsNumber of top solutions to retrieve from the annealing process.1[1, num_reads]
timeoutTime limit in seconds for job execution.1800[1, 7200]
num_sweepsNumber of sweeps per annealing.500[1, 100000]
beta_rangeBeta value range for VA in [start, end, steps].[10.0, 100.0, 200]start: [1.1754945E-38, 3.402823E+38], end: [1.1754945E-38, 3.402823E+38], steps: [1, 100000]
beta_listArray of beta values for the annealing schedule.None[1.1754945E-38, 3.402823E+38]
denseMatrix mode for VA. True for dense, False for sparse.None[None, True, False]
num_threadsNumber of threads for computation.None[1, 128]
vector_modeMode during VA annealing: speed or accuracy.speed[speed, accuracy]
precisionPrecision level for computations.None[1, 64]
onehotOne-hot encoding constraints.NoneExample: [["x[0]", "x[1]"], ["x[2]", "x[3]"]]
fixedFixed value constraints for variables.{}Example: {"x[0]": 1, "x[1]": 0}
andzeroConstraints ensuring combinations result in zero.[]Example: [["x[0]", "x[1]"], ["x[2]", "x[3]"]]
oroneConstraints ensuring at least one variable equals one.[]Example: [["x[0]", "x[1]"], ["x[2]", "x[3]"]]
supplementAdditional constraints for solution space exploration.[]Example: [["x[0]", "x[1]"], ["x[2]", "x[3]"]]
maxoneMax number of ones in a solution subset.[[2, ["1", "2"]]]Example: [[1, ["x[0]", "x[1]"]], [2, ["x[2]", "x[3]"]]]
minmaxoneMin limit on max number of ones in a subset.[]Example: [[1, ["x[0]", "x[1]"]], [2, ["x[2]", "x[3]"]]]
high_orderHigh-order constraints for the problem.NoneExample: {"x[0]": 1, "x[1]": 0}
patternPattern constraints for the problem.NoneExample: [["x[0]", "x[1]"], ["x[2]", "x[3]"]]
weighted_sumWeighted sum constraints for the problem.NoneExample: [["x[0]", "x[1]"], ["x[2]", "x[3]"]]
init_spinInitial spin settings for the annealing process.{}Example: {"x[0]": 1, "x[1]": 0}

Solvers

  • nec_3.vector_annealer