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

📝 Documentation for Search Space Limitation Feature #280

Closed
wants to merge 10 commits into from

Conversation

IsFairy
Copy link
Contributor

@IsFairy IsFairy commented Mar 25, 2023

Description

Adding a simple Notebook to show how swap-limiting can be enabled

Fixes #116

Checklist:

  • The pull request only contains commits that are related to it.
  • I have added appropriate tests and documentation.
  • I have made sure that all CI jobs on GitHub pass.
  • The pull request introduces no new warnings and follows the project's style guidelines.

@codecov
Copy link

codecov bot commented Mar 25, 2023

Codecov Report

Merging #280 (2b3efb0) into main (f34a5dc) will not change coverage.
The diff coverage is n/a.

@@          Coverage Diff          @@
##            main    #280   +/-   ##
=====================================
  Coverage   92.0%   92.0%           
=====================================
  Files         45      45           
  Lines       3888    3888           
  Branches     650     650           
=====================================
  Hits        3580    3580           
  Misses       308     308           
Flag Coverage Δ
cpp 91.5% <ø> (ø)
python 95.9% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@burgholzer
Copy link
Member

burgholzer commented Mar 25, 2023

Thanks for the addition. Seems like the script doesn't run without errors though. Please request a review once the script is fixed.
Edit: please also edit the PR description so that it links to the respective issue.

@IsFairy IsFairy requested a review from burgholzer March 27, 2023 20:47
Copy link
Member

@burgholzer burgholzer left a comment

Choose a reason for hiding this comment

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

Thanks for the first draft. Unfortunately, this PR feels really unfinished.
At the moment this is not even included in the documentation.
Please see the comments below for a couple of remarks.

Comment on lines +10 to +59
"Many quantum computing architectures limit the pairs of qubits that two-qubit operations can be applied to.\n",
"This is commonly described by a device's *coupling map*.\n",
"To further speed up the mapping process, there are several ways to limit the pairs of qubits that need to be considered, in ways of limiting the whole search space for the exact mapping problem.\n",
"\n",
"Consider the following circuit."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from qiskit import QuantumCircuit\n",
"\n",
"qc = QuantumCircuit(4)\n",
"qc.h(0)\n",
"qc.cx(0, 1)\n",
"qc.cx(0, 2)\n",
"qc.cx(0, 3)\n",
"\n",
"qc.barrier()\n",
"\n",
"qc.t(0)\n",
"qc.t(1)\n",
"qc.t(2)\n",
"qc.t(3)\n",
"\n",
"qc.barrier()\n",
"\n",
"qc.cx(0, 3)\n",
"qc.cx(0, 2)\n",
"qc.cx(0, 1)\n",
"\n",
"qc.measure_all()\n",
"\n",
"qc.draw(output=\"mpl\")"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"Now assume this circuit shall be mapped to a $4$-qubit architecture defined by the following coupling map:\n",
"\n",
"![Linear 4-qubit Architecture](images/linear_arch.svg)\n",
"\n",
"In *QMAP* this architecture can be manually defined as described in the Mapping section.\n",
"\n",
Copy link
Member

Choose a reason for hiding this comment

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

This is, more or less, duplicate code from the Mapping notebook.
This page should provide some context on the search space limitation, what the implications are, etc.
It should at least cover both methods from the paper and contrast them against the non-limited version. Should be fairly easy to show the runtime difference on some small examples.
Most importantly, I would have imagined an example circuit and/or architecture, where a real difference can be seen for the different approaches.

Furthermore, it would make sense to reference the paper near the top of this page to set the scene for what's to come.

"\n",
"Instead we look now at the cayley graph, especially the reduced cayley graph that can be generated from the series of swaps possible on an architecture.\n",
"\n",
"![Reduced Cayley graph](images/cayley.png)\n",
Copy link
Member

Choose a reason for hiding this comment

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

This image has not been added to the repository. Furthermore, please use vector graphics wherever possible.
The original file is a PDF anyway. So that should be straight-forward.

This tutorial-like page should also contain the original un-limited Cayley graph. I believe you could just replicate the example from the paper (with some minor modifications).

" },\n",
")\n",
"qc_mapped, res = qmap.compile(\n",
" qc, arch, method=\"exact\", post_mapping_optimizations=False, swap_reduction=\"coupling_limit\"\n",
Copy link
Member

Choose a reason for hiding this comment

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

It should be mentioned somewhere, that this is actually the default setting being used (since it is guaranteed to preserve optimality).

"source": [
"This limits the number of SWAPs based on the selected subgraph of the architecture.\n",
"\n",
"Check out the [reference documentation](library/Mapping.rst) for more information."
Copy link
Member

Choose a reason for hiding this comment

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

I would have expected that link to point to the SwapReduction settings reference documentation and not the general mapper page.

Copy link
Member

Choose a reason for hiding this comment

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

This new file is linked nowhere in the documentation. As such, it is not accessible in the documentation.

@burgholzer burgholzer added the documentation Improvements or additions to documentation label Mar 31, 2023
@burgholzer burgholzer changed the title Limiting search space documentation 📝 Documentation for Search Space Limitation Feature Mar 31, 2023
@burgholzer burgholzer closed this Oct 24, 2023
@burgholzer burgholzer deleted the LimitingSearchSpace_Documentation branch October 24, 2023 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Documentation for Limiting Search Space Option
2 participants