Metadata-Version: 2.2
Name: mqt.predictor
Version: 2.2.0
Summary: MQT Predictor - A MQT tool for Determining Good Quantum Circuit Compilation Options
Author-email: Nils Quetschlich <nils.quetschlich@tum.de>, Lukas Burgholzer <lukas.burgholzer@tum.de>
License: MIT License
        
        Copyright (c) 2022 Nils Quetschlich, Lukas Burgholzer, and Robert Wille
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/cda-tum/mqt-predictor
Project-URL: Issues, https://github.com/cda-tum/mqt-predictor/issues
Project-URL: Discussions, https://github.com/cda-tum/mqt-predictor/discussions
Project-URL: Research, https://www.cda.cit.tum.de/research/quantum/
Keywords: MQT,quantum computing,compilation,machine learning,prediction
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Intended Audience :: Science/Research
Classifier: Natural Language :: English
Classifier: Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: mqt.bench>=1.1.3
Requires-Dist: qiskit!=1.3.2
Requires-Dist: pytket>=1.29.0
Requires-Dist: sb3_contrib>=2.0.0
Requires-Dist: tqdm>=4.66.0
Requires-Dist: scikit-learn>=1.5.1
Requires-Dist: tensorboard>=2.17.0
Requires-Dist: bqskit>=1.2.0
Requires-Dist: numpy>=1.26; python_version >= "3.12"
Requires-Dist: numpy>=1.24; python_version >= "3.11"
Requires-Dist: numpy>=1.22
Requires-Dist: numpy<2; sys_platform == "darwin" and "x86_64" in platform_machine
Requires-Dist: typing-extensions>=4.1
Provides-Extra: test
Requires-Dist: pytest>=7.2; extra == "test"
Provides-Extra: coverage
Requires-Dist: mqt.predictor[test]; extra == "coverage"
Requires-Dist: pytest-cov>=4; extra == "coverage"
Provides-Extra: dev
Requires-Dist: mqt.predictor[coverage]; extra == "dev"
Provides-Extra: docs
Requires-Dist: furo>=2023.9.10; extra == "docs"
Requires-Dist: setuptools-scm>=8.1; extra == "docs"
Requires-Dist: sphinx_design>=0.6; extra == "docs"
Requires-Dist: sphinx-autoapi>=3; extra == "docs"
Requires-Dist: sphinx-copybutton>=0.5; extra == "docs"
Requires-Dist: sphinxcontrib-bibtex>=2.4.2; extra == "docs"
Requires-Dist: sphinxcontrib-svg2pdfconverter>=1.2; extra == "docs"
Requires-Dist: sphinxext-opengraph>=0.9; extra == "docs"
Requires-Dist: ipython; extra == "docs"
Requires-Dist: ipykernel; extra == "docs"
Requires-Dist: nbsphinx; extra == "docs"
Requires-Dist: sphinx-autodoc-typehints; extra == "docs"

[![PyPI](https://img.shields.io/pypi/v/mqt.predictor?logo=pypi&style=flat-square)](https://pypi.org/project/mqt.predictor/)
![OS](https://img.shields.io/badge/os-linux%20%7C%20macos%20%7C%20windows-blue?style=flat-square)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://opensource.org/licenses/MIT)
[![CI](https://img.shields.io/github/actions/workflow/status/cda-tum/mqt-predictor/ci.yml?branch=main&style=flat-square&logo=github&label=ci)](https://github.com/cda-tum/mqt-predictor/actions/workflows/ci.yml)
[![CD](https://img.shields.io/github/actions/workflow/status/cda-tum/mqt-predictor/cd.yml?style=flat-square&logo=github&label=cd)](https://github.com/cda-tum/mqt-predictor/actions/workflows/cd.yml)
[![Documentation](https://img.shields.io/readthedocs/mqt-predictor?logo=readthedocs&style=flat-square)](https://mqt.readthedocs.io/projects/predictor)
[![codecov](https://img.shields.io/codecov/c/github/cda-tum/mqt-predictor?style=flat-square&logo=codecov)](https://codecov.io/gh/cda-tum/mqt-predictor)

<p align="center">
  <a href="https://mqt.readthedocs.io">
   <picture>
     <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/cda-tum/mqt/main/docs/_static/mqt_light.png" width="60%">
     <img src="https://raw.githubusercontent.com/cda-tum/mqt/main/docs/_static/mqt_dark.png" width="60%">
   </picture>
  </a>
</p>

# MQT Predictor: Automatic Device Selection with Device-Specific Circuit Compilation for Quantum Computing

MQT Predictor is a framework that allows one to automatically select a suitable quantum device for a particular application and provides an optimized compiler for the selected device.
It not only supports end-users in navigating the vast landscape of choices, it also allows to mix-and-match compiler passes from various tools to create optimized compilers that transcend the individual tools.
Evaluations on more than 500 quantum circuits and seven devices have shown that—compared to Qiskit's and TKET's most optimized compilation flows—the MQT Predictor yields circuits with an expected fidelity that is on par with the best possible result that could be achieved by trying out all combinations of devices and compilers and even achieves a similar performance when considering the critical depth as an alternative figure of merit.

Therefore, MQT Predictor tackles this problem from two angles:

1. It provides a method (based on Reinforcement Learning) that produces device-specific quantum circuit compilers by combining compilation passes from various compiler tools and learning optimized sequences of those passes with respect to a customizable figure of merit). This mix-and-match of compiler passes from various tools allows one to eliminate vendor locks and to create optimized compilers that transcend the individual tools.

2. It provides a prediction method (based on Supervised Machine Learning) that, without performing any compilation, automatically predicts the most suitable device for a given application. This completely eliminates the manual and laborious task of determining a suitable target device and guides end-users through the vast landscape of choices without the need for quantum computing expertise.

<p align="center">
<picture>
  <img src="docs/_static/problem.png" width="100%">
</picture>
</p>

For more details, please refer to:

<p align="center">
  <a href="https://mqt.readthedocs.io/projects/predictor">
  <img width=30% src="https://img.shields.io/badge/documentation-blue?style=for-the-badge&logo=read%20the%20docs" alt="Documentation" />
  </a>
</p>

MQT Predictor is part of the [Munich Quantum Toolkit (MQT)](https://mqt.readthedocs.io/) developed by the [Chair for Design Automation](https://www.cda.cit.tum.de/) at the [Technical University of Munich](https://www.tum.de/).

If you have any questions, feel free to create a [discussion](https://github.com/cda-tum/mqt-predictor/discussions) or an [issue](https://github.com/cda-tum/mqt-predictor/issues) on [GitHub](https://github.com/cda-tum/mqt-predictor).

## Getting Started

`mqt-predictor` is available via [PyPI](https://pypi.org/project/mqt.predictor/).

```console
(venv) $ pip install mqt.predictor
```

The following code gives an example on the usage:

```python3
from mqt.predictor import qcompile
from mqt.bench import get_benchmark

# get a benchmark circuit on algorithmic level representing the GHZ state with 5 qubits from [MQT Bench](https://github.com/cda-tum/mqt-bench)
qc_uncompiled = get_benchmark(benchmark_name="ghz", level="alg", circuit_size=5)

# compile it using the MQT Predictor
qc_compiled, compilation_information, quantum_device = qcompile(
    qc_uncompiled, devices="all", figure_of_merit="expected_fidelity"
)

# print the selected device and the compilation information
print(quantum_device, compilation_information)

# draw the compiled circuit
print(qc_compiled.draw())
```

> [!NOTE]
> To execute the code, respective machine learning models must be trained before.
> Up until mqt.predictor v2.0.0, pre-trained models were provided. However, this is not feasible anymore due to the
> increasing number of devices and figures of merits. Instead, we now provide a detailed documentation on how to train
> and setup the MQT Predictor framework.\*\*

**Further documentation and examples are available at [ReadTheDocs](https://mqt.readthedocs.io/projects/predictor).**

## References

In case you are using MQT Predictor in your work, we would be thankful if you referred to it by citing the following publication:

```bibtex
@ARTICLE{quetschlich2024mqtpredictor,
    AUTHOR      = {N. Quetschlich and L. Burgholzer and R. Wille},
    TITLE       = {{MQT Predictor: Automatic Device Selection with Device-Specific Circuit Compilation for Quantum Computing}},
    YEAR        = {2024},
    JOURNAL     = {ACM Transactions on Quantum Computing (TQC)},
    DOI         = {10.1145/3673241},
    EPRINT      = {2310.06889},
    EPRINTTYPE  = {arxiv},
}
```

## Acknowledgements

This project received funding from the European Research Council (ERC) under the European Union's Horizon 2020 research
and innovation program (grant agreement No. 101001318), was part of the Munich Quantum Valley, which is supported by the
Bavarian state government with funds from the Hightech Agenda Bayern Plus, and has been supported by the BMWK on the
basis of a decision by the German Bundestag through project QuaST, as well as by the BMK, BMDW, the State of Upper
Austria in the frame of the COMET program, and the QuantumReady project within Quantum Austria (managed by the FFG).

<p align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/cda-tum/mqt/main/docs/_static/tum_dark.svg" width="28%">
<img src="https://raw.githubusercontent.com/cda-tum/mqt/main/docs/_static/tum_light.svg" width="28%" alt="TUM Logo">
</picture>
<picture>
<img src="https://raw.githubusercontent.com/cda-tum/mqt/main/docs/_static/logo-bavaria.svg" width="16%" alt="Coat of Arms of Bavaria">
</picture>
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/cda-tum/mqt/main/docs/_static/erc_dark.svg" width="24%">
<img src="https://raw.githubusercontent.com/cda-tum/mqt/main/docs/_static/erc_light.svg" width="24%" alt="ERC Logo">
</picture>
<picture>
<img src="https://raw.githubusercontent.com/cda-tum/mqt/main/docs/_static/logo-mqv.svg" width="28%" alt="MQV Logo">
</picture>
</p>
