I have several mixing unitary circuits written using Pennylane to be used in the QAOA algorithm. Furthermore, I'd like to write unit tests for these mixing circuits to ensure that the code is doing what it is supposed to in the future as changes are made to the codebase. Consider the basic example:
def x_mixer(beta, wires): for i in wires: qml.RX(beta, wires=i)
Currently, I'm thinking of using assert statements to check that the output of:
dev = qml.device('lightning.qubit', wires=2, shots=10000) circuit = qml.QNode(mixer_circuit, dev) result = circuit(0.5, wires=[0, 1])
is a certain value. Now one issue is that the results themselves are probabilistic and change during each run. My first question: What's the best way to get around this? Can you set random_seed in any of the simulator devices?
In general if someone has ideas on how to do unit testing for Pennylane circuits, it would be really appreciated.