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.0.tar.gz (517.1 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.0-cp314-cp314t-win_amd64.whl (9.5 MB view details)

Uploaded CPython 3.14tWindows x86-64

dwave_optimization-0.7.0-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.0-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.0-cp314-cp314t-macosx_11_0_arm64.whl (22.0 MB view details)

Uploaded CPython 3.14tmacOS 11.0+ ARM64

dwave_optimization-0.7.0-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.0-cp312-abi3-win_amd64.whl (9.1 MB view details)

Uploaded CPython 3.12+Windows x86-64

dwave_optimization-0.7.0-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.0-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.0-cp312-abi3-macosx_11_0_arm64.whl (21.8 MB view details)

Uploaded CPython 3.12+macOS 11.0+ ARM64

dwave_optimization-0.7.0-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.0-cp311-cp311-win_amd64.whl (9.2 MB view details)

Uploaded CPython 3.11Windows x86-64

dwave_optimization-0.7.0-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.0-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.0-cp311-cp311-macosx_11_0_arm64.whl (21.9 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

dwave_optimization-0.7.0-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.0-cp310-cp310-win_amd64.whl (9.2 MB view details)

Uploaded CPython 3.10Windows x86-64

dwave_optimization-0.7.0-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.0-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.0-cp310-cp310-macosx_11_0_arm64.whl (21.9 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

dwave_optimization-0.7.0-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.0.tar.gz.

File metadata

  • Download URL: dwave_optimization-0.7.0.tar.gz
  • Upload date:
  • Size: 517.1 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.0.tar.gz
Algorithm Hash digest
SHA256 8be75b26699164b5c28b71451e1f52e3f53e7e73c209ce99ef8754455aa9e9e4
MD5 60274a14cd2d7dde9b391044d9c37588
BLAKE2b-256 e3adfa2559615100bdd64d715e791f31fc5189e1023df943a9658b226f0424f2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dwave_optimization-0.7.0-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 035b70c6b315412f3874977e6fd6f2bcc76321b3890939a64f9b98f9b5c63969
MD5 7c31131ecbb749995c62cef1810b0668
BLAKE2b-256 b1d10739c7f6c906df105c05d0ef6b694d04c51a4e2a28fab16e556004e2b63e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dwave_optimization-0.7.0-cp314-cp314t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6e931a87ba29024a911482c968a1f4e01f704984174cd79dad2680b350c2cfaf
MD5 9e93bb27fcd492f55fa1d9c12487c356
BLAKE2b-256 7e6dcf0af5401825253a5c327ddfad0dd62b4304827b9a79969e307c30280c38

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dwave_optimization-0.7.0-cp314-cp314t-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 36fb1b83db8a1255145d27a79504c9b0e4716a536a8205de784c451414ad4eb7
MD5 84abf5a7cd2f0d847880c6f79ae39747
BLAKE2b-256 184713f5de346562d3c1bea7e357783a240d287dd03b41de74c728e77feebe84

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dwave_optimization-0.7.0-cp314-cp314t-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 43ef6973a9683909da5d5215c649d7e07fc414131ff7b6dbdd260f4471c535b7
MD5 b0cef3d24612d0ad48b5cad69084eeff
BLAKE2b-256 94ccbcc77adc4682a48767e83417f16201b0771ae654224e112797f5b9ed6f9f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dwave_optimization-0.7.0-cp314-cp314t-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 1bb488a843b77e8b2fe53610ec1f006380c589031ba5eb3f4221274c27204906
MD5 21df7ec52be9de6068148f28d952b4ee
BLAKE2b-256 7719660d7e02ed26de56b0d8741a66a7c877629d3d146a8fe72d490059b3ede5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dwave_optimization-0.7.0-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 dd645a5bc8381e42c927c4782787d44a4e8f1ba34e8a8b6533d2f143b7e9cd5c
MD5 7b0f1b664b642e011f3069d8d2a263a9
BLAKE2b-256 dd357e337ffcae7426cb4ed37765524b4f063f10be77a65bf472a9b85531f962

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dwave_optimization-0.7.0-cp312-abi3-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 65869248e7d205647203cdd013dfe247119467aba7df6518390716fe37f5b69a
MD5 a1dc20be90e10e367bad5cf8742d70cf
BLAKE2b-256 94b5c335ee2d357a053d9fc927d5f7504929dca31fd0c5c3f1843d4ef61da400

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dwave_optimization-0.7.0-cp312-abi3-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 73887a225e486f892061b59108273c3ae6c4e2eb7a2f4d7eb9b5428e21d7733f
MD5 a5f67551779472a4e0105c2b8ac3f450
BLAKE2b-256 15a2609f67f5ef333fb62f64368c63b5338901aae4875abdbdc1fe4ed47a6cc1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dwave_optimization-0.7.0-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c0a135f8b37b05e90d6e58aaa0f737d268c16fa9fa714997536cbec0ba85bd84
MD5 bcaf185b2dddd918a9468bb87b231170
BLAKE2b-256 06e6019c7d9eefd1490b44509a2b0960ed3a80c9751c64546377f5380f0c3b3c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dwave_optimization-0.7.0-cp312-abi3-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 1af4878c965cdbbce12cec23052f7a22262b18b837f605a814991a62e91fc8ce
MD5 3d40df90cb2902cf2b123d4b61599c78
BLAKE2b-256 96dce3a9d7bc73f1db9ac6b3a718172239a47e4a121e3c12a87cec88c4937cc7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dwave_optimization-0.7.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 9e2528cb2cfaabfb6d9ab03ee6344e67b79612c46e77bc7856f96f2236d9c385
MD5 9bd6c0d36c97003b0012b66628094d99
BLAKE2b-256 74ae1d62cee175d1024fad0a0df397f4c5eea0bb051c8f43bdc2b0a5ce2ee1cd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dwave_optimization-0.7.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e691f2b717436a8ffbc272ddf2b3c5e022d26e078cf85ea9150022e8d7928369
MD5 d89612060992b828b4ac96deb36c6327
BLAKE2b-256 d3f6dc6ebbee6d9a7c4564e6cd9ef8926505d977b8a5f2afa588980958d7be7d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dwave_optimization-0.7.0-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 0516e61bd62f275f5f4f1e96983d8151854b139e110f8d133181442d5a35c919
MD5 5e397093318de69c3b382a7f5c2be2ff
BLAKE2b-256 2e195d0b7272d62a52dae976fe046f29f18b5ae4a1b08c63ec3809a875979714

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dwave_optimization-0.7.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 047c05bdbfc4a11774611971e135ff2cfcc8fe40b917a48e3aed7b2ab0b87c32
MD5 d8213b02d75672b45d940ed9d291b353
BLAKE2b-256 3c6b5591afa5a055b6c6904438748a317b1e169ceb470491f73f8c6a63d3d672

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dwave_optimization-0.7.0-cp311-cp311-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 dd20dc004106c64b8ffa86b0ad8a5250d188571714882f9bc040c3849889c778
MD5 0675fc37247c911cad8902745872ead2
BLAKE2b-256 7f7201cdfde46dec95bc5f506c1dd037cfaf8bb24f9c463720bcb7765dbb3fb9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dwave_optimization-0.7.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 0979e6b52fcadb9bf2e4ddafed846305bd132aeedca1fb4b14f622825059b9fb
MD5 df7cf8cbc85797a6a05a0bb7cc16860e
BLAKE2b-256 33cb3eb3974ff3e6145fb1f40c8ee65d039b94de4f2a8b24750faf888d8640c0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dwave_optimization-0.7.0-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7ec3704152181571eae870f911d04400191fa5e5936a3ca021d95f76184d2c58
MD5 2b300b30a6e91ac84489131cb62bfe04
BLAKE2b-256 dc382c8a2633e0c407156a148dd8c1ca76920145b577eed0fd5214d2d2a1b478

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dwave_optimization-0.7.0-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 623dfcb0c12e80ae34962a8ad0713fc5f4033cbc72f049bbfdfd8b7f3931ca9b
MD5 82520d88aa68edcb53e62e7cb1f1d691
BLAKE2b-256 22e18542ef1e8a5e7fa87d290d0b69641f81a81d9c70e0baf6d2aa40d57f0f42

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dwave_optimization-0.7.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8bea9fd012887e96ac5490a9cc543ef3bc55b23adaea835e0507dbb422c18b22
MD5 7fd2f2e87d826ea2873e93c34f0f59f1
BLAKE2b-256 c61a2bcfd715d9586e7c2a0106afc881c58c229d60472d2a302f3f629d0da7c8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dwave_optimization-0.7.0-cp310-cp310-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 02f37e2dcbd359231b00e8825fce36df41710632dabc082ccb272f7234125074
MD5 5021a683ea6dbdf05f5784a70afa80d2
BLAKE2b-256 0ccfd79d9e09dcc74b0dd6ae5c7054ce2e65515a8a7b43e7d3bb81ea9b1f42bf

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