-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Improve error messaging for the katas that allow it #176
Comments
I will work on the first task (Superposition). |
I will be working on the Measurements test output improvement |
I will work on the BasicGates, to log the actual state. |
Per #176 Co-authored-by: Mariia Mykhailova <[email protected]>
@tcNickolas What kind of messaging did you have in mind for SolveSATWithGrover? |
@jainvasu631 Apologies for the delay replying! For the oracle-based tasks, there are two ways to verify that they are done correctly:
Currently most of the katas use a mixed approach - the basis check to make sure the solution behaves correctly on the basis states (in a "classical" case), and the unitary comparison to make sure that there are no unexpected phases creeping in somewhere. The error messaging would be helpful for the basis check part, telling the learner "Your solution returns 0 for input 101 when it should return 1" or "Your solution modified the state of input qubits for input 101 (it became 110)". |
Since I worked on the SolveSATWithGrover Workbook, I remember that the testing harness is incredibly slow for certain tasks. Specifically it takes significant time for Tasks 1.5, 1.6 and Task 2.2. When I investigated the slowdown I saw that they include the check AssertOracleImplementsFunction which essentially does what you describe (iterating through basis states and checking the answer), we just need to add a message statement when the assert fails. I think I can work on this. Also since DeutschJozsaAlgorithm is also Oracle based, I can try to do the same and implement the AssertOracleImplementsFunction with the improved checking and error statements. |
@jainvasu631 You make a good point about the tests as well. I spent a bit of time looking into why are they so slow when I was reviewing your workbook PR, and opened #507 for refactoring them - we can make them faster without modifying the way the testing is done, just by being more careful about the test instances we're using. I'm hoping somebody will pick it up in the next couple of weeks, since it's a pretty good first issue for somebody to do - if not, and if you're willing, I'll welcome your help :-) |
Several katas could have better error messaging:
DumpMachine
toAssertEqualOnZeroState
)AssertOperationsEqualReferenced
). Since the actual test compares the unitaries, we might want to add aDumpDiffOnOneInput
that would:DistinguishTwoStates_OneQubit
and logging the mismatches. We'd have to be careful not to log 50 lines of mismatches, though... Maybe keep track of different kinds of mismatches and report aggregates in the end of the test (e.g., "Classified |0⟩ as |1⟩ 15 times, classified |1⟩ as |0⟩ 21 times")?There are probably other katas that allow similar improvements - please share the ideas in the comments!
The text was updated successfully, but these errors were encountered: