Showing
1 changed file
with
10 additions
and
10 deletions
... | @@ -34,15 +34,15 @@ class CTL_model_checker(object): | ... | @@ -34,15 +34,15 @@ class CTL_model_checker(object): |
34 | - universe is a sdd representing the state space (for example v.g.reachable) | 34 | - universe is a sdd representing the state space (for example v.g.reachable) |
35 | - pred is a shom representing the precedence relation (inverse of the transition relation) | 35 | - pred is a shom representing the precedence relation (inverse of the transition relation) |
36 | """ | 36 | """ |
37 | - # TODO : mettre en cache les output de phi2sdd ? | 37 | + |
38 | assert isinstance(universe, sdd), "universe must be of type sdd" | 38 | assert isinstance(universe, sdd), "universe must be of type sdd" |
39 | assert isinstance(pred, shom), "pred must be of type shom" | 39 | assert isinstance(pred, shom), "pred must be of type shom" |
40 | 40 | ||
41 | self.logic = "CTL" | 41 | self.logic = "CTL" |
42 | 42 | ||
43 | if universe: | 43 | if universe: |
44 | - self.variables = next(iter(universe))[0].vars() # c'est tres sale mais je trouve pas d'autre solution pour l'instant | 44 | + self.variables = next(iter(universe))[0].vars() # ugly, should be changed if sdd are fully used |
45 | - else: | 45 | + else: # the universe is empty when checking when checking a fairness assumption that no path satisfy |
46 | self.variables = [] | 46 | self.variables = [] |
47 | 47 | ||
48 | self.CTL_True = universe | 48 | self.CTL_True = universe |
... | @@ -72,7 +72,7 @@ class CTL_model_checker(object): | ... | @@ -72,7 +72,7 @@ class CTL_model_checker(object): |
72 | self.binarymod = {"EU" : self.EU, "ER" : self.ER, "EW" : self.EW, "EM" : self.EM, "AU" : self.AU, "AR" : self.AR, "AW" : self.AW, "AM" : self.AM} | 72 | self.binarymod = {"EU" : self.EU, "ER" : self.ER, "EW" : self.EW, "EM" : self.EM, "AU" : self.AU, "AR" : self.AR, "AW" : self.AW, "AM" : self.AM} |
73 | 73 | ||
74 | @lru_cache(maxsize=None) # si la version de python etait 3.9 on pourrait utiliser functools.cache directement | 74 | @lru_cache(maxsize=None) # si la version de python etait 3.9 on pourrait utiliser functools.cache directement |
75 | - def atom(self, var): | 75 | + def _atom(self, var): |
76 | """ | 76 | """ |
77 | Input: | 77 | Input: |
78 | - var: string | 78 | - var: string |
... | @@ -99,7 +99,7 @@ class CTL_model_checker(object): | ... | @@ -99,7 +99,7 @@ class CTL_model_checker(object): |
99 | else: | 99 | else: |
100 | return self.CTL_False | 100 | return self.CTL_False |
101 | elif phi.kind == 'name': | 101 | elif phi.kind == 'name': |
102 | - return self.atom(phi.value) | 102 | + return self._atom(phi.value) |
103 | elif phi.kind == 'not': | 103 | elif phi.kind == 'not': |
104 | return self.neg(self._phi2sdd(phi.children[0])) | 104 | return self.neg(self._phi2sdd(phi.children[0])) |
105 | elif phi.kind == 'and': | 105 | elif phi.kind == 'and': |
... | @@ -140,19 +140,19 @@ class ARCTL_model_checker(CTL_model_checker): | ... | @@ -140,19 +140,19 @@ class ARCTL_model_checker(CTL_model_checker): |
140 | """ | 140 | """ |
141 | Input: | 141 | Input: |
142 | - universe is a sdd representing the state space (for example v.g.reachable) | 142 | - universe is a sdd representing the state space (for example v.g.reachable) |
143 | - - actions is a list of tuples associating shoms and vectors of label strings | 143 | + - actions is a list of tuples associating shoms and lists of label strings |
144 | - tau_label is the label representing invisible actions, or '_None' if no invisible actions | 144 | - tau_label is the label representing invisible actions, or '_None' if no invisible actions |
145 | """ | 145 | """ |
146 | assert isinstance(actions, list), "actions must be of type dict" | 146 | assert isinstance(actions, list), "actions must be of type dict" |
147 | assert len(actions) >= 1, "actions must contain at least one element" | 147 | assert len(actions) >= 1, "actions must contain at least one element" |
148 | self.actions = actions | 148 | self.actions = actions |
149 | self.action_labels = set() | 149 | self.action_labels = set() |
150 | - for action, labels in self.actions: # for each key of the dictionnary | 150 | + for action, labels in self.actions: |
151 | - assert isinstance(action, shom), "every key of actions must be of type shom" | 151 | + assert isinstance(action, shom), "the first part of every action must be of type shom" |
152 | for l in labels: | 152 | for l in labels: |
153 | - assert isinstance(l, str), "every value of actions must be of type str" | 153 | + assert isinstance(l, str), "the second part of every action must be a list of str" |
154 | self.action_labels.add(l) | 154 | self.action_labels.add(l) |
155 | - self.alpha_labels = list(self.alpha_labels) | 155 | + self.action_labels = list(self.action_labels) |
156 | if tau_label in self.action_labels: | 156 | if tau_label in self.action_labels: |
157 | self.tau_label = tau_label | 157 | self.tau_label = tau_label |
158 | else: | 158 | else: | ... | ... |
-
Please register or login to post a comment