# HG changeset patch # User sybila # Date 1662743065 0 # Node ID ea5108514910e7fdb3f9e079a9bcc7f400af4ba4 planemo upload for repository https://github.com/sybila/galaxytools/tree/master/tools/ebcsgen commit d80d8e9710cba50aab3e6a1e10a527d26fc7e72b diff -r 000000000000 -r ea5108514910 ebcsgen_pctl_model_checking.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ebcsgen_pctl_model_checking.py Fri Sep 09 17:04:25 2022 +0000 @@ -0,0 +1,34 @@ +import argparse + +from eBCSgen.Analysis.PCTL import PCTL +from eBCSgen.Errors.FormulaParsingError import FormulaParsingError +from eBCSgen.Errors.InvalidInputError import InvalidInputError +from eBCSgen.Parsing.ParseBCSL import load_TS_from_json +from eBCSgen.Parsing.ParsePCTLformula import PCTLparser + + +args_parser = argparse.ArgumentParser(description='Model checking') + +args_parser._action_groups.pop() +required = args_parser.add_argument_group('required arguments') +optional = args_parser.add_argument_group('optional arguments') + +required.add_argument('--transition_file', required=True) +required.add_argument('--output', type=str, required=True) +required.add_argument('--formula', type=str, required=True) + +args = args_parser.parse_args() + +ts = load_TS_from_json(args.transition_file) + +if len(ts.params) != 0: + raise InvalidInputError("Provided transition system is parametrised - model checking cannot be executed.") + +formula = PCTLparser().parse(args.formula) +if formula.success: + result = PCTL.model_checking(ts, formula, storm_local=True) + f = open(args.output, "w") + f.write(result.decode("utf-8")) + f.close() +else: + raise FormulaParsingError(formula.data, args.formula) diff -r 000000000000 -r ea5108514910 ebcsgen_pctl_model_checking.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ebcsgen_pctl_model_checking.xml Fri Sep 09 17:04:25 2022 +0000 @@ -0,0 +1,41 @@ + + - explicit PCTL model checking of transition system + + macros.xml + + + + sybila/ebcsgen:v@TOOL_VERSION@ + + + + python3 ${__tool_directory__}/ebcsgen_pctl_model_checking.py + --transition_file '$transition_file' + --output '$output' + --formula '$formula' + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r ea5108514910 macros.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/macros.xml Fri Sep 09 17:04:25 2022 +0000 @@ -0,0 +1,17 @@ + + 2.0.3 + + + + + + + + diff -r 000000000000 -r ea5108514910 test-data/pctl_model_checking.bcsl.ts --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/pctl_model_checking.bcsl.ts Fri Sep 09 17:04:25 2022 +0000 @@ -0,0 +1,75 @@ +{ + "nodes": { + "1": "(inf, inf, inf)", + "2": "(1, 2, 0)", + "3": "(0, 1, 0)", + "4": "(0, 2, 0)", + "5": "(2, 1, 0)", + "6": "(2, 2, 0)", + "7": "(1, 1, 0)" + }, + "edges": [ + { + "s": 7, + "t": 3, + "p": 0.8 + }, + { + "s": 3, + "t": 4, + "p": 1.0 + }, + { + "s": 5, + "t": 7, + "p": 0.9855072463768116 + }, + { + "s": 1, + "t": 1, + "p": 1 + }, + { + "s": 2, + "t": 1, + "p": 0.2 + }, + { + "s": 5, + "t": 6, + "p": 0.014492753623188406 + }, + { + "s": 6, + "t": 1, + "p": 0.014492753623188406 + }, + { + "s": 6, + "t": 2, + "p": 0.9855072463768116 + }, + { + "s": 4, + "t": 1, + "p": 1.0 + }, + { + "s": 2, + "t": 4, + "p": 0.8 + }, + { + "s": 7, + "t": 2, + "p": 0.2 + } + ], + "ordering": [ + "X()::rep", + "Y()::rep", + "Z()::rep" + ], + "initial": 5, + "bound": 2 +} \ No newline at end of file