def test_sanity_check(self): net = sat_tensornetwork.sat_count_tn([ (1, 2, 3), ]) count = tensornetwork.contractors.naive( net).get_final_node().get_tensor() self.assertEqual(count.numpy(), 7)
def test_single_variable(self): net = sat_tensornetwork.sat_count_tn([ (1, 1, 1), ]) count = tensornetwork.contractors.naive( net).get_final_node().get_tensor() self.assertEqual(count.numpy(), 1)
def test_four_variables(self): net = sat_tensornetwork.sat_count_tn([ (1, 2, 3), (1, 2, 4), ]) count = tensornetwork.contractors.naive(net).get_final_node().get_tensor() self.assertEqual(count.numpy(), 13)
def test_dual_clauses(self): net = sat_tensornetwork.sat_count_tn([ (1, 2, 3), (1, -2, 3), ]) count = tensornetwork.contractors.naive(net).get_final_node().get_tensor() self.assertEqual(count.numpy(), 6)
def test_four_variables(self): net = sat_tensornetwork.sat_count_tn([ (1, 2, 3), (1, 2, 4), ]) count = tensornetwork.contractors.naive( net).get_final_node().get_tensor() self.assertEqual(count.numpy(), 13)
def test_dual_clauses(self): net = sat_tensornetwork.sat_count_tn([ (1, 2, 3), (1, -2, 3), ]) count = tensornetwork.contractors.naive( net).get_final_node().get_tensor() self.assertEqual(count.numpy(), 6)
def test_unsatisfiable(self): net = sat_tensornetwork.sat_count_tn([ (1, 1, 1), (-1, -1, -1) ]) count = (tensornetwork.contractors.naive(net) .get_final_node() .get_tensor()) self.assertEqual(count.numpy(), 0)
def test_unsatisfiable(self): net = sat_tensornetwork.sat_count_tn([(1, 1, 1), (-1, -1, -1)]) count = ( tensornetwork.contractors.naive(net).get_final_node().get_tensor()) self.assertEqual(count.numpy(), 0)
def test_single_variable(self): net = sat_tensornetwork.sat_count_tn([ (1, 1, 1), ]) count = tensornetwork.contractors.naive(net).get_final_node().get_tensor() self.assertEqual(count.numpy(), 1)
def test_sanity_check(self): net = sat_tensornetwork.sat_count_tn([ (1, 2, 3), ]) count = tensornetwork.contractors.naive(net).get_final_node().get_tensor() self.assertEqual(count.numpy(), 7)