summaryrefslogtreecommitdiff
path: root/lib/automata.py
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2019-09-02 15:51:13 +0200
committerDaniel Friesel <daniel.friesel@uos.de>2019-09-02 15:51:13 +0200
commitbcd014c15b5d9e68f3764a8ae09fa5f20a22dfe8 (patch)
tree5cc7317078a2fea918254f45cb597236000081e1 /lib/automata.py
parent2932819d909fba5d52dba2549889f05aa979aaa8 (diff)
Add basic auto-generated energy accounting code for online model eval
Diffstat (limited to 'lib/automata.py')
-rwxr-xr-xlib/automata.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/automata.py b/lib/automata.py
index d26c0bc..4cd694d 100755
--- a/lib/automata.py
+++ b/lib/automata.py
@@ -522,6 +522,14 @@ class PTA:
"""Return PTA-specific ID of transition."""
return self.transitions.index(transition)
+ def get_state_names(self):
+ """Return lexically sorted list of PTA state names."""
+ return sorted(self.state.keys())
+
+ def get_state_id(self, state: State) -> int:
+ """Return PTA-specific ID of state."""
+ return self.get_state_names().index(state.name)
+
def get_initial_param_dict(self):
return dict([[self.parameters[i], self.initial_param_values[i]] for i in range(len(self.parameters))])