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