Hello everyone,
I am trying to interpret the output of a QAOA circuit when I use labelled instead of numbered wires. My goal is to solve a QUBO problem, which is defined by the following matrix in pandas.DataFrame
format:
ticker JNPR_long RCL_long JNPR_short RCL_short
ticker
JNPR_long -3.014872 3.953869 4.914029 3.946705
RCL_long 3.953869 -2.732877 3.946705 4.953599
JNPR_short 4.914029 3.946705 -2.862899 3.953869
RCL_short 3.946705 4.953599 3.953869 -3.224033
The corresponding cost Hamiltonian is
(-0.05060647606437355) [ZRCL_long]
+ (-0.0497585207586973) [ZJNPR_short]
+ (-0.04899865483748267) [ZJNPR_long]
+ (-0.04815069953180642) [ZRCL_short]
+ (0.06917047107755245) [IJNPR_long]
+ (0.019733527499637107) [ZJNPR_long ZRCL_short]
+ (0.019733527499637107) [ZRCL_long ZJNPR_short]
+ (0.01976934273883488) [ZJNPR_long ZRCL_long]
+ (0.01976934273883488) [ZJNPR_short ZRCL_short]
+ (0.02457014657386209) [ZJNPR_long ZJNPR_short]
+ (0.024767993064001435) [ZRCL_long ZRCL_short]
and when I check its wires I get the same labels as in the index of the pandas DataFrame but sorted
# cost_h.wires output.
<Wires = ['JNPR_long', 'JNPR_short', 'RCL_long', 'RCL_short']>
After defining the circuit and optimising its parameters, I call the following circuit probabilities function with the optimal parameters
@qml.qnode(dev)
def circuit_probabilities(params):
circuit(params)
return qml.probs(wires=cost_h.wires)
and get the output probability distribution
# circuit_probabilities(opt_params) output.
array([0.14723998, 0.15039128, 0.14555833, 0.03342168, 0.14674327,
0.0471349 , 0.04516574, 0.0010264 , 0.14823591, 0.04789943,
0.04569813, 0.00105497, 0.03367039, 0.00108493, 0.00098973,
0.00468493])
which implies that the quantum states [0 0 0 1], [1 0 0 0], [0 0 0 0], [0 1 0 0] and [0 0 1 0] are the most probable ones.
What is the order of the elements in each of those binary vector/strings? The same as in the original pandas DataFrame index? The same as in cost_h.wires
? That means, does [0 0 1 0] correspond to
a) JNPR_long = 0; RCL_long = 0; JNPR_short = 1; RCL_short = 0,
b) or to JNPR_long = 0; JNPR_short = 0; RCL_long = 1; RCL_short = 0?
Thank you very much in advance.