Skip to content

Commit

Permalink
Update analyze_results script
Browse files Browse the repository at this point in the history
  • Loading branch information
GoncaloPascoal committed Mar 28, 2024
1 parent 93e3159 commit 1fc8f73
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This dissertation proposes a method to address the **qubit routing problem** usi

Qubit routing, one of the most crucial stages in the compilation process, introduces additional operations to ensure that multi-qubit gates are only performed between connected qubits. It is a challenging combinatorial optimization problem that has been shown to be NP-complete.

Our RL environment represents quantum circuits as numerical matrices and we also provide the error rates of individual device edges to the models. Possible actions include inserting SWAP or BRIDGE operations, and we use action masking to prevent invalid actions and speed up training. To further optimize the routing process, we also perform gate commutation analysis. We have evaluated this approach for five IBM quantum computers ranging from 5 to 27 qubits, using both randomly generated and realistic circuits.
Our RL environment represents quantum circuits as numerical matrices, and we also provide the error rates of individual device edges to the models. Possible actions include inserting SWAP or BRIDGE operations, and we use action masking to prevent invalid actions and speed up training. To further optimize the routing process, we also perform gate commutation analysis. We have evaluated this approach for five IBM quantum computers ranging from 5 to 27 qubits, using both randomly generated and realistic circuits.

## Instructions

Expand Down
8 changes: 6 additions & 2 deletions scripts/analyze_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def swap_vs_bridge():


def evaluation_episodes_analysis():
prefix = ANALYSIS_DIR
prefix = f'{ANALYSIS_DIR}/episodes'
os.makedirs(prefix, exist_ok=True)
episodes_list = [1, 2, 4, 8, 16]

Expand All @@ -181,6 +181,8 @@ def evaluation_episodes_analysis():
stochastic = MetricsAnalyzer.unpickle(f'{results_prefix}/{name}.pickle')
metrics[name] = stochastic.metrics['rl']

log_metric(metrics_analyzer, prefix, 'log_reliability')

df = metrics_analyzer.metric_as_df('log_reliability')
rename_map = dict(
deterministic='Deterministic',
Expand Down Expand Up @@ -219,7 +221,7 @@ def routing_time():


def enhancements_analysis():
prefix = ANALYSIS_DIR
prefix = f'{ANALYSIS_DIR}/enhancements'
os.makedirs(prefix, exist_ok=True)

metrics_analyzer = MetricsAnalyzer.unpickle(f'{RESULTS_DIR}/belem/random.pickle')
Expand All @@ -240,6 +242,8 @@ def enhancements_analysis():
path = f'{RESULTS_DIR}/belem/enhancements/{variant}.pickle'
metrics[variant] = MetricsAnalyzer.unpickle(path).metrics['rl']

log_metric(metrics_analyzer, prefix, 'log_reliability')

df = metrics_analyzer.metric_as_df('log_reliability')
df.rename(columns=dict(rl='Default', **variants, sabre='SABRE'), inplace=True)
df = df.reindex(df.mean().sort_values(ascending=False).index, axis=1)
Expand Down

0 comments on commit 1fc8f73

Please sign in to comment.