Beispiel #1
0
def get_map_exponential_from_aggstatistics(agg_statistics, parameters=None):
    """
    Get transition stochastic distribution map (exponential variable forced) given the log and the Petri net

    Parameters
    -----------
    agg_statistics
        Aggregated statistics calculated on the DFG graph and the Petri net
    parameters
        Parameters of the algorithm

    Returns
    -----------
    stochastic_map
        Map that to each transition associates a random variable
    """
    stochastic_map = {}

    if parameters is None:
        parameters = {}
    del parameters

    for el in agg_statistics:
        if type(el) is PetriNet.Transition:
            rand = RandomVariable()
            rand.random_variable = Exponential()
            rand.random_variable.scale = agg_statistics[el]["performance"]

            stochastic_map[el] = rand

    return stochastic_map
#saving possible traces in a dictionary
possible_traces = {}
possible_traces[0] = ['a', 'b', 'e']
possible_traces[1] = ['a', 'b', 'd', 'e']
possible_traces[2] = ['a', 'd', 'b', 'e']
possible_traces[3] = ['a', 'c', 'e']
possible_traces[4] = ['a', 'c', 'd', 'e']
possible_traces[5] = ['a', 'd', 'c', 'e']

#creating stochastic map assigning probabilities to transitions
smap = {}
for t in transitions:
    rand = RandomVariable()
    #we do not use the uniform distribution, but we need some kind of distribution to initialize
    #the random_variable of the RandomVariable() object, so that we can call set_weight and get_weight later
    rand.random_variable = Uniform()
    smap[t] = rand
    if t.label == "b":
        rand.set_weight(0.9)
    elif t.label == "c":
        rand.set_weight(0.1)
    elif t.label == "d":
        rand.set_weight(0.2)
    elif t.label == None:
        rand.set_weight(0.8)
    else:
        rand.set_weight(1)


simulated_log2 = simulator.apply(
    net,