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

Fidelity-aware heuristic and search graph visualization #384

Merged
merged 130 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
7f00b84
equivalent to squash commit of fidelityHeuristic2 up to 020c0176
EliasLF Oct 23, 2023
36d833f
remove long running fidelity test case
EliasLF Oct 23, 2023
66972a2
🎨 pre-commit fixes
pre-commit-ci[bot] Oct 23, 2023
4aeac17
fixing linter warnings
EliasLF Oct 24, 2023
9f07e7f
🎨 pre-commit fixes
pre-commit-ci[bot] Oct 24, 2023
cb41d5f
fixing wrong import path in compile.py
EliasLF Oct 24, 2023
7ced472
🎨 pre-commit fixes
pre-commit-ci[bot] Oct 24, 2023
522a8fc
Merge branch 'main' into fidelityHeuristic3
burgholzer Oct 24, 2023
972ad92
replacing treedraw with walkerlayout and fixing imports
EliasLF Oct 29, 2023
90e9006
fix type hinting in search graph visualization
EliasLF Oct 30, 2023
cb6627a
🎨 pre-commit fixes
pre-commit-ci[bot] Oct 30, 2023
b9b4426
Merge branch 'main' into fidelityHeuristic3
EliasLF Oct 30, 2023
c67df39
fix python linter errors
EliasLF Oct 30, 2023
06efabc
fixing c linter errors
EliasLF Oct 31, 2023
9954826
🎨 pre-commit fixes
pre-commit-ci[bot] Oct 31, 2023
75f4785
fixing var definition errors
EliasLF Oct 31, 2023
b94c006
Merge branch 'fidelityHeuristic3' of https://github.com/EliasLF/qmap …
EliasLF Oct 31, 2023
6c06e8d
🎨 pre-commit fixes
pre-commit-ci[bot] Oct 31, 2023
855037a
fixing datalogger test
EliasLF Oct 31, 2023
d52231b
Merge branch 'fidelityHeuristic3' of https://github.com/EliasLF/qmap …
EliasLF Oct 31, 2023
a454158
fix dashing regex
EliasLF Nov 3, 2023
9fdb76e
fixing swap visualization bug
EliasLF Nov 3, 2023
2cf8c7a
🎨 pre-commit fixes
pre-commit-ci[bot] Nov 3, 2023
c336d5e
Merge branch 'main' into fidelityHeuristic3
burgholzer Nov 9, 2023
613aef6
🎨 pre-commit fixes
pre-commit-ci[bot] Nov 9, 2023
b8e54ea
🩹 leftovers from merge
burgholzer Nov 9, 2023
733069e
🚨 some new ruff fixes
burgholzer Nov 9, 2023
4d6ff67
🩹 correctly pass the `consider_fidelity` option through
burgholzer Nov 9, 2023
018c5c2
layer splitting implementation
EliasLF Nov 9, 2023
40f0d5a
Merge branch 'fidelityHeuristic3' of https://github.com/EliasLF/qmap …
EliasLF Nov 9, 2023
fd8b74f
python layer splitting setting pass-through
EliasLF Nov 9, 2023
043bbb2
adding layer splitting test
EliasLF Nov 10, 2023
076a393
🎨 pre-commit fixes
pre-commit-ci[bot] Nov 10, 2023
e66e1b0
fixed linter errors
EliasLF Nov 10, 2023
a9d0b9b
🎨 pre-commit fixes
pre-commit-ci[bot] Nov 10, 2023
aa1f2fd
further lint fixes
EliasLF Nov 10, 2023
752e270
Merge branch 'fidelityHeuristic3' of https://github.com/EliasLF/qmap …
EliasLF Nov 10, 2023
7ffb664
adding const
EliasLF Nov 10, 2023
48d5bd9
Merge branch 'main' into fidelityHeuristic3
EliasLF Nov 13, 2023
17ca441
preparation for iterative bidirectional routing
EliasLF Nov 13, 2023
286a14b
iterative bidirectional routing
EliasLF Nov 14, 2023
9c01361
🎨 pre-commit fixes
pre-commit-ci[bot] Nov 14, 2023
a6d3ee3
fix linter warnings
EliasLF Nov 14, 2023
27a3bae
Merge branch 'fidelityHeuristic3' of https://github.com/EliasLF/qmap …
EliasLF Nov 14, 2023
a60bb50
🎨 pre-commit fixes
pre-commit-ci[bot] Nov 14, 2023
cb62aff
fix sphinx error
EliasLF Dec 1, 2023
1fef5c8
fix spinx references
EliasLF Dec 1, 2023
a846a52
added comment on iterative bidirectional routing setting
EliasLF Dec 2, 2023
cbb0814
🎨 pre-commit fixes
pre-commit-ci[bot] Dec 2, 2023
32a559b
Update src/mqt/qmap/visualization/__init__.py
EliasLF Dec 2, 2023
448bfe3
changing Python imports to relative imports
EliasLF Dec 2, 2023
91eec8f
adding total_fidelity to Python CircuitInfo stub
EliasLF Dec 2, 2023
ce397c1
add visualization to docs dependencies
EliasLF Dec 2, 2023
75e09d2
make docs independent of graphviz
EliasLF Dec 2, 2023
8e023b1
adding note on graphviz to docs
EliasLF Dec 3, 2023
14a6398
🎨 pre-commit fixes
pre-commit-ci[bot] Dec 3, 2023
94180cf
deactivate clang tidy padding check
EliasLF Dec 3, 2023
855501c
Merge branch 'main' into fidelityHeuristic3
EliasLF Dec 3, 2023
0fb914f
simplifying composite operation building for data logging
EliasLF Dec 4, 2023
71d5265
readd const
EliasLF Dec 7, 2023
eaf538d
🎨 pre-commit fixes
pre-commit-ci[bot] Dec 7, 2023
c9b4b1e
fix unreachable return
EliasLF Dec 7, 2023
5948be9
expose both fidelity and log fidelity
EliasLF Dec 7, 2023
e294fd7
Merge branch 'fidelityHeuristic3' of https://github.com/EliasLF/qmap …
EliasLF Dec 7, 2023
df6afd8
🎨 pre-commit fixes
pre-commit-ci[bot] Dec 7, 2023
fc50069
remove InitialLayout::None and Layering::None
EliasLF Dec 7, 2023
9145b7d
split IBR and layer splitting config into activation and limit
EliasLF Dec 7, 2023
e09ff67
Merge branch 'fidelityHeuristic3' of https://github.com/EliasLF/qmap …
EliasLF Dec 7, 2023
405baa8
🎨 pre-commit fixes
pre-commit-ci[bot] Dec 7, 2023
03cd0ef
abort for invalid config
EliasLF Dec 7, 2023
66d8e28
Merge branch 'fidelityHeuristic3' of https://github.com/EliasLF/qmap …
EliasLF Dec 7, 2023
a6dea08
fixed tests
EliasLF Dec 7, 2023
c9591ec
adding reference for iterative bidirectional routing
EliasLF Dec 7, 2023
7ffb18f
fixing code coverage exclusion of visualization module
EliasLF Dec 7, 2023
3d4c23f
🎨 pre-commit fixes
pre-commit-ci[bot] Dec 7, 2023
41c1175
another fix to coverage omit
EliasLF Dec 7, 2023
b194d38
Merge branch 'main' into fidelityHeuristic3
EliasLF Dec 7, 2023
4b96793
remove code duplication in DataLogger's JSON generation
EliasLF Dec 8, 2023
93be1c1
🎨 pre-commit fixes
pre-commit-ci[bot] Dec 8, 2023
5d3d9ea
save considerFidelity and admissibleHeuristic in Node as member
EliasLF Dec 8, 2023
0181e58
Merge branch 'fidelityHeuristic3' of https://github.com/EliasLF/qmap …
EliasLF Dec 8, 2023
9be859e
🎨 pre-commit fixes
pre-commit-ci[bot] Dec 8, 2023
254b291
generate zeroMatrix ad-hoc
EliasLF Dec 8, 2023
6b933df
Merge branch 'fidelityHeuristic3' of https://github.com/EliasLF/qmap …
EliasLF Dec 8, 2023
eb3c8b5
🎨 pre-commit fixes
pre-commit-ci[bot] Dec 8, 2023
fbd09a1
replace infinities with max double
EliasLF Dec 13, 2023
50b1abc
split routing and pseudo-routing into 2 functions
EliasLF Dec 14, 2023
2def4ff
add test for invalid settings
EliasLF Dec 14, 2023
12560a6
use iterative bidirectional routing in 5Q tests
EliasLF Dec 14, 2023
55ae55b
🎨 pre-commit fixes
pre-commit-ci[bot] Dec 14, 2023
4c624e7
fix typo in doc string
EliasLF Dec 14, 2023
1235917
add test DataLoggerAfterClose
EliasLF Dec 14, 2023
0bbf301
add test FidelityDistanceNoFidelity
EliasLF Dec 14, 2023
5f242bc
🎨 pre-commit fixes
pre-commit-ci[bot] Dec 14, 2023
cd784bd
fix lint warnings
EliasLF Dec 14, 2023
9c8686f
Merge branch 'fidelityHeuristic3' of https://github.com/EliasLF/qmap …
EliasLF Dec 14, 2023
d6f4126
🎨 pre-commit fixes
pre-commit-ci[bot] Dec 14, 2023
4eb9847
fix case style for DEFAULT_MATRIX
EliasLF Dec 14, 2023
0d25205
Merge branch 'main' into fidelityHeuristic3
EliasLF Dec 14, 2023
b9fe0ff
🎨 pre-commit fixes
pre-commit-ci[bot] Dec 14, 2023
8a99bfa
enabling dynamic initial layout for fidelity aware mapping
EliasLF Dec 15, 2023
2dda1a3
🎨 pre-commit fixes
pre-commit-ci[bot] Dec 15, 2023
8aa5ed3
fix empty dump test
EliasLF Dec 15, 2023
c0f6572
add python test_parameters
EliasLF Dec 15, 2023
42553a0
🎨 pre-commit fixes
pre-commit-ci[bot] Dec 15, 2023
b0f49d5
fix ruff warnings
EliasLF Dec 15, 2023
ccf14eb
Merge branch 'fidelityHeuristic3' of https://github.com/EliasLF/qmap …
EliasLF Dec 15, 2023
48456cc
fix test InvalidSettings
EliasLF Dec 15, 2023
c51f43e
🎨 pre-commit fixes
pre-commit-ci[bot] Dec 15, 2023
069e0cc
fix python test_parameters
EliasLF Dec 15, 2023
b4297ef
Merge branch 'fidelityHeuristic3' of https://github.com/EliasLF/qmap …
EliasLF Dec 15, 2023
04c3fd2
remove swap_limit from test_parameters
EliasLF Dec 15, 2023
0686811
add error rates to test_parameters
EliasLF Dec 15, 2023
3165681
🎨 pre-commit fixes
pre-commit-ci[bot] Dec 15, 2023
96a2fd8
explicit cleanup of tmp directory in test_parameters
EliasLF Dec 15, 2023
f9b4480
🎨 pre-commit fixes
pre-commit-ci[bot] Dec 15, 2023
334e5e3
add InvalidCircuits test
EliasLF Dec 15, 2023
b266b5b
Merge branch 'fidelityHeuristic3' of https://github.com/EliasLF/qmap …
EliasLF Dec 15, 2023
69cece5
🎨 pre-commit fixes
pre-commit-ci[bot] Dec 15, 2023
870af6c
fix lint warning
EliasLF Dec 15, 2023
b52a1c0
🎨 pre-commit fixes
pre-commit-ci[bot] Dec 15, 2023
f993249
remove redundant comments in visualization
EliasLF Dec 21, 2023
31532dd
add graphviz to dependencies
EliasLF Dec 21, 2023
e281b03
optimizing splittable check
EliasLF Dec 21, 2023
6f25e82
🎨 pre-commit fixes
pre-commit-ci[bot] Dec 21, 2023
fa2ed08
Apply suggestions from code review
EliasLF Dec 21, 2023
7b7d43e
readd data_logging_path type hint
EliasLF Dec 21, 2023
82c51f0
🔧 ensure Graphviz is installed in the RtD CI
burgholzer Dec 22, 2023
6e43054
Merge remote-tracking branch 'origin/main' into fidelityHeuristic3
burgholzer Dec 22, 2023
aebd205
📝 add back note about graphviz
burgholzer Dec 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ build:
os: ubuntu-22.04
tools:
python: "3.11"
apt_packages:
- graphviz
jobs:
post_checkout:
# Skip docs build if the commit message contains "skip ci"
Expand Down
31 changes: 31 additions & 0 deletions docs/source/Mapping.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"<style>.widget-subarea{display:none;} /*hide widgets as they do not work with sphinx*/</style>\n",
"\n",
"# Quantum Circuit Mapping\n",
"\n",
"Many quantum computing architectures limit the pairs of qubits that two-qubit operations can be applied to.\n",
Expand Down Expand Up @@ -263,6 +265,35 @@
"\n",
"qc_mapped_w_teleport.draw(output=\"mpl\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Visualizing search graphs\n",
"\n",
"For deeper insight into a specific mapping process one can visualize the search graphs generated during heuristic mapping."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from mqt import qmap\n",
"\n",
"visualizer = qmap.visualization.SearchVisualizer()\n",
"qc_mapped, res = qmap.compile(qc, arch, method=\"heuristic\", visualizer=visualizer)\n",
"visualizer.visualize_search_graph()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"There exist a wide range of customizations for these visualizations. Please refer to the [reference documentation](library/Visualization.rst) for more information."
]
}
],
"metadata": {
Expand Down
1 change: 1 addition & 0 deletions docs/source/library/Library.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ Library
Subarchitectures
Synthesis
SynthesisResults
Visualization
27 changes: 27 additions & 0 deletions docs/source/library/Visualization.rst
EliasLF marked this conversation as resolved.
Show resolved Hide resolved
EliasLF marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Visualization
=============

.. currentmodule:: mqt.qmap

All visualization functionality is bundled in the sub-module :mod:`mqt.qmap.visualization`.

Search graph visualization
##########################

.. currentmodule:: mqt.qmap.visualization

The recommended way to visualize search graphs of a mapping process is via a :class:`SearchVisualizer` object, which can be passed to the :func:`mqt.qmap.compile` function to enable data logging during mapping, after which this data can be visualized by calling the method :meth:`SearchVisualizer.visualize_search_graph`.

.. note::
:meth:`SearchVisualizer.visualize_search_graph` returns an IPython display object and therefore requires to be executed in a jupyter notebook or jupyter lab environment.

.. note::
Automatic layouting of architecture or search nodes requires `Graphviz <https://graphviz.org/>`_ to be installed (except for the layouting method :code:`walker`). If Graphviz is called without it being installed, it will ensue in an error such as:

:code:`FileNotFoundError: [Errno 2] "sfdp" not found in path.`

Consequently, the only way to use :meth:`SearchVisualizer.visualize_search_graph` without Graphviz is by passing explicit architecture node positions or hiding the architecture graph by passing :code:`show_layout=None`.
burgholzer marked this conversation as resolved.
Show resolved Hide resolved

.. autoclass:: SearchVisualizer
:special-members: __init__
:members:
137 changes: 134 additions & 3 deletions include/Architecture.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ constexpr std::uint32_t COST_TELEPORTATION =
2 * COST_CNOT_GATE + COST_MEASUREMENT + 4 * COST_SINGLE_QUBIT_GATE;
constexpr std::uint32_t COST_DIRECTION_REVERSE = 4 * COST_SINGLE_QUBIT_GATE;

constexpr std::uint16_t MAX_DEVICE_QUBITS = 128;

class Architecture {
public:
class Properties {
Expand Down Expand Up @@ -238,6 +240,10 @@ class Architecture {
createDistanceTable();
}

[[nodiscard]] bool isEdgeConnected(const Edge& edge) const {
return couplingMap.find(edge) != couplingMap.end();
}

CouplingMap& getCurrentTeleportations() { return currentTeleportations; }
std::vector<std::pair<std::int16_t, std::int16_t>>& getTeleportationQubits() {
return teleportationQubits;
Expand All @@ -254,12 +260,127 @@ class Architecture {
createFidelityTable();
}

[[nodiscard]] const Matrix& getFidelityTable() const { return fidelityTable; }
[[nodiscard]] bool isFidelityAvailable() const { return fidelityAvailable; }

[[nodiscard]] const std::vector<Matrix>& getFidelityDistanceTables() const {
if (!fidelityAvailable) {
throw QMAPException("No fidelity data available.");
}
return fidelityDistanceTables;
}

[[nodiscard]] const Matrix&
getFidelityDistanceTable(std::size_t skipEdges) const {
if (!fidelityAvailable) {
throw QMAPException("No fidelity data available.");
}
if (skipEdges >= fidelityDistanceTables.size()) {
const static Matrix DEFAULT_MATRIX(nqubits,
std::vector<double>(nqubits, 0.0));
return DEFAULT_MATRIX;
}
return fidelityDistanceTables.at(skipEdges);
}

[[nodiscard]] const Matrix& getFidelityDistanceTable() const {
return getFidelityDistanceTable(0);
}

[[nodiscard]] double fidelityDistance(std::uint16_t q1, std::uint16_t q2,
std::size_t skipEdges) const {
if (!fidelityAvailable) {
throw QMAPException("No fidelity data available.");
}
if (q1 >= nqubits) {
throw QMAPException("Qubit out of range.");
}
if (q2 >= nqubits) {
throw QMAPException("Qubit out of range.");
}
if (skipEdges >= fidelityDistanceTables.size()) {
return 0.;
}
return fidelityDistanceTables.at(skipEdges).at(q1).at(q2);
}

[[nodiscard]] double fidelityDistance(std::uint16_t q1,
std::uint16_t q2) const {
return fidelityDistance(q1, q2, 0);
}

[[nodiscard]] const Matrix& getFidelityTable() const {
if (!fidelityAvailable) {
throw QMAPException("No fidelity data available.");
}
return fidelityTable;
}

[[nodiscard]] const std::vector<double>& getSingleQubitFidelities() const {
if (!fidelityAvailable) {
throw QMAPException("No fidelity data available.");
}
return singleQubitFidelities;
}

[[nodiscard]] const std::vector<double>& getSingleQubitFidelityCosts() const {
if (!fidelityAvailable) {
throw QMAPException("No fidelity data available.");
}
return singleQubitFidelityCosts;
}

[[nodiscard]] double getSingleQubitFidelityCost(std::uint16_t qbit) const {
if (!fidelityAvailable) {
throw QMAPException("No fidelity data available.");
}
if (qbit >= nqubits) {
throw QMAPException("Qubit out of range.");
}
return singleQubitFidelityCosts.at(qbit);
}

[[nodiscard]] const Matrix& getTwoQubitFidelityCosts() const {
if (!fidelityAvailable) {
throw QMAPException("No fidelity data available.");
}
return twoQubitFidelityCosts;
}

[[nodiscard]] double getTwoQubitFidelityCost(std::uint16_t q1,
std::uint16_t q2) const {
if (!fidelityAvailable) {
throw QMAPException("No fidelity data available.");
}
if (q1 >= nqubits) {
throw QMAPException("Qubit out of range.");
}
if (q2 >= nqubits) {
throw QMAPException("Qubit out of range.");
}
return twoQubitFidelityCosts.at(q1).at(q2);
}

[[nodiscard]] const Matrix& getSwapFidelityCosts() const {
if (!fidelityAvailable) {
throw QMAPException("No fidelity data available.");
}
return swapFidelityCosts;
}

[[nodiscard]] double getSwapFidelityCost(std::uint16_t q1,
std::uint16_t q2) const {
if (!fidelityAvailable) {
throw QMAPException("No fidelity data available.");
}
if (q1 >= nqubits) {
throw QMAPException("Qubit out of range.");
}
if (q2 >= nqubits) {
throw QMAPException("Qubit out of range.");
}
return swapFidelityCosts.at(q1).at(q2);
}

[[nodiscard]] bool bidirectional() const { return isBidirectional; }

[[nodiscard]] bool isArchitectureAvailable() const {
Expand All @@ -276,8 +397,13 @@ class Architecture {
distanceTable.clear();
isBidirectional = true;
properties.clear();
fidelityAvailable = false;
fidelityTable.clear();
singleQubitFidelities.clear();
singleQubitFidelityCosts.clear();
twoQubitFidelityCosts.clear();
swapFidelityCosts.clear();
fidelityDistanceTables.clear();
}

[[nodiscard]] double distance(std::uint16_t control,
Expand Down Expand Up @@ -357,9 +483,14 @@ class Architecture {
bool isBidirectional = true;
Matrix distanceTable = {};
std::vector<std::pair<std::int16_t, std::int16_t>> teleportationQubits{};
Properties properties = {};
Matrix fidelityTable = {};
Properties properties = {};
bool fidelityAvailable = false;
Matrix fidelityTable = {};
std::vector<double> singleQubitFidelities = {};
std::vector<double> singleQubitFidelityCosts = {};
Matrix twoQubitFidelityCosts = {};
Matrix swapFidelityCosts = {};
std::vector<Matrix> fidelityDistanceTables = {};

void createDistanceTable();
void createFidelityTable();
Expand Down
81 changes: 81 additions & 0 deletions include/DataLogger.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
//
// This file is part of the MQT QMAP library released under the MIT license.
// See README.md or go to https://github.com/cda-tum/qmap for more information.
//

#pragma once

#include "Architecture.hpp"
#include "Mapper.hpp"
#include "MappingResults.hpp"
#include "QuantumComputation.hpp"

#include <fstream>
#include <string>

class DataLogger {
public:
DataLogger(std::string path, Architecture& arch, qc::QuantumComputation qc)
: dataLoggingPath(std::move(path)), architecture(&arch),
nqubits(arch.getNqubits()), inputCircuit(std::move(qc)) {
initLog();
logArchitecture();
logInputCircuit(inputCircuit);
for (std::size_t i = 0; i < inputCircuit.getNqubits(); ++i) {
qregs.emplace_back("q", "q[" + std::to_string(i) + "]");
}
for (std::size_t i = 0; i < inputCircuit.getNcbits(); ++i) {
cregs.emplace_back("c", "c[" + std::to_string(i) + "]");
}
}

void initLog();
void clearLog();
void logArchitecture();
void logSearchNode(std::size_t layer, std::size_t nodeId,
std::size_t parentId, double costFixed, double costHeur,
double lookaheadPenalty,
const std::array<std::int16_t, MAX_DEVICE_QUBITS>& qubits,
bool validMapping,
const std::vector<std::vector<Exchange>>& swaps,
std::size_t depth);
void logFinalizeLayer(
std::size_t layer, const qc::CompoundOperation& ops,
const std::vector<std::uint16_t>& singleQubitMultiplicity,
const std::map<std::pair<std::uint16_t, std::uint16_t>,
std::pair<std::uint16_t, std::uint16_t>>&
twoQubitMultiplicity,
const std::array<std::int16_t, MAX_DEVICE_QUBITS>& initialLayout,
std::size_t finalNodeId, double finalCostFixed, double finalCostHeur,
double finalLookaheadPenalty,
const std::array<std::int16_t, MAX_DEVICE_QUBITS>& finalLayout,
const std::vector<std::vector<Exchange>>& finalSwaps,
std::size_t finalSearchDepth);
void splitLayer();
void logMappingResult(MappingResults& result);
void logInputCircuit(qc::QuantumComputation& qc) {
if (deactivated) {
return;
}
qc.dump(dataLoggingPath + "/input.qasm", qc::Format::OpenQASM);
};
void logOutputCircuit(qc::QuantumComputation& qc) {
if (deactivated) {
return;
}
qc.dump(dataLoggingPath + "/output.qasm", qc::Format::OpenQASM);
}
void close();

protected:
std::string dataLoggingPath;
Architecture* architecture;
std::uint16_t nqubits;
qc::QuantumComputation inputCircuit;
qc::RegisterNames qregs{};
qc::RegisterNames cregs{};
std::vector<std::ofstream> searchNodesLogFiles; // 1 per layer
bool deactivated = false;

void openNewLayer(std::size_t layer);
};
Loading