Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Utility scale QAOA tutorial #1238

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open

Conversation

miamico
Copy link
Collaborator

@miamico miamico commented Apr 24, 2024

Adds a new tutorial for QAOA with code for running experiment at utility scale. All dependencies from Application modules are removed

@miamico miamico self-assigned this Apr 24, 2024
@qiskit-bot
Copy link
Contributor

Thanks for contributing to Qiskit documentation!

Before your PR can be merged, it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient. Thanks! 🙌

@CLAassistant
Copy link

CLAassistant commented Apr 24, 2024

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
2 out of 3 committers have signed the CLA.

✅ kaelynj
✅ abbycross
❌ miamico
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@javabster javabster linked an issue Apr 24, 2024 that may be closed by this pull request
@abbycross
Copy link
Collaborator

Happy to do style/language review when this is ready to go. Just lmk!

@miamico
Copy link
Collaborator Author

miamico commented Apr 29, 2024

posting here some comments received through other channels:

  • before digging into the tutorial, I think it would help a ton to motivate the problem a bit more. You mention some applications, which is good, but I think it’s also worth mentioning that it’s an NP hard problem and then comparing the best classical algorithm to the quantum algorithm. At the end of the tutorial you say that current processors are noisy so the quantum algorithm doesn’t offer an advantage. But how much better can they do in principle? If you just leave it at, “quantum computers can do no better than classical,” then the reader will wonder why they’re bothering with learning this.

  • I find the starting formulation of the graph problem → QUBO → hamiltonian mapping a little hard to follow and also maybe unnecessarily convoluted? If you formulate the initial graph problem a little differently (as Jochen Rau does in this video) can’t you just map directly from the graph cost function to a Hamiltonian? If there’s something wrong with this approach and you’d like to stick with what you’re doing, I would suggest explaining the steps a little more and maybe even avoiding ever writing “QUBO.” It sounds intimidating and the term itself is entirely unnecessary for the learner’s understanding of the problem at hand.

  • Update to primitives V2

Copy link

review-notebook-app bot commented May 2, 2024

View / edit / reply to this conversation on ReviewNB

javabster commented on 2024-05-02T20:53:17Z
----------------------------------------------------------------

I think we can remove the first cell with the authors and the patterns, it feels a bit out of place with the style of all the other tutorials


Copy link

review-notebook-app bot commented May 2, 2024

View / edit / reply to this conversation on ReviewNB

javabster commented on 2024-05-02T20:53:18Z
----------------------------------------------------------------

I think these cells with the call to action and team 1 or 2 should be removed, I guess that was part of an interactive wrokshop but it doesnt really work in tutotiral format


Copy link

review-notebook-app bot commented May 2, 2024

View / edit / reply to this conversation on ReviewNB

javabster commented on 2024-05-02T20:53:18Z
----------------------------------------------------------------

also these call to action sections with the commented out code should probably be uncommented i guess?


Copy link
Collaborator

@javabster javabster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a bunch of comments but it's getting there! thanks @miamico and @kaelynj 😄

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are all these .qpy files necessary? Users should be able to download and run the notebooks, so any additional data and utility functions should be put into the notebook itself. afaik we dont have the ability on the learning platform to handle additional data files like this

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I have deleted all files except the experiment results. If the LP doesn't support extra data files we may remove it as a final step to avoid losing the plots

tutorials/qaoa-utility-scale/imgs/patterns.png Outdated Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we come up with a more descriptive title for this tutorial? It should be something specific (and ideally enticing) for a reader to want to click on it

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you check that the headings for the pattern steps match what is used for other tutorials?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general I think this notebook could use a grammar and spelling check (cc @abbycross 😄 )

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be nice to call out in the intro section of this tutorial that you can run it within the 10 minute limit of the open plan (also make sure to check that is actually true, I haven't personally validated that claim 😅 )

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the introduction to step 2 when you're giving the TL;DR about transpilation I think it would be good to direct people towards some of the docs.quantum.ibm.com/tranpile resources for more detail

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we come up with a more descriptive title for this tutorial? It should be something specific (and ideally enticing) for a reader to want to click on it

I'm giving another stab but maybe someone with more imagination can help me?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also in the step 2 intro - why is a simulator used? we should always show a real device unless absolutely necessary to do otherwise. Also I'm generally not really sure what the purpose of that code snippet is for, if it is just to show what transpilation is I think we can cut it and instead add some text encouraging people to go to the docs if they dont know what transpilation is

  • Simulator was use for ease of usage, we can definitely switch to hardware.
  • We need to transpile the circuit to the hardware before execution (the sampler/estimator don't do that anymore). Step 2 seems the most natural place to put the transpilation step

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in scale up step 3 I think we should remove the explanation about loading saved data and only show the code cells that show users how to do it themselves. Mostly because we dont have a way in LP to load saved data like this

Ok, let's do this as a last step to avoid having to keep sending jobs to the device to execute the notebook

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the scale up section the first diagram of the nodes looks janky 😅

I need some help with this, have very little idea of plotting with rustworkx

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the scale up section the first diagram of the nodes looks janky 😅

I need some help with this, have very little idea of plotting with rustworkx

It doesn't seem like there's much control over it. If there's some way to get the coordinates they use for the graphs on quantum.ibm.com then we can input them into the drawer, but I imagine that'll convolute the tutorial.

I don't think it's too bad at the moment so might be best leaving it.

@frankharkins
Copy link
Member

frankharkins commented May 7, 2024

@miamico could you also please replace the networkx code with rustworkx? It'll help keep our requirements down.

E.g. for the first example:

import rustworkx as rx
from rustworkx.visualization import mpl_draw as draw_graph
import numpy as np

n = 5

graph = rx.PyGraph()
graph.add_nodes_from(np.arange(0, n, 1))
edge_list = [(0, 1, 1.0), (0, 2, 1.0), (0, 4, 1.0), (1, 2, 1.0), (2, 3, 1.0), (3, 4, 1.0)]
graph.add_edges_from(edge_list)
draw_graph(graph, node_size=600, with_labels=True)

@abbycross
Copy link
Collaborator

Github won't let me suggest edits because of the size of the notebook file, so I am making some IBM style updates (such as rewording not to use "we") locally, and will merge to this branch as soon as I've gotten through it!

@abbycross
Copy link
Collaborator

Looking at Pattern step 2 in the text: we should add a link to the docs for transpiler passes. Is this the right link to add? https://docs.quantum.ibm.com/api/qiskit/transpiler_passes#transpiler-passes -- or instead, something in the platform docs (https://docs.quantum.ibm.com/transpile)? cc: @kaelynj
Screenshot 2024-05-20 at 11 42 27 AM

@abbycross
Copy link
Collaborator

I am hesitant to "IBM-ify" the style of the Appendices, but also wonder if they belong at the end of the notebook since we don't use appendices anywhere else. Is there a better place to store and display that content? Thoughts @javabster @kaelynj @miamico ?

@miamico
Copy link
Collaborator Author

miamico commented May 21, 2024

I would vote for having appendices as this seems to be a common occurence in the utility notebook I've been working on. Maybe a link to external reference would be enough though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[NEW TUTORIAL] max-cut tutorial for open-plan
7 participants