diff options
author | Birte Kristina Friesel <birte.friesel@uos.de> | 2025-05-22 11:29:15 +0200 |
---|---|---|
committer | Birte Kristina Friesel <birte.friesel@uos.de> | 2025-05-22 11:29:15 +0200 |
commit | aca042bf6ac5cd8410b108e4397ae4c10ff67427 (patch) | |
tree | 1363e05ababafa9179e4b5bd0a10eaddd47f8d77 /lib/functions.py | |
parent | 1d4950905fa13fd3aacbd22ed24ce880b2292faa (diff) |
Featured Automata learner: now with actual guards. whoop whoop!
Diffstat (limited to 'lib/functions.py')
-rw-r--r-- | lib/functions.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/functions.py b/lib/functions.py index 187e6ff..35b04ef 100644 --- a/lib/functions.py +++ b/lib/functions.py @@ -466,6 +466,23 @@ class SplitFunction(ModelFunction): ) return hyper + # SplitFunction only + def flatten(self): + paths = list() + for param_value, subtree in self.child.items(): + if type(subtree) is SplitFunction: + for path, value in subtree.flatten(): + path = [(self.param_name, param_value)] + path + paths.append((path, value)) + elif type(subtree) is StaticFunction: + path = [(self.param_name, param_value)] + paths.append((path, subtree.value)) + else: + raise RuntimeError( + "flatten is only implemented for RMTs with constant leaves" + ) + return paths + @classmethod def from_json(cls, data): assert data["type"] == "split" |