Skip to content

Latest commit

 

History

History
122 lines (80 loc) · 3.67 KB

README.rst

File metadata and controls

122 lines (80 loc) · 3.67 KB
https://circleci.com/gh/dwavesystems/dwave-optimization.svg?style=svg

dwave-optimization

dwave-optimization enables the formulation of nonlinear models for industrial optimization problems. The package includes:

  • a class for nonlinear models used by the Leap service's quantum-classical hybrid nonlinear-program solver.
  • model generators for common optimization problems.

(For explanations of the terminology, see the Ocean glossary.)

Example Usage

The flow-shop scheduling problem is a variant of the renowned job-shop scheduling optimization problem. Given n jobs to schedule on m machines, with specified processing times for each job per machine, minimize the makespan (the total length of the schedule for processing all the jobs). For every job, the i-th operation is executed on the i-th machine. No machine can perform more than one operation simultaneously.

This small example builds a model for optimizing the schedule for processing two jobs on three machines.

from dwave.optimization.generators import flow_shop_scheduling

processing_times = [[10, 5, 7], [20, 10, 15]]
model = flow_shop_scheduling(processing_times=processing_times)

See the documentation for more examples.

Installation

Installation from PyPI:

pip install dwave-optimization

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

pip install -r requirements.txt
pip install --no-build-isolation --config-settings=editable-verbose=true --editable .

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 -r requirements.txt
meson setup build -Dbuildtype=debug

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

meson test -Cbuild

License

Released under the Apache License 2.0. See LICENSE file.

Contributing

Ocean's contributing guide has guidelines for contributing to Ocean packages.

dwave-optimization includes some formatting customization in the .clang-format and setup.cfg files.