D-Wave
D-Wave's quantum annealing hardware relies on metal loops of niobium that have tiny electrical currents running through them.
Solvers
We offer access to D-Wave QPU Samplers, classical simulators, and D-Wave Leap Hybrid.
Samplers
D-Wave samplers are designed to solve problems that can be formulated as binary quadratic models (BQM). The samplers are used to find the lowest energy state of the BQM.
Advantage QPUs
- Advantage_system6.4
- Advantage2_prototype2.3
https://www.dwavesys.com/solutions-and-products/systems/
import strangeworks as sw
from strangeworks_optimization import StrangeworksOptimizer
from strangeworks_optimization_models.parameter_models import DwaveSamplerParameterModel
from dimod import BinaryQuadraticModel
sw.authenticate('your-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")
# solver = "dwave.Advantage_system6.4"
solver = "dwave.Advantage2_prototype2.3"
options = DwaveSamplerParameterModel(num_reads=100, chain_strength=50)
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)
print(f"Best solution:\n{results.solution.first}")
Leap Hybrid Solvers
- hybrid_binary_quadratic_model_version2p
- hybrid_constrained_quadratic_model_version1p
- hybrid_discrete_quadratic_model_version1p
https://www.dwavesys.com/solutions-and-products/cloud-platform/
BinaryQuadraticModel
import strangeworks as sw
from strangeworks_optimization import StrangeworksOptimizer
from strangeworks_optimization_models.parameter_models import DwaveSamplerParameterModel
from dimod import BinaryQuadraticModel
sw.authenticate('your-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")
solver = "dwave.hybrid_binary_quadratic_model_version2p"
so = StrangeworksOptimizer(model=model, solver=solver)
sw_job = so.run()
ConstrainedQuadraticModel
import strangeworks as sw
from strangeworks_optimization import StrangeworksOptimizer
from strangeworks_optimization_models.parameter_models import DwaveSamplerParameterModel
from dimod import Binary, ConstrainedQuadraticModel
sw.authenticate('your-api-key')
weights = [0.9, 0.7, 0.2, 0.1]
capacity = 1
y = [Binary(f"y_{j}") for j in range(len(weights))]
x = [[Binary(f"x_{i}_{j}") for j in range(len(weights))] for i in range(len(weights))]
model = ConstrainedQuadraticModel()
model.set_objective(sum(y))
for i in range(len(weights)):
model.add_constraint(sum(x[i]) == 1, label=f"item_placing_{i}")
for j in range(len(weights)):
model.add_constraint(
sum(weights[i] * x[i][j] for i in range(len(weights))) - y[j] * capacity <= 0,
label=f"capacity_bin_{j}",
)
solver = "dwave.hybrid_constrained_quadratic_model_version1p"
so = StrangeworksOptimizer(model=model, solver=solver)
sw_job = so.run()
DiscreteQuadraticModel
import strangeworks as sw
from strangeworks_optimization import StrangeworksOptimizer
from strangeworks_optimization_models.parameter_models import DwaveSamplerParameterModel
from dimod import DiscreteQuadraticModel
import random
sw.authenticate('your-api-key')
model = DiscreteQuadraticModel()
for i in range(10):
model.add_variable(4)
for i in range(9):
for j in range(i + 1, 10):
model.set_quadratic_case(i, random.randrange(0, 4), j, random.randrange(0, 4), random.random())
solver = "dwave.hybrid_discrete_quadratic_model_version1p"
so = StrangeworksOptimizer(model=model, solver=solver)
sw_job = so.run()
DwaveSamplerParameterModel
For more information on the parameters, please refer to the D-Wave Solver Parameters documentation.
Name | Type | Description | Default | Values (Range) |
---|---|---|---|---|
num_reads | int | Specifies the number of reads (solutions) to be obtained. | 1 | [1, max_num_reads] |
chain_strength | int | Sets the strength of the chains in the embedding. | Determined by solver | [Depends on system] |
anneal_offsets | List[float] | Provides offsets to annealing paths, per qubit. | No offsets | Specified per qubit |
anneal_schedule | List[List[float]] | Specifies the custom annealing schedule as time and fraction. | Standard schedule | Specified per system |
annealing_time | float | Sets the duration of the annealing process per read. | Default system value | Specified per system |
auto_scale | bool | Automatically rescales h and J values to the QPU's range. | True | [True, False] |
flux_biases | List[float] | Applies manual flux biases for qubit calibration. | No biases | [Depends on system] |
flux_drift_compensation | bool | Compensates for flux drift in qubits. | True | [True, False] |
h_gain_schedule | List[List[float]] | Sets time-dependent gains for qubit biases. | Not specified | [Depends on system] |
initial_state | dict | Sets the initial state for reverse annealing. | Not specified | [Depends on system] |
max_answers | int | Limits the number of answers returned. | num_reads | [1, num_reads] |
num_spin_reversal_transforms | int | Applies spin reversal transforms to reduce noise. | 0 | [0, max_transforms] |
programming_thermalization | float | Time to wait post-programming for thermalization. | 1000 μs | [0μs, max_thermal] |
readout_thermalization | float | Time to wait post-readout for thermalization. | 0 μs | [0μs, max_thermal] |
reduce_intersample_correlation | bool | Adds delays between samples to reduce correlations. | False | [True, False] |
reinitialize_state | bool | Reinitializes to the initial state for each anneal cycle. | False | [True, False] |