Пример #1
0
def apply(net, initial_marking, final_marking, log=None, aggregated_statistics=None, parameters=None):
    """
    Apply method for Petri net visualization (it calls the graphviz_visualization
    method) adding performance representation obtained by token replay

    Parameters
    -----------
    net
        Petri net
    initial_marking
        Initial marking
    final_marking
        Final marking
    log
        (Optional) log
    aggregated_statistics
        Dictionary containing the frequency statistics
    parameters
        Algorithm parameters (including the activity key used during the replay, and the timestamp key)

    Returns
    -----------
    viz
        Graph object
    """
    if aggregated_statistics is None:
        if log is not None:
            aggregated_statistics = get_decorations(log, net, initial_marking, final_marking, parameters=parameters,
                                                    measure="performance")
    return visualize.apply(net, initial_marking, final_marking, parameters=parameters,
                           decorations=aggregated_statistics)
Пример #2
0
def apply(
    net: PetriNet,
    initial_marking: Marking,
    final_marking: Marking,
    log: EventLog = None,
    aggregated_statistics=None,
    parameters: Optional[Dict[Union[str, Parameters], Any]] = None
) -> graphviz.Digraph:
    """
    Apply method for Petri net visualization (it calls the
    graphviz_visualization method)

    Parameters
    -----------
    net
        Petri net
    initial_marking
        Initial marking
    final_marking
        Final marking
    log
        (Optional) log
    aggregated_statistics
        Dictionary containing the frequency statistics
    parameters
        Algorithm parameters

    Returns
    -----------
    viz
        Graph object
    """
    # remove unused variables
    del log
    del aggregated_statistics
    return visualize.apply(net,
                           initial_marking,
                           final_marking,
                           parameters=parameters)
Пример #3
0
def apply(net,
          initial_marking,
          final_marking,
          log=None,
          aggregated_statistics=None,
          parameters=None):
    """
    Apply method for Petri net visualization (it calls the
    graphviz_visualization method)

    Parameters
    -----------
    net
        Petri net
    initial_marking
        Initial marking
    final_marking
        Final marking
    log
        (Optional) log
    aggregated_statistics
        Dictionary containing the frequency statistics
    parameters
        Algorithm parameters

    Returns
    -----------
    viz
        Graph object
    """
    if aggregated_statistics is None and log is not None:
        aggregated_statistics = alignments_decoration.get_alignments_decoration(
            net, initial_marking, final_marking, log=log)

    return visualize.apply(net,
                           initial_marking,
                           final_marking,
                           parameters=parameters,
                           decorations=aggregated_statistics)
Пример #4
0
def get_decorated_net(net: PetriNet,
                      initial_marking: Marking,
                      final_marking: Marking,
                      log: EventLog,
                      parameters: Optional[Dict[Union[str, Parameters],
                                                Any]] = None,
                      variant: str = "frequency") -> graphviz.Digraph:
    """
    Get a decorated net according to the specified variant (decorate Petri net based on DFG)

    Parameters
    ------------
    net
        Petri net
    initial_marking
        Initial marking
    final_marking
        Final marking
    log
        Log to use to decorate the Petri net
    parameters
        Algorithm parameters
    variant
        Specify if the decoration should take into account the frequency or the performance

    Returns
    ------------
    gviz
        GraphViz object
    """
    if parameters is None:
        parameters = {}

    aggregation_measure = exec_utils.get_param_value(
        Parameters.AGGREGATION_MEASURE, parameters,
        "sum" if "frequency" in variant else "mean")

    activity_key = exec_utils.get_param_value(Parameters.ACTIVITY_KEY,
                                              parameters, xes.DEFAULT_NAME_KEY)

    # we find the DFG
    if variant == "performance":
        dfg = performance.performance(log, parameters=parameters)
    else:
        dfg = native.native(log, parameters=parameters)
    # we find shortest paths
    spaths = get_shortest_paths(net)
    # we find the number of activities occurrences in the log
    activities_count = attr_get.get_attribute_values(log,
                                                     activity_key,
                                                     parameters=parameters)
    aggregated_statistics = get_decorations_from_dfg_spaths_acticount(
        net,
        dfg,
        spaths,
        activities_count,
        variant=variant,
        aggregation_measure=aggregation_measure)

    return visualize.apply(net,
                           initial_marking,
                           final_marking,
                           parameters=parameters,
                           decorations=aggregated_statistics)