Developer Challenge: Circuit Optimization

Awarded for:

Best solution to a specific challenge called: “Circuit optimization This year’s challenge is to optimize circuits to minimize noise when they are executed on a real IBMQ backend, by using the properties of the backends themselves. These properties contain information about the physics of the device, such as qubit lifetimes (decoherence and relaxation), gate and readout error rates, and gate latencies. Submissions will be in the form of a PassManager and one or more Transformation passes that are used by this PassManager, which themselves take into account the properties of the backend.We have provided some starter code which can be used as a template to formulate your own submissions. LINK HERE

Submission Requirements

Submissions must meet General Submission Rules stated below.
Include well documented, stand-alone and original source code written with Python or Cython.

  • A concise description of the approach taken as a comment in the top of the main PassManager file
  • Include one PassManager and one or more TransformationPasses, which are then used by the PassManager. The PassManager may also use any of the pre-existing Qiskit transpiler passes.
  • Only use libraries that can be installed using either pip install (from PyPI) or conda install (with default channels and conda-forge only).
  • Submitter agrees to license the Submission under the Apache License, Version 2.0. Any submitted code may only include libraries that are licensed under, or that Submitter can license under, the Apache License, Version 2.0.
  • The submitter further agrees to sign the Qiskit Contributor License Agreement.
  • The chosen approach and submitted code is general enough that it will also run for any random input circuits.
  • Resulting output circuits must match the provided hardware topologies and the corresponding gate set (u1, u2, u3, cx). This can be verified by the provided pairs of input circuits and hardware topologies in the test function.
  • Include a concise explanation of the chosen methodology as a comment at the top of the main PassManager file.
  • Do not include any personally identifiable info (about yourself, your teammates and your respective organizations) in your video.Video submissions where submitters appear within the video are permitted as long as they do not otherwise disclose any personally identifiable info.

Sample Pass Manager

# -*- coding: utf-8 -*-

# Copyright 2019 IBM.
#
# Licensed under the Apache License, Version 2.0 (the “License”);
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an “AS IS” BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# =============================================================================

from qiskit import execute, Aer, QuantumCircuit
from qiskit.test.base import dicts_almost_equal
from qiskit.transpiler.basepasses import AnalysisPass, TransformationPass
from qiskit.test.mock import FakeMelbourne # NB will need to install dev requirements
from qiskit.transpiler.passes import TrivialLayout
from qiskit.transpiler import PassManager
from qiskit.providers.aer.noise.device import basic_device_noise_model


“””
Your solution needs to comprise of one or more passes that you have written along with
a PassManager that uses them. The PassManager is allowed to use passes that are already
included in Qiskit.
“””


class MyBasicAnalysisPass(AnalysisPass):
“””Analysis passes look at the DAG to identify some property and then write this
to the property set so that it can be accessed by other passes”””

def run(self, dag):
self.property_set[‘my depth’] = dag.depth()


class MyBasicTransformationPass(TransformationPass):
“””Transformation passes alter the DAG and then return a DAG. They can use properties that
have been written to the property set.
“””
def __init__(self, properties):
self.properties = properties

def run(self, dag):
dag_depth = self.property_set[‘my depth’]
gates = self.properties.gates
return dag


“”” To test your passes you can use the fake backend classes. Your solutions will be tested against
Yorktown, Ourense and Melbourne, as well as some internal backends. “””
backend = FakeMelbourne()
properties = backend.properties()
coupling_map = backend.configuration().coupling_map


“”” You must submit a pass manager which uses at least one pass you have written.
Examples of creating more complex pass managers can be seen in qiskit.transpiler.preset_passmanagers”””
pass_manager = PassManager()
pass_manager.append(TrivialLayout(coupling_map))
pass_manager.append(MyBasicAnalysisPass())
pass_manager.append(MyBasicTransformationPass(properties))

“”” This allows us to simulate the noise a real device has, so that you don’t have to wait for jobs to complete
on the actual backends.”””
noise_model = basic_device_noise_model(properties)
simulator = Aer.get_backend(‘qasm_simulator’)


“”” This is the circuit we are going to look at”””
qc = QuantumCircuit(2, 2)
qc.h(1)
qc.measure(0, 0)
circuits = [qc]


result_normal = execute(circuits,
simulator,
coupling_map=coupling_map).result().get_counts()

# NB we include the noise model in the second run
result_noisy = execute(circuits,
simulator,
noise_model=noise_model,
coupling_map=coupling_map).result().get_counts()

“”” Check to see how similar the counts from the two runs are, where delta the allowed difference between
the counts. Returns an empty string if they are almost equal, otherwise returns an error message which can
then be printed.”””
equality_check = dicts_almost_equal(result_normal, result_noisy, delta=1e-8)

if equality_check:
print(equality_check)

Prize:

First Prize:

4000

Second Prize:

1500

Judging Criteria

Each submission will be scored in each round based on the following criteria with a minimum score of 0 and a maximum score of 100 points, with the final score being the average of the judges’ scores:

5 Points

01.Documentation

15 Points

02. Novelty of idea

30 Points

03. Transpiler time

50 Points

04. Fidelity of executions

Judges

Luciano Bello

Researcher and Qiskit-Terra coder

William Zeng

Adjunct Lecturer

Waheeda Saib

Research Scientist

Ali Javadi

Research Scientist

Kevin Krsulich

Kevin Krsulich

Research Scientist