コード例 #1
0
def execute_script():
    log = xes_importer.apply(
        os.path.join("..", "tests", "input_data", "running-example.xes"))
    tree = inductive_miner.apply_tree(log)
    new_log_1 = tree_playout.apply(tree)
    print(len(new_log_1))
    new_tree_1 = inductive_miner.apply_tree(new_log_1)
    print(new_tree_1)
    new_log_2 = tree_playout.apply(tree,
                                   variant=tree_playout.Variants.EXTENSIVE)
    print(len(new_log_2))
    new_tree_2 = inductive_miner.apply_tree(new_log_2)
    print(new_tree_2)
コード例 #2
0
def execute_script():
    # read an event log
    log = pm4py.read_xes("../tests/compressed_input_data/02_teleclaims.xes.gz")
    # log = pm4py.read_xes("../tests/input_data/receipt.xes")
    print("number of variants of the original log ->", len(pm4py.get_variants(log)))
    # discover a process model
    tree = pm4py.discover_tree_inductive(log)
    # simulate a log out of the model (to have another log that is similar to the original)
    aa = time.time()
    min_trace_length = bottomup_discovery.get_min_trace_length(tree)
    simulated_log = tree_playout.apply(tree, variant=tree_playout.Variants.EXTENSIVE,
                                       parameters={"max_trace_length": min_trace_length + 2})
    print("number of variants of the simulated log -> ", len(simulated_log))
    # apply the alignments between this log and the model
    bb = time.time()
    aligned_traces = logs_alignment.apply(log, simulated_log)
    cc = time.time()
    print(aligned_traces[0])
    print("playout time", bb - aa)
    print("alignments time", cc - bb)
    print("TOTAL", cc - aa)
    print(alignment_based.evaluate(aligned_traces))
    # apply the anti alignments between this log and the model
    dd = time.time()
    anti_aligned_traces = logs_alignment.apply(log, simulated_log,
                                               parameters={
                                                   logs_alignment.Variants.EDIT_DISTANCE.value.Parameters.PERFORM_ANTI_ALIGNMENT: True})
    ee = time.time()
    print(anti_aligned_traces[0])
    print("anti alignments time", ee - dd)
    print(alignment_based.evaluate(anti_aligned_traces))
コード例 #3
0
ファイル: other_tests.py プロジェクト: yoannlgd1/pm4py-core
 def test_playout_tree_basic(self):
     log = xes_importer.apply(
         os.path.join("input_data", "running-example.xes"))
     from pm4py.algo.discovery.inductive import algorithm as inductive_miner
     tree = inductive_miner.apply_tree(log)
     from pm4py.simulation.tree_playout import algorithm as tree_playout
     new_log = tree_playout.apply(tree)
コード例 #4
0
ファイル: sim.py プロジェクト: kfly89/pm4py-core
def play_out(*args: Union[Tuple[PetriNet, Marking, Marking], dict, Counter,
                          ProcessTree], **kwargs) -> EventLog:
    """
    Performs the playout of the provided model,
    i.e., gets a set of traces from the model.
    The function either takes a petri net, initial and final marking, or, a process tree as an input.

    Parameters
    ---------------
    args
        Model (Petri net, initial, final marking) or ProcessTree
    kwargs
        Parameters of the playout

    Returns
    --------------
    log
        Simulated event log
    """
    if len(args) == 3:
        from pm4py.objects.petri.petrinet import PetriNet
        if type(args[0]) is PetriNet:
            from pm4py.simulation.playout import simulator
            return simulator.apply(args[0],
                                   args[1],
                                   final_marking=args[2],
                                   **kwargs)
        elif type(args[0]) is dict or type(args[0]) is Counter:
            from pm4py.objects.dfg.utils import dfg_playout
            return dfg_playout.apply(args[0], args[1], args[2], **kwargs)
    elif len(args) == 1:
        from pm4py.objects.process_tree.process_tree import ProcessTree
        if type(args[0]) is ProcessTree:
            from pm4py.simulation.tree_playout import algorithm
            return algorithm.apply(args[0], **kwargs)
    raise Exception("unsupported model for playout")