Exemplo n.º 1
0
 def test_ext_marking_equation_sync_net(self):
     import pm4py
     log = pm4py.read_xes(os.path.join("input_data", "running-example.xes"))
     net, im, fm = pm4py.discover_petri_net_inductive(log)
     sync_net, sync_im, sync_fm = pm4py.construct_synchronous_product_net(log[0], net, im, fm)
     res = pm4py.solve_extended_marking_equation(log[0], sync_net, sync_im, sync_fm)
     self.assertIsNotNone(res)
Exemplo n.º 2
0
def execute_script():
    log = pm4py.read_xes(
        os.path.join("..", "tests", "input_data", "receipt.xes"))
    net, im, fm = inductive_miner.apply(
        log, variant=inductive_miner.Variants.IM_CLEAN)
    idx = 0
    # try to resolve the marking equation to find an heuristics and possible a vector of transitions
    # leading from im to fm
    sync_net, sync_im, sync_fm = pm4py.construct_synchronous_product_net(
        log[idx], net, im, fm)
    me_solver = marking_equation.build(sync_net, sync_im, sync_fm)
    h, x = me_solver.solve()
    firing_sequence, reach_fm1, explained_events = me_solver.get_firing_sequence(
        x)
    print("for trace at index " + str(idx) + ": marking equation h = ", h)
    print("x vector reaches fm = ", reach_fm1)
    print("firing sequence = ", firing_sequence)
    # it fails and the value of heuristics is low
    #
    # now let's try with extended marking equation to find the heuristics and the vector!
    eme_solver = extended_marking_equation.build(log[idx], sync_net, sync_im,
                                                 sync_fm)
    h, x = eme_solver.solve()
    # the heuristics is much better
    firing_sequence, reach_fm2, explained_events = eme_solver.get_firing_sequence(
        x)
    print(
        "for trace at index " + str(idx) + ": extended marking equation h = ",
        h)
    print("x vector reaches fm = ", reach_fm2)
    print("firing sequence = ", firing_sequence)
Exemplo n.º 3
0
 def test_mark_em_equation(self):
     log = pm4py.read_xes("input_data/running-example.xes")
     net, im, fm = pm4py.read_pnml("input_data/running-example.pnml")
     sync_net, sync_im, sync_fm = pm4py.construct_synchronous_product_net(
         log[0], net, im, fm)
     m_h = pm4py.solve_marking_equation(sync_net, sync_im, sync_fm)
     em_h = pm4py.solve_extended_marking_equation(log[0], sync_net, sync_im,
                                                  sync_fm)