diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2021-02-18 12:07:52 +0100 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2021-02-18 12:07:52 +0100 |
commit | c68c4a2bc617dd1356d5d0d2c3ee0ff9754261ab (patch) | |
tree | 20446fcd7ed1f8f4a88d112ef5f8573debf0ccd6 /lib/utils.py | |
parent | 45310b5f95dba00b1b6e2191309961c98ba9980c (diff) |
refactor model generation from Analytic/PTAModel into ModelAttribute class
Iteration over states/transitions and model attributes is no longer hardcoded
into most model generation code. This should make support for decision trees
and sub-states much easier.
Diffstat (limited to 'lib/utils.py')
-rw-r--r-- | lib/utils.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/utils.py b/lib/utils.py index 560ab79..b38a359 100644 --- a/lib/utils.py +++ b/lib/utils.py @@ -173,6 +173,16 @@ def match_parameter_values(input_param: dict, match_param: dict): return True +def partition_by_param(data, param_values): + ret = dict() + for i, parameters in enumerate(param_values): + param_key = tuple(parameters) + if param_key not in ret: + ret[param_key] = list() + ret[param_key].append(data[i]) + return ret + + def by_name_to_by_param(by_name: dict): """ Convert aggregation by name to aggregation by name and parameter values. |