dwavesystems / dwavesystems/dwave-system
majority_vote confuses Ising and QUBO problems
- Dominant language
- Python
- Stars
- 98
- Forks
- 67
- Avg merge
- 7m
- Merged PRs (30d)
- 1
Description
**Description**
In file 'chain_breaks.py', line 213 is
if samples.all(): # spin-valued
checking whether the samples consist only of +1 and -1, in which case the submitted problem is determined to be an Ising. But that doesn't work for some outputs since, in addition to -1 and +1, there may be 0 values corresponding to (I guess) unused qubits. Those zeros confuse the test on l. 213 and it incorrectly determines the problem to be a QUBO (since samples.all() is false).
I fixed that, in my case, by replacing line 213 with
if np.amin(samples) == -1: # spin-valued
In some rare cases all valid spins of an Ising problem solution might be +1, in which case the proposed test would also fail. But then, I guess, the output of majority_vote, as implemented, should be the same regardless of whether it is an Ising or a QUBO problem.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.