Traditional QUBO vs D-Wave QUBOs Matrix
I'm new to this topic but seems that are several types of QUBO matrices, I want to know what type of QUBO matrix should be used at D-Wave (mainly in dwave-hybrid).
type 1) Traditional QUBO matrix is "full symmetric": linear coefficients "main diagonal terms", quadratic coefficients "all off-diagonal terms".
type 2) D-Wave QUBO matrix (A) is "upper triangular": linear coefficients "main diagonal terms", quadratic coefficients "upper off-diagonal terms".
type 3) D-Wave QUBO matrix (B) is "upper triangular with all diagonal entries equal to zero", linear coefficients separated in a dictionary, quadratic coefficients (from the upper off-diagonal terms) in another dictionary.
my_qubo_array = http://www.sharecsv.com/s/051ba20b9dcd3e50135315063b420ae1/qubo.csv # type 1 (full symmetric qubo)
bqm = convert_numpy_to_dictionary(my_qubo_array)
- work with QBsolv: QBSolv().sample_qubo(bqm, solver=sampler)
- won't work with Hybrid: State.from_sample(min_sample(bqm), bqm) # AttributeError: 'dict' object has no attribute 'vartype'
bqm = dimod.BinaryQuadraticModel.from_numpy_matrix(my_qubo_array)
- won't work in QBsolv # AttributeError: 'BinaryQuadraticModel' object has no attribute 'items'
- work with Hybrid
Converting a Full Symmetric QUBO matrix to dictionaries also won't work:
linear_dict = https://paste.debian.net/1072122/
quadratic_dict = https://paste.debian.net/1072125/
bqm = dimod.BinaryQuadraticModel(linear=linear_dict, quadratic=quadratic_dict, offset=1.0, vartype=dimod.Vartype.BINARY)
# ValueError: no self-loops allowed, therefore (0, 0) is not an allowed interaction
I believe that this "quadratic_dict" must be the type 3 (upper triangular with all diagonal entries equal to zero)
So my questions are:
a) what are the correct and best type of QUBO matrix to work in D-Wave applications (mainly dwave-hybrid)
b) is there some converter from type 1 (full symmetric) matrix to type 2 or 3 matrices?
c) if I have the type 2 matrix (upper triangular), what "dimod.BinaryQuadraticModel.function" will receive a numpy array and understand the linear on the diagonal terms and quadratic on the upper off-diagonal terms?
d) about the "off-diagonal terms", some docs say "nonzero off-diagonal terms". When transforming in a dictionary, if the position (1,2) is "0" I don't need to put in the dictionary? the dictionary will have only the "upper" "off-diagonal" "nonzero" terms?