Example #1
0
    def test_cov_tree_accelerate(self):
        petri = PetriNet(4)
        mark1 = OmegaMarking(np.array([1, 3, 6, float("inf")]))
        node1 = CovNode(mark1, mark1.get_dim())
        mark2 = OmegaMarking(np.array([1, 3, 5, float("inf")]))
        node2 = CovNode(mark2, mark2.get_dim(), node1._depth, node1)

        tr = CovTree(petri, mark1)
        mark0 = OmegaMarking(np.array([0, 2, 5, 0]))
        node0 = CovNode(mark0, mark0.get_dim(), tr.get_root())
        node1.change_parent(node0)
        tr.add_node(node0)
        tr.add_node(node1)
        tr.add_node(node2)
        tr._accelerate(node2, True)
        self.assertTrue(len(tr._accelerations) == 1)
Example #2
0
    def test_cov_tree_create_insert_delete(self):
        petri = PetriNet(4)
        mark1 = OmegaMarking(np.array([1, 3, 6, float("inf")]))
        node1 = CovNode(mark1, mark1.get_dim())
        mark2 = OmegaMarking(np.array([1, 3, 5, float("inf")]))
        node2 = CovNode(mark2, mark2.get_dim(), node1._depth, node1)

        tr = CovTree(petri, mark1)
        mark0 = OmegaMarking(np.array([0, 2, 5, 0]))
        node0 = CovNode(mark0, mark0.get_dim(), tr.get_root())
        node1.change_parent(node0)
        tr.add_node(node0)
        tr.add_node(node1)
        tr.add_node(node2)
        #         print(node2.GetMark()._marking)
        self.assertEqual(len(tr.get_vertices()), 4)
        tr.delete_node(node2)
        self.assertEqual(len(tr.get_vertices()), 3)
        tr.delete_node(node0)
        self.assertEqual(len(tr.get_vertices()), 1)