Valueerror: too many values to unpack (expected 2) dimod.qubo_to_ising

Although I'm passing a QUBO as a dictionary to dimod.qubo_to_ising, I get "Valueerror: too many values to unpack (expected 2)".

What may be causing this error?

0

Comments

3 comments
  • Hi Ramy,

    In the QUBO dictionary parameter, if any one of the keys is not an iterable of length 2, dimod.qubo_to_ising(Q, offset=0.0) will throw the above error. For example, Q = {('a', 'a'): 1, ('b', 'b'): 1, ('c','c'):1, ('a', 'b','c'): 1}; here the key ('a', 'b','c') is a 3 valued tuple and will generate the error. 

    You’ll also get the above error if you perform an incorrect return operation, such as h, J = qubo_to_ising(Q) rather than h, J, offset = qubo_to_ising(Q). In this case, the number of values expected to be returned does not match the number actually returned.

    I hope this helps! Please let me know if you have any other questions.

    0
    Comment actions Permalink
  • Thanks Sukhraan S! The error was solved.

    I'm currently working on implementing the algorithm discussed in the following paper:

    https://arxiv.org/pdf/2001.04014.pdf

    I'm confused with how to code equation (12) in appendix B.

    I would really appreciate it if you could help me with it.

    Regards 

    0
    Comment actions Permalink
  • Hi Ramy,

    This question has been previously posted here: https://support.dwavesys.com/hc/en-us/community/posts/4406225748119-Embedding-Ising-

    Please follow the above thread for its answer. Thank you.

    0
    Comment actions Permalink

Please sign in to leave a comment.

Didn't find what you were looking for?

New post