-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into msoeken/re-update
- Loading branch information
Showing
10 changed files
with
462 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,3 +89,4 @@ repos: | |
- networkx | ||
- mqt.ddsim | ||
- pytest | ||
- pandas-stubs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
102 changes: 102 additions & 0 deletions
102
notebooks/equivalence_checking/equivalence_checking_example.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Import" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from mqt.problemsolver.equivalence_checking import equivalence_checking" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Testing different Parameter Combinations for a Miter with known Counter Examples" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Generate table with all possible parameter combinations\n", | ||
"# that shows the used Grover iterations if correct counter examples\n", | ||
"# are found in all runs.\n", | ||
"equivalence_checking.try_parameter_combinations(\n", | ||
" path=\"res_equivalence_checking.csv\", # Path to save the results\n", | ||
" range_deltas=[0.1, 0.3, 0.5, 0.7, 0.9], # Range of \"delta\" values, a threshold parameter introduced in the paper\n", | ||
" range_num_bits=[6, 7, 8, 9], # Range of number of bits of the circuits to be verified\n", | ||
" range_fraction_counter_examples=[0, 0.01, 0.05, 0.1, 0.2], # Range of fraction of counter examples to be used\n", | ||
" shots_factor=8.0, # The number of shots for the quantum circuit is calculated as shots_factor * 2^num_bits\n", | ||
" num_runs=10, # Number of individual runs for each parameter combination\n", | ||
" verbose=False, # If True, the progress is printed\n", | ||
")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Find Counter Examples for given Miter and Parameter Combination" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"num_bits = 6\n", | ||
"num_counter_examples = 5\n", | ||
"\n", | ||
"# Create synthetic data for showing the example\n", | ||
"miter, _ = equivalence_checking.create_condition_string(num_bits=num_bits, num_counter_examples=num_counter_examples)\n", | ||
"\n", | ||
"# Run the equivalence checker\n", | ||
"counter_examples = equivalence_checking.find_counter_examples(\n", | ||
" miter=miter, # The condition string\n", | ||
" num_bits=num_bits, # Number of bits of the circuits to be verified\n", | ||
" shots=512, # Number of shots for the quantum circuit\n", | ||
" delta=0.7, # Threshold parameter introduced in the paper\n", | ||
")\n", | ||
"\n", | ||
"print(counter_examples)" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": ".venv", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
21 changes: 21 additions & 0 deletions
21
notebooks/equivalence_checking/res_equivalence_checking.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Input Bits,Counter Examples,0.1,0.3,0.5,0.7,0.9 | ||
6.0,0.0,-,15.0,15.0,15.0,15.0 | ||
6.0,1.0,5.0,5.0,5.0,5.0,5.0 | ||
6.0,3.0,-,5.0,5.0,5.0,9.0 | ||
6.0,6.0,-,12.0,12.0,12.0,14.0 | ||
6.0,13.0,-,5.0,5.0,5.0,- | ||
7.0,0.0,-,36.0,36.0,36.0,36.0 | ||
7.0,1.0,8.0,8.0,8.0,8.0,8.0 | ||
7.0,6.0,-,8.0,8.0,17.0,30.0 | ||
7.0,13.0,-,8.0,9.0,15.0,15.0 | ||
7.0,26.0,-,8.0,8.0,8.0,8.0 | ||
8.0,0.0,-,78.0,78.0,78.0,78.0 | ||
8.0,3.0,-,12.0,12.0,12.0,23.0 | ||
8.0,13.0,-,12.0,12.0,22.0,23.0 | ||
8.0,26.0,-,12.0,12.0,12.0,12.0 | ||
8.0,51,-,12.0,20.0,23.0,50.0 | ||
9.0,0.0,-,153.0,153.0,153.0,153.0 | ||
9.0,5.0,-,17.0,17.0,17.0,80.0 | ||
9.0,26.0,-,17.0,17.0,17.0,17.0 | ||
9.0,51.0,-,17.0,17.0,17.0,17.0 | ||
9.0,102.0,-,48.0,48.0,48.0,- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.