def main(): real_log = import_xes("data/benchmark/GTlog-11.xes", "concept:name") model_log = generate_playout( *import_petri_net("data/benchmark/alpha-11.pnml"), "concept:name") result = Act2VecWmdConformance().execute(model_log, real_log) print(result.calc_precision()) print(result.calc_fitness())
def test_generate_playout(): net, im, fm = import_petri_net(os.path.join(data, "petri_net_small.pnml")) playout = generate_playout(net, im, fm, "concept:name") assert len(playout) == 1000 max = 0 for i in playout: if len(i) > max: max = len(i) assert max == 1
def load(variant, id): if variant in ["alpha", "ilp", "ind0", "ind1", "PN"]: ext = "pnml" else: ext = "xes" path = os.path.join("data", "benchmark", "%s-%d.%s" % (variant, id, ext)) if ext == "pnml": return cc.generate_playout(*cc.import_petri_net(path), "concept:name") else: return cc.import_xes(path, "concept:name")
import os from conformance_checking import import_xes, import_petri_net, generate_playout if __name__ == "__main__": absPath = os.path.abspath(__file__) fileDir = os.path.dirname(absPath) code = os.path.dirname(fileDir) data = os.path.join(code, "data") print("Running the import_xes() Method to import an event log...") log_data = import_xes(os.path.join(data, "log_test.xes"), "concept:name") print(""" The output of the method is a List[List[str]], where the entry i,j is the j-th activity name of the i-th trace.""") print("Output: ", log_data) print("Running the import_petri_net() Method to import a petri net...") net, im, fm = import_petri_net(os.path.join(data, "petri_net_small.pnml")) print("Aquired a petri net, an initial marking and a final marking.") print( "Running the generate_playout() Method to generate a playout of the petri net..." ) playout = generate_playout(net, im, fm, "concept:name") print("""The output of the method is a List[List[str]], where the entry i,j is the j-th activity name of the i-th trace.""") print("Output (only first 10): ", playout[:10])
def test_import_petri_net(): net, im, fm = import_petri_net(os.path.join(data, "petri_net_small.pnml")) assert str(im) == "['source:1']" assert str(fm) == "['sink:1']"