From f505d878c1d83d465fe46ff34dcf768177ca2fa9 Mon Sep 17 00:00:00 2001 From: xtrojak Date: Thu, 24 Jun 2021 11:24:11 +0200 Subject: [PATCH] Direct TS generating does not support to load partially precomputed TS (#14) --- Core/Model.py | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/Core/Model.py b/Core/Model.py index 8dcc3bf..9b1233a 100644 --- a/Core/Model.py +++ b/Core/Model.py @@ -341,23 +341,19 @@ def compute_bound(self): bound = max(rule.lhs.most_frequent(), rule.rhs.most_frequent()) return max(bound, Side(self.init).most_frequent()) - def generate_direct_transition_system(self, ts=None, max_time: float = np.inf, max_size: float = np.inf, bound=None): - if not ts: - ts = DirectTS() - if self.regulation: - if self.regulation.memory == 0: - ts.init = MultisetState(self.init) - elif self.regulation.memory == 1: - ts.init = OneStepMemoryState(self.init) - else: - ts.init = FullMemoryState(self.init) - else: + def generate_direct_transition_system(self, max_time: float = np.inf, max_size: float = np.inf, bound=None): + ts = DirectTS() + if self.regulation: + if self.regulation.memory == 0: ts.init = MultisetState(self.init) - ts.unprocessed = {ts.init} - ts.unique_complexes.update(set(ts.init.multiset)) + elif self.regulation.memory == 1: + ts.init = OneStepMemoryState(self.init) + else: + ts.init = FullMemoryState(self.init) else: - pass - # TODO: if a TS is given, extract all the data + ts.init = MultisetState(self.init) + ts.unprocessed = {ts.init} + ts.unique_complexes.update(set(ts.init.multiset)) for rule in self.rules: # precompute complexes for each rule