예제 #1
0
 def test_spin(self):
     poly = BinaryPolynomial({'abc': 1, 'bc': 1, 'ab': -1, '': 0}, 'SPIN')
     H, off = poly.to_hubo()
     new = BinaryPolynomial.from_hubo(H, off)
     self.assertEqual(poly, new.to_spin())
예제 #2
0
 def test_binary(self):
     poly = BinaryPolynomial({'abc': 1, 'bc': 1, 'ab': -1, '': 0}, 'BINARY')
     H, off = poly.to_hubo()
     new = BinaryPolynomial.from_hubo(H, off)
     self.assertEqual(poly, new)