Exemplo n.º 1
0
def apply_embedding_greedy(bpmn_graph,
                           dfg,
                           activities_count,
                           log=None,
                           aggregated_statistics=None,
                           parameters=None):
    """
    Embed decoration information inside the BPMN graph

    Parameters
    -----------
    bpmn_graph
        BPMN graph
    dfg
        Directly-Follows graph
    activities_count
        Count of occurrences of the activities
    log
        Log object
    aggregated_statistics
        Aggregated statistics object
    parameters
        Possible parameters of the algorithm

    Returns
    -----------
    bpmn_graph
        Annotated BPMN graph
    """
    del parameters
    del log
    del aggregated_statistics

    net, initial_marking, final_marking, elements_correspondence, inv_elements_correspondence, el_corr_keys_map = \
        bpmn_to_petri.apply(bpmn_graph)

    spaths = vis_trans_shortest_paths.get_shortest_paths(net,
                                                         enable_extension=True)

    aggregated_statistics = vis_trans_shortest_paths.get_decorations_from_dfg_spaths_acticount(
        net, dfg, spaths, activities_count, variant="performance")

    bpmn_aggreg_statistics = convert_performance_map.convert_performance_map_to_bpmn(
        aggregated_statistics, inv_elements_correspondence)

    bpmn_graph = bpmn_embedding.embed_info_into_bpmn(bpmn_graph,
                                                     bpmn_aggreg_statistics,
                                                     "performance")

    return bpmn_graph
Exemplo n.º 2
0
def apply_embedding(bpmn_graph,
                    log=None,
                    aggregated_statistics=None,
                    parameters=None):
    """
    Embed decoration information inside the BPMN graph

    Parameters
    -----------
    bpmn_graph
        BPMN graph object
    log
        (Optional) log where the replay technique should be applied
    aggregated_statistics
        (Optional) element-wise statistics calculated on the Petri net
    parameters
        Possible parameters, of the algorithm

    Returns
    -----------
    bpmn_graph
        Annotated BPMN graph
    """
    if parameters is None:
        parameters = {}

    net, initial_marking, final_marking, elements_correspondence, inv_elements_correspondence, el_corr_keys_map = \
        bpmn_to_petri.apply(bpmn_graph)

    if aggregated_statistics is None and log is not None:
        aggregated_statistics = token_decoration.get_decorations(
            log,
            net,
            initial_marking,
            final_marking,
            parameters=parameters,
            measure="performance")

    if aggregated_statistics is not None:
        bpmn_aggreg_statistics = convert_performance_map.convert_performance_map_to_bpmn(
            aggregated_statistics, inv_elements_correspondence)
        bpmn_graph = bpmn_embedding.embed_info_into_bpmn(
            bpmn_graph, bpmn_aggreg_statistics, "performance")

    return bpmn_graph