Registry / ai-ml / dwave-optimization

dwave-optimization

JSON →
library0.7.1pypypi✓ verified 85d ago

Enables the formulation of nonlinear models for industrial optimization problems using D-Wave quantum and hybrid solvers. Current version 0.6.12, released approximately monthly.

pip install dwave-optimization
INSTALL
IMPORT
SIG · DWAVE-OPTIMIZATION
D
dwave-optimization
ai-mlpythonv0.7.1
Install
4.4s avg
Import
370ms
Disk
133MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.7.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
build_error
glibc
py 3.103.95 runs
installs and imports cleanly · install 4.4s · import 0.370s · 138MB
133MB installed
● package 133MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Model
from dwave.optimization import Model
from dwave_optimization import Model
Package uses dot notation, not underscore.
DWaveSampler
from dwave.system import DWaveSampler
from dwave.optimization.samplers import DWaveSampler
Sampler is in dwave-system, not in dwave-optimization.
Symbol
from dwave.optimization import Symbol

Basic nonlinear model creation and sampling via D-Wave hybrid solver.

from dwave.optimization import Model import os # Create a model with a symbol model = Model() x = model.integer(0, 10, num=3) model.minimize(sum(x)) # Submit to a solver (requires Leap API token) token = os.environ.get('DWAVE_API_TOKEN', '') if token: from dwave.system import DWaveSampler sampler = DWaveSampler(token=token) sampleset = sampler.sample(model) print(sampleset.first) else: print('DWAVE_API_TOKEN not set; install dwave-neal for local sampling from dimod')
Debug
Known issues
gotchaThe Model class is imported from dwave.optimization, not dwave_optimization. Use dot notation.
fix
from dwave.optimization import Model
affects: all
gotchaSymbols are defined and added to the model implicitly upon creation. Do not manually add symbols.
fix
x = model.integer(...) — the symbol is automatically registered.
affects: >=0.6.0
deprecatedThe use of 'model.minimize()' with a list instead of a sum expression is deprecated.
fix
Use sum(x) or model.minimize(reduce(lambda a,b: a+b, symbols, 0))
affects: >=0.5.0
gotchaSamplers are not included; you must install dwave-system (or dwave-neal for local QUBO sampling).
fix
pip install dwave-system
affects: all
breakingIn version 0.6.0, the symbol creation API changed: use model.integer(), model.binary(), model.real() instead of model.symbol(type=...).
fix
Replace model.symbol('Integer') with model.integer(...).
affects: >=0.6.0
Errors
Common errors & fixes
ImportError: No module named 'dwave_optimization'
Incorrect import path; package uses dot notation.
fix
Use 'from dwave.optimization import Model' (dot, not underscore).
ModuleNotFoundError: No module named 'dwave.system'
Sampler is in dwave-system, which is not installed by default.
fix
Install the missing package: pip install dwave-system
AttributeError: 'Model' object has no attribute 'sample'
The Model class does not have a sample method; use a sampler from dwave.system.
fix
Use DWaveSampler from dwave.system to sample the model.
Upgrade
Version history
0.7.1latest on PyPI · released Jun 5, 2026
Audit
Dependencies
dwave-systemoptionalRequired for access to D-Wave solvers via DWaveSampler
dimodrequiredCore shared library for binary quadratic models
numpyrequiredNumerical arrays for model data
Agent activity
13 hits · last 30 days
node
12
OpenAI (training)
1
Resources
dwave-optimization — pip install dwave-optimization · libregistry