Registry / ai-ml / dwave-optimization

dwave-optimization

JSON →
library0.6.12pypypi✓ verified 34d 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.

ai-ml
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

Package uses dot notation, not underscore.

from dwave.optimization import Model

Sampler is in dwave-system, not in dwave-optimization.

from dwave.system import DWaveSampler
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 footguns
gotchaThe Model class is imported from dwave.optimization, not dwave_optimization. Use dot notation.
gotchaSymbols are defined and added to the model implicitly upon creation. Do not manually add symbols.
deprecatedThe use of 'model.minimize()' with a list instead of a sum expression is deprecated.
gotchaSamplers are not included; you must install dwave-system (or dwave-neal for local QUBO sampling).
breakingIn version 0.6.0, the symbol creation API changed: use model.integer(), model.binary(), model.real() instead of model.symbol(type=...).
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
0 hits · last 30 days

No traffic data recorded yet.

Resources