Skip to content

Commit

Permalink
Qubo tutorial (#733)
Browse files Browse the repository at this point in the history
[![Unitary
Fund](https://img.shields.io/badge/Supported%20By-UNITARY%20FUND-brightgreen.svg?style=for-the-badge)](http://unitary.fund)

### Before submitting

Please complete the following checklist when submitting a PR:

- [x] Ensure that your tutorial executes correctly, and conforms to the
      guidelines specified in the [README](../README.md).

- [x] Add a thumbnail link to your tutorial in `beginner.rst`, or if a
      QML implementation, in `implementations.rst`.

- [x] All QML tutorials conform to
      [PEP8 standards](https://www.python.org/dev/peps/pep-0008/).
      To auto format files, simply `pip install black`, and then
      run `black -l 100 path/to/file.py`.

When all the above are checked, delete everything above the dashed
line and fill in the pull request template.


------------------------------------------------------------------------------------------------------------

**Title:**
The Quadratic Unconstrained Binary Optimization (QUBO)
**Summary:**
A tutorial to learn how to represent combinatorial optimization problems
using the QUBO formulation. The method is used to represent the Knapsack
problem as a QUBO and it is solved using the quantum approximate
optimization algorithm.

**Relevant references:**

**Possible Drawbacks:**

**Related GitHub Issues:**

---------

Co-authored-by: Guillermo Alonso-Linaje <[email protected]>
Co-authored-by: Rashid N H M <[email protected]>
Co-authored-by: Alvaro Ballon <[email protected]>
Co-authored-by: Ludmila Botelho <[email protected]>
  • Loading branch information
5 people authored Feb 28, 2024
1 parent 126278e commit c933c13
Show file tree
Hide file tree
Showing 13 changed files with 1,581 additions and 10 deletions.
Binary file added _static/authors/alejandro_montanez.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions _static/authors/alejandro_montanez.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.. bio:: Alejandro Montanez
:photo: ../_static/authors/alejandro_montanez.jpg

Alejandro is currently working as a postdoctoral researcher at Forschungszentrum Jülich. His main research interests are in quantum optimization, large-scale quantum simulations, and benchmarking quantum devices.
1 change: 1 addition & 0 deletions _static/demonstration_assets/QUBO/dwave_results_slack.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"x_0":{"0":1,"1":1,"2":0,"3":0,"4":1},"x_1":{"0":1,"1":1,"2":1,"3":1,"4":1},"x_2":{"0":0,"1":1,"2":0,"3":1,"4":0},"x_3":{"0":0,"1":0,"2":0,"3":0,"4":1},"x_4":{"0":1,"1":1,"2":1,"3":1,"4":1},"chain_break_fraction":{"0":0.0,"1":0.0,"2":0.0,"3":0.0,"4":0.0},"energy":{"0":-76.9421,"1":-73.5021,"2":-69.93,"3":-69.6064,"4":-60.1776},"num_occurrences":{"0":4851,"1":144,"2":2,"3":2,"4":1}}
Binary file added _static/demonstration_assets/QUBO/items_QUBO.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions demonstrations/QUBO/dwave_results_slack.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions demonstrations/QUBO/dwave_results_unbalanced.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"x_0":{"0":1,"1":1,"2":0,"3":0,"4":1},"x_1":{"0":1,"1":1,"2":1,"3":1,"4":1},"x_2":{"0":0,"1":1,"2":0,"3":1,"4":0},"x_3":{"0":0,"1":0,"2":0,"3":0,"4":1},"x_4":{"0":1,"1":1,"2":1,"3":1,"4":1},"chain_break_fraction":{"0":0.0,"1":0.0,"2":0.0,"3":0.0,"4":0.0},"energy":{"0":-76.9421,"1":-73.5021,"2":-69.93,"3":-69.6064,"4":-60.1776},"num_occurrences":{"0":4851,"1":144,"2":2,"3":2,"4":1}}
32 changes: 32 additions & 0 deletions demonstrations/tutorial_QUBO.metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"title": "Quadratic Unconstrained Binary Optimization",
"authors": [
{
"id": "alejandro_montanez"
}
],
"dateOfPublication": "2024-02-29T00:00:00+00:00",
"dateOfLastModification": "2024-02-29T00:00:00+00:00",
"categories": [
"Optimization"
],
"tags": [],
"previewImages": [
{
"type": "thumbnail",
"uri": "/_static/demonstration_assets/QUBO/thumbnail_QUBO_2024-02-06.png"
},
{
"type": "large_thumbnail",
"uri": "/_static/large_demo_thumbnails/thumbnail_large_QuBO_2024-02-06.png"
}
],
"seoDescription": "Learn how to solve a QUBO problem in a quantum computer.",
"doi": "",
"canonicalURL": "/qml/demos/tutorial_QUBO",
"references": [],
"basedOnPapers": [],
"referencedByPapers": [],
"relatedContent": [
]
}
744 changes: 744 additions & 0 deletions demonstrations/tutorial_QUBO.py

Large diffs are not rendered by default.

803 changes: 794 additions & 9 deletions poetry.lock

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,13 @@ seaborn = "0.10.1"
kahypar = "1.1.7"
openfermionpyscf = "0.5"
covalent = "0.227.0rc0"
openqaoa-core = "0.2.5"
dwave-ocean-sdk = "6.5.0"
pyzx = "0.7.0"
neural-tangents = "0.6.2"
plotly = ">=4.5.0"
optax = "0.1.3"
mitiq = "0.29.0"
mitiq = "0.32.0"
zstd = "*"
dill = "*"

Expand Down

0 comments on commit c933c13

Please sign in to comment.