entropicalabs / openqaoa

Multi-backend SDK for quantum optimisation
MIT License
113 stars 59 forks source link

output of `measurement_outcomes` should be serializable #228

Open vishal-ph opened 1 year ago

vishal-ph commented 1 year ago

Prerequisites

Before raising this issue, I have already checked that I am:

Describe the bug

Running a QAOA computation on a QPU and attempting to dump the results fails because some QPUs return their measurement_outcome probabilities as a numpy.float, which is not python serializable. This issue may also happen for statevector simulators, where the measurement_outcomes are wavefunctions which are complex arrays.

To Reproduce

Steps to reproduce the behavior:

Expected behavior

OpenQAOA should convert all non-serializable outputs to native python types, so that QPU results including measurement outcomes can be dumped into a JSON