Getting a large QUBO matrix (1,000 rows and columns) from Excel into Python/IDE
Is there a way to bring a large QUBO matrix, with say 1,000 rows and columns, from Excel (i.e. values in cells) into Python code used by the Leap IDE Workspace? (If it was a small QUBO matrix then it is straightforward to use text to create the QUBO matrix in the Python code.)
Comments
Hi Tim,
The functionality to convert a NumPy array to a binary quadratic model is available in Ocean SDK. There is a list of all the conversions to and from other formats that are supported in the documentation.
So, in order to import data from an excel worksheet, save it to a csv file. This csv file can be loaded as a NumPy array by using numpy.loadtxt().
Here is an example:
AdjVectorBQM has been deprecated and BinaryQuadraticModel can be used for large problems.
Please let us know if you have any further questions.
Please sign in to leave a comment.