majority_vote confuses Ising and QUBO problems
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.
Thanks, good catch! Do you want to make a pr with the change?
No problem, glad I could help. Not sure what "pr" is, but please proceed as you find most appropriate (as long as I don't have to pay) :)
Hristo
From: Alexander Condello [email protected] Sent: Friday, January 31, 2020 4:54 PM To: dwavesystems/dwave-system [email protected] Cc: hdjidjev [email protected]; Author [email protected] Subject: Re: [dwavesystems/dwave-system] majority_vote confuses Ising and QUBO problems (#252)
Thanks, good catch! Do you want to make a pr with the change?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/dwavesystems/dwave-system/issues/252?email_source=notifications&email_token=AONPEGSGJEXF5OST6VJK67DRAS23LA5CNFSM4KN4ITS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKQMA6Q#issuecomment-580960378, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AONPEGXE4PHFOGDDMWLQJBLRAS23LANCNFSM4KN4ITSQ.