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)
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())
def test_degree3(self): poly = BinaryPolynomial.from_hubo({'abc': -1}, 0) self.assertEqual(poly.degree, 3)