Skip to main content

Enables the formulation of nonlinear models for industrial optimization problems.

Project description

https://img.shields.io/pypi/v/dwave-optimization.svg?style=svg https://img.shields.io/pypi/pyversions/dwave-optimization.svg?style=svg https://circleci.com/gh/dwavesystems/dwave-optimization.svg?style=svg https://raw.githubusercontent.com/dwavesystems/dwave-optimization/main/docs/_images/optimization_stride_logo_blue_light_dark.svg

dwave-optimization is an open-source library for formulating nonlinear optimization models for use with D-Wave’s Stride™ hybrid solver. Models are constructed symbolically using an array-based syntax inspired by NumPy.

The package includes:

  • A class for nonlinear models used by the Stride quantum-classical hybrid nonlinear solver.

  • Model generators for common optimization problems.

Example Usage

The quadratic assignment problem problem is a combinatorial optimization problem. There are n facilities and n potential locations, a flow between each pair of facilities, and a distance between each pair of locations. The problem is to assign each facility to a location in order to minimize the sum of each distance multiplied by each matching flow.

This small example builds a quadratic assignment using dwave-optimization symbols. There is also a generator for this problem.

from dwave.optimization import Model

model = Model()

flows = model.constant([[0, 4, 2],
                        [3, 0, 7],
                        [1, 8, 0]])
distances = model.constant([[0, 1, 2],
                            [1, 0, 3],
                            [2, 3, 0]])

assignment = model.list(3)

model.minimize((flows * distances[assignment, :][:, assignment]).sum())

For explanations of the terminology, see the Ocean glossary.

For a discussion about performance, see Performance Benchmarks.

Installation

Installation from PyPI:

pip install dwave-optimization

During package development, it is often convenient to use an editable install. See meson-python’s editable installs for more details.

pip install --group dev --group blas
pip install --editable . \
    --no-build-isolation \
    --config-settings=editable-verbose=true \
    --config-settings=setup-args="-Dblas=enabled"

Testing

All code should be thoroughly tested and all pull requests should include tests.

To run the Python tests, first install the package using an editable install as described above. The tests can then be run with unittest.

python -m unittest

To run the C++ tests, first install the project dependencies, then setup a meson build directory. You must configure the build as a debug build for the tests to run.

pip install --group dev --group blas
meson setup build -Dbuildtype=debug -Dblas=enabled

You can then run the tests using meson’s test framework.

meson test -Cbuild

To run the doctests, install the docs requirements:

pip install --group docs

You can then run them using the docs/Makefile.

make -C docs doctest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dwave_optimization-0.7.1.tar.gz (520.6 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

dwave_optimization-0.7.1-cp314-cp314t-win_amd64.whl (9.5 MB view details)

Uploaded CPython 3.14tWindows x86-64

dwave_optimization-0.7.1-cp314-cp314t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (15.5 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

dwave_optimization-0.7.1-cp314-cp314t-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (15.8 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.24+ ARM64manylinux: glibc 2.28+ ARM64

dwave_optimization-0.7.1-cp314-cp314t-macosx_11_0_arm64.whl (22.1 MB view details)

Uploaded CPython 3.14tmacOS 11.0+ ARM64

dwave_optimization-0.7.1-cp314-cp314t-macosx_10_15_x86_64.whl (22.2 MB view details)

Uploaded CPython 3.14tmacOS 10.15+ x86-64

dwave_optimization-0.7.1-cp312-abi3-win_amd64.whl (9.1 MB view details)

Uploaded CPython 3.12+Windows x86-64

dwave_optimization-0.7.1-cp312-abi3-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (15.0 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

dwave_optimization-0.7.1-cp312-abi3-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (15.3 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.24+ ARM64manylinux: glibc 2.28+ ARM64

dwave_optimization-0.7.1-cp312-abi3-macosx_11_0_arm64.whl (21.8 MB view details)

Uploaded CPython 3.12+macOS 11.0+ ARM64

dwave_optimization-0.7.1-cp312-abi3-macosx_10_13_x86_64.whl (21.9 MB view details)

Uploaded CPython 3.12+macOS 10.13+ x86-64

dwave_optimization-0.7.1-cp311-cp311-win_amd64.whl (9.2 MB view details)

Uploaded CPython 3.11Windows x86-64

dwave_optimization-0.7.1-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (15.5 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

dwave_optimization-0.7.1-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (15.9 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.24+ ARM64manylinux: glibc 2.28+ ARM64

dwave_optimization-0.7.1-cp311-cp311-macosx_11_0_arm64.whl (21.9 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

dwave_optimization-0.7.1-cp311-cp311-macosx_10_13_x86_64.whl (22.0 MB view details)

Uploaded CPython 3.11macOS 10.13+ x86-64

dwave_optimization-0.7.1-cp310-cp310-win_amd64.whl (9.2 MB view details)

Uploaded CPython 3.10Windows x86-64

dwave_optimization-0.7.1-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (15.5 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

dwave_optimization-0.7.1-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (15.8 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.24+ ARM64manylinux: glibc 2.28+ ARM64

dwave_optimization-0.7.1-cp310-cp310-macosx_11_0_arm64.whl (21.9 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

dwave_optimization-0.7.1-cp310-cp310-macosx_10_13_x86_64.whl (22.1 MB view details)

Uploaded CPython 3.10macOS 10.13+ x86-64

File details

Details for the file dwave_optimization-0.7.1.tar.gz.

File metadata

  • Download URL: dwave_optimization-0.7.1.tar.gz
  • Upload date:
  • Size: 520.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for dwave_optimization-0.7.1.tar.gz
Algorithm Hash digest
SHA256 70085ae160b7692225392650924f137bc2c74f405d1a45d4e011aa647cb3ec03
MD5 6509170436c400f6ca073c1218dab291
BLAKE2b-256 64c4647b830f662e0851a32285c443898d01f23fd087f6326e606736d86924bd

See more details on using hashes here.

File details

Details for the file dwave_optimization-0.7.1-cp314-cp314t-win_amd64.whl.

File metadata

File hashes

Hashes for dwave_optimization-0.7.1-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 61e3170611afa5d5e3702afc992b196eb60269351638e4edb8812c084e5e7c7a
MD5 694b9add9e7da238b2803b8c135e8b91
BLAKE2b-256 33bc40ad21ad46b9168160415fb11dbfd09512e18731b2f48c782b750a3cc824

See more details on using hashes here.

File details

Details for the file dwave_optimization-0.7.1-cp314-cp314t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for dwave_optimization-0.7.1-cp314-cp314t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8ec0666f0e6ee0ec78477b553f52481cad747f0a5761116b9af6311b51fbd9f5
MD5 742dfcf7c1950904b02724785c6bc34c
BLAKE2b-256 5b54b3b854eb1afc864b8895f1c4f568b5f2d9b52417906b847809fd34eec5ad

See more details on using hashes here.

File details

Details for the file dwave_optimization-0.7.1-cp314-cp314t-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for dwave_optimization-0.7.1-cp314-cp314t-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 28177f55f8700bcfc11180cb1013266ec64e175c09e47126351659a689f798ab
MD5 63a3b19a324aec75ed190d27e577abcf
BLAKE2b-256 068849fc1b7292aa4b958628c6f06ca1751ddafa307e3978c87ec7124db71a0f

See more details on using hashes here.

File details

Details for the file dwave_optimization-0.7.1-cp314-cp314t-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dwave_optimization-0.7.1-cp314-cp314t-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 613a8dd9d701258239f48e196fbdc0a201fb6f10c0cec5e878422166d2d560ee
MD5 2276d6b680aee26d8a0d301b75ce1ea1
BLAKE2b-256 3eed8de5ccc8e49491cc275768495b0b1e6b5b74f8646cbf77a41f7e67437ccf

See more details on using hashes here.

File details

Details for the file dwave_optimization-0.7.1-cp314-cp314t-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for dwave_optimization-0.7.1-cp314-cp314t-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 26dfdb648156d2c614cd1f4f50e5a7d6f22a905c92d3f801fa4c0a584440d773
MD5 4805494f1f1031e0a91dd896c359947c
BLAKE2b-256 213690cdd21692fd78427d8235cf301a216b550d1c37b695395ce8fbee0bc4b5

See more details on using hashes here.

File details

Details for the file dwave_optimization-0.7.1-cp312-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for dwave_optimization-0.7.1-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 044b7f0592eb3498db82b86d906b46cd15f1f6ef350038f52aab25d1f404e288
MD5 8389ffae320f1cf9095beb02e8cbb693
BLAKE2b-256 e268bce148f9a760b2cdbae8c84def12b74b91bb21db435ae4034c66f6afe5cb

See more details on using hashes here.

File details

Details for the file dwave_optimization-0.7.1-cp312-abi3-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for dwave_optimization-0.7.1-cp312-abi3-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3ac948e8016cde188fd6ed76cc96acbef4518f509b111376a916520c4a4a7e04
MD5 8f878e58ba3d9b008352c1997ee55526
BLAKE2b-256 e399ccfc4b364a66aa37653dd1661785a4b23f3beb752a508879ddceed4fcdfc

See more details on using hashes here.

File details

Details for the file dwave_optimization-0.7.1-cp312-abi3-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for dwave_optimization-0.7.1-cp312-abi3-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 d90d8af03bc51ae80a12b8c572826be8c65e867391e4d6e5f3119edf5c6ec32e
MD5 e08138c976e114c2263308633c4f43cc
BLAKE2b-256 3c03468f503a8ca00517951a8fdd990cc08a3fa87659b41cdcafae05a81df8b3

See more details on using hashes here.

File details

Details for the file dwave_optimization-0.7.1-cp312-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dwave_optimization-0.7.1-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cd7b1b682c6e3dc14dd85196c2233dcf579225528d77e043aca97b51d6ac6b63
MD5 b08364399c1ee473b75f3c8ba0eddd20
BLAKE2b-256 394c33f2e85b6a3893801894530957a1fa33f992ec63cd094306b999b0b461f9

See more details on using hashes here.

File details

Details for the file dwave_optimization-0.7.1-cp312-abi3-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for dwave_optimization-0.7.1-cp312-abi3-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 f00931566ed7cf2fe3bdf2fdd959c0aa6491e5aec57c3cc733c664199b918bfb
MD5 761599b0b432c4b5c17b3e502939815c
BLAKE2b-256 82712824f23dfcd29151236025170cd15a0bfb24aaa7b4e35f379e1a1b8becf4

See more details on using hashes here.

File details

Details for the file dwave_optimization-0.7.1-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for dwave_optimization-0.7.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 8e020c2d0c7e3b946b274ba64196dc87ed59717b0635d8cbafddf822fa63d777
MD5 e39054f9ecbef11e4c95478706ed16a6
BLAKE2b-256 95b27e3572a6fa3c00cb3cb2bd89e7e09b5c82c41136675574dedac290f7137d

See more details on using hashes here.

File details

Details for the file dwave_optimization-0.7.1-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for dwave_optimization-0.7.1-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2640b49f20d7d61bfa4da23017a156a4e800f0bae57b31a5c80c02f5bf54fc21
MD5 0067290f85da4f32f156e5b76f5dba3f
BLAKE2b-256 8b24597bb8bee1dbe5e4213562a2bab2e58067895230ecdbf11d294e94991c7f

See more details on using hashes here.

File details

Details for the file dwave_optimization-0.7.1-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for dwave_optimization-0.7.1-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 2a50077b45620c9fe16d103eba5b8af68d1844cc28c949530d527386f78914b7
MD5 056ad1c83a040056e7bf59637af15230
BLAKE2b-256 9b97080a4f7ab2135c7e252c8b0e5ee73b2af91441cb1770ae3a28f67b1019e6

See more details on using hashes here.

File details

Details for the file dwave_optimization-0.7.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dwave_optimization-0.7.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 766ba4a26166b31f64670d9348263e75d40f69d360b12706ccf9d2917c458256
MD5 f1c8631d61d63cc5df96d06e39fbdfee
BLAKE2b-256 9db0603c25ce40f69a20b0347ee4a135a665906c7880b362465a3f87d85d031e

See more details on using hashes here.

File details

Details for the file dwave_optimization-0.7.1-cp311-cp311-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for dwave_optimization-0.7.1-cp311-cp311-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 d62e35413890b69a6263b8341f1ae83d9d70f5cd969db620039179ef0a1c508b
MD5 90e5ca1b463b8f69d59e7a51ee23e217
BLAKE2b-256 4655a8bca8e45c4961b3bce4309ff48c357fa55b737f36ea94c1a873926b005b

See more details on using hashes here.

File details

Details for the file dwave_optimization-0.7.1-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for dwave_optimization-0.7.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 d96cd96a25a3cf707b1ef04177303ed9b54a66472e3947233a741fdd17ca326d
MD5 822dad792b04e36ec094e29e62550acf
BLAKE2b-256 684c9281164b02b3b1a172bc196532f72438b5d44fe994e0252a0f803adeb9bf

See more details on using hashes here.

File details

Details for the file dwave_optimization-0.7.1-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for dwave_optimization-0.7.1-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5f9665b67652425a1a8c6cd8449cf0c3177fbf01afb468bb07a4743591475270
MD5 7d208fc44f015acdf8bdc75d93b8675d
BLAKE2b-256 c66ed2def9e5e2b1da7c882e2a43817c2c2789598b256bcdc4a99378bd3947be

See more details on using hashes here.

File details

Details for the file dwave_optimization-0.7.1-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for dwave_optimization-0.7.1-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 a4b2dc847a7eea666c686091528d47d9aebb33b9ecc75c60c37ddcbcd39e25b2
MD5 fa11f49d835704e4e90a1f079152722a
BLAKE2b-256 cdceb82f7404d4f79d10fc1c70a31e877f6bd3278947245d5554a36ce875eed8

See more details on using hashes here.

File details

Details for the file dwave_optimization-0.7.1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dwave_optimization-0.7.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b91a2483cab8b8476ae8bdc12f3067a18be5377ea86dba6dcc7c9b6cb7cfb870
MD5 0945dd9f0bf0d68553b5ab484e75a2d3
BLAKE2b-256 fd357cbb3f7cf3bd148553172da5560afb7611284e1c85edee7679f79c767c94

See more details on using hashes here.

File details

Details for the file dwave_optimization-0.7.1-cp310-cp310-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for dwave_optimization-0.7.1-cp310-cp310-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 3faad6af3a3f1cf18b5d5fd5c982b1310f08d58ee4583098c473254bd92e90b4
MD5 9e22f47bff74761fb4247b7e15ce9336
BLAKE2b-256 f4689704489ac2e03d17512a52b2efeb589bd52403a4ac5b89029ef2d9842185

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page