Skip to content

Challenge 4

kifumi edited this page Nov 4, 2021 · 16 revisions

Grader update announcement

We updated the 4c grader with new seed (42 instead of 12345) and shots (512 instead of 1000) for the simulator for more accurate grading. This change will have NO impact in terms of scores, but your current solutions may not be able to pass the new grader. We have tested the top 5 solutions, and found one case that did not pass the new version (0.8.7). We encourage everyone to resubmit their code using the updated grader and let us know if your previous submissions could not pass the new grader.

To qualify for the top 10, your solution will need to be graded using the new 0.8.7 grader before the judges perform the manual check after the end of the challenge.

Upgrade grader (0.8.7)

If you are installing the grader locally, you can update your grader using the following code in a Jupyter notebook cell:

!pip install --upgrade git+https://github.com/qiskit-community/Quantum-Challenge-Grader.git

You can verify the grader version by running the following code (you may need to restart Jupyter notebook kernel for changes)

import qc_grader
qc_grader.__version__

you should see 0.8.7 in the output of the cell.

If you are running your notebook on IBM Quantum Lab, an update will come soon to update the grader version to 0.8.7. You can also update the grader using the same code mentioned above, if it is not already updated automatically. Once the new grader (0.8.7) has been pushed to and available in Quantum Lab you can update the your environment (to pick up the new grader) by reseting your notebook pod: From the File menu in Quantum Lab, choose Hub Control Panel, select Stop My Lab (this may take a minute), then select Start My Server.

4c Rules Reminder

  1. You may not change the submission code in the “### DO NOT CHANGE THE CODE BELOW” section. We defined this code to ensure that the precision will be evaluated correctly by the grader. In order to judge everyone’s code fairly, please do not change the parameter (p, alpha, beta, gamma) and the function arguments.

  2. Additionally, you may not add new registers in the "### DO NOT CHANGE THE CODE BELOW” section.

  3. Please fix the seed to 42 in case you want to use the transpile option.

  4. Submissions from the top 10 scorers will be examined by the judges to make sure their implementations do not violate the rules. Judges will also verify the following:

    • In constraint_testing function, you need to set the flag to 1 if the solution is infeasible.
    • By reinitialization function, the data_qubits and qr_f must be initialized to zero.
  5. If you just want to experiment your code, you can use the following code to check your solution without submission. The grade_job() function will also return more meaningful messages when your solution is not correct to guide you.

from qc_grader.grade import grade_job
grade_job(job, '4c')

However, grade_job only checks your answer, it does NOT submit your answer. To submit your answer, please use grade_ex4c(job).

  1. When you have solved the last exercise 4c, please DM your code to @Kifumi Numata! The challenge development team would like to have a head start on evaluating your code.
  2. We will also be creating a folder on our public github repo for our participants to share their solutions after the challenge concludes, including other approaches or methods for solving 4c, such as using Grover circuit, etc.

4c Solution submission guideline

  1. For those who have completed challenge 4c and are among the top 20 based on the updated challenge stats, please make sure to share your current solution to @Kifumi Numata by DM.
  2. Please use submission_template.py when sharing your code to @Kifumi Numata
  3. We encourage people to submit their most successful solution so far using the attached template even if you still intend to work on further improving your score. In case your best score violates the rule, then your next best score will become your score.
  4. Please do not share your token in your submissions. And make sure to generate a new token after the challenge to mitigate any issues.

Why am I seeing "BrokenProcessPool" error in prepare_ex4c?

This is likely due to memory issues when creating the job with a large and complex circuit. We are investigating the issues further. In the mean time, you can try to run the notebooks locally and grade locally.

Why am I seeing "Unable to obtain job URLs" error in grade_ex4c?

You can follow the steps mentioned by Yusheng Zhao in the challenge slack channel to resolve this issue. Alternatively, you can try re-run prepare_ex4c to submit another job and grade again.

Can I get more meaningful error messages than Oops 😕! Your answer is incorrect?

Yes, in fact we have implemented a few meaningful error messages but a bug has prevented the messages to come through when grade_ex4c(job) is run. Here's a work around:

from qc_grader.grade import grade_job
grade_job(job, '4c')

However, grade_job only checks your answer, it does NOT submit your answer. To submit your answer, please use grade_ex4c(job).

U1 formula in Challenge 4c -Step 1

The correct equation of U1 gate is; U1(-gamma*(L2-L1))=exp^(-i(gamma*(L2-L1))) Also, be careful to use the appropriate sign in the phase of U1, when creating phase_return function.

Penalty equations in 4c

There were some inconsistencies between the text and the formula.
The correct equation of penalty(z) in "General Approach" and "Step 5 Penalty Dephasing" is;
The correct equation in "Step 4 Constraint Testing" is;