{"id":23647,"library":"dwave-optimization","title":"D-Wave Optimization","description":"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.","status":"active","version":"0.6.12","language":"python","source_language":"en","source_url":"https://github.com/dwavesystems/dwave-optimization","tags":["quantum-computing","optimization","d-wave","nonlinear"],"install":[{"cmd":"pip install dwave-optimization","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Required for access to D-Wave solvers via DWaveSampler","package":"dwave-system","optional":true},{"reason":"Core shared library for binary quadratic models","package":"dimod","optional":false},{"reason":"Numerical arrays for model data","package":"numpy","optional":false}],"imports":[{"note":"Package uses dot notation, not underscore.","wrong":"from dwave_optimization import Model","symbol":"Model","correct":"from dwave.optimization import Model"},{"note":"Sampler is in dwave-system, not in dwave-optimization.","wrong":"from dwave.optimization.samplers import DWaveSampler","symbol":"DWaveSampler","correct":"from dwave.system import DWaveSampler"},{"note":"","wrong":"","symbol":"Symbol","correct":"from dwave.optimization import Symbol"}],"quickstart":{"code":"from dwave.optimization import Model\nimport os\n\n# Create a model with a symbol\nmodel = Model()\nx = model.integer(0, 10, num=3)\nmodel.minimize(sum(x))\n# Submit to a solver (requires Leap API token)\ntoken = os.environ.get('DWAVE_API_TOKEN', '')\nif token:\n    from dwave.system import DWaveSampler\n    sampler = DWaveSampler(token=token)\n    sampleset = sampler.sample(model)\n    print(sampleset.first)\nelse:\n    print('DWAVE_API_TOKEN not set; install dwave-neal for local sampling from dimod')","lang":"python","description":"Basic nonlinear model creation and sampling via D-Wave hybrid solver."},"warnings":[{"fix":"from dwave.optimization import Model","message":"The Model class is imported from dwave.optimization, not dwave_optimization. Use dot notation.","severity":"gotcha","affected_versions":"all"},{"fix":"x = model.integer(...) — the symbol is automatically registered.","message":"Symbols are defined and added to the model implicitly upon creation. Do not manually add symbols.","severity":"gotcha","affected_versions":">=0.6.0"},{"fix":"Use sum(x) or model.minimize(reduce(lambda a,b: a+b, symbols, 0))","message":"The use of 'model.minimize()' with a list instead of a sum expression is deprecated.","severity":"deprecated","affected_versions":">=0.5.0"},{"fix":"pip install dwave-system","message":"Samplers are not included; you must install dwave-system (or dwave-neal for local QUBO sampling).","severity":"gotcha","affected_versions":"all"},{"fix":"Replace model.symbol('Integer') with model.integer(...).","message":"In version 0.6.0, the symbol creation API changed: use model.integer(), model.binary(), model.real() instead of model.symbol(type=...).","severity":"breaking","affected_versions":">=0.6.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use 'from dwave.optimization import Model' (dot, not underscore).","cause":"Incorrect import path; package uses dot notation.","error":"ImportError: No module named 'dwave_optimization'"},{"fix":"Install the missing package: pip install dwave-system","cause":"Sampler is in dwave-system, which is not installed by default.","error":"ModuleNotFoundError: No module named 'dwave.system'"},{"fix":"Use DWaveSampler from dwave.system to sample the model.","cause":"The Model class does not have a sample method; use a sampler from dwave.system.","error":"AttributeError: 'Model' object has no attribute 'sample'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}