Skip to content

Commit bb5a167

Browse files
authored
Merge pull request #89 from chengw97/master
[Feat] New param: max number of tests
2 parents 7052500 + b1e2b7c commit bb5a167

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

aalpy/oracles/StatePrefixEqOracle.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class StatePrefixEqOracle(Oracle):
1212
rand_walk_len exactly walk_per_state times during learning. Therefore excessive testing of initial states is
1313
avoided.
1414
"""
15-
def __init__(self, alphabet: list, sul: SUL, walks_per_state=10, walk_len=12, depth_first=False):
15+
def __init__(self, alphabet: list, sul: SUL, walks_per_state=10, walk_len=12, max_tests=None, depth_first=True):
1616
"""
1717
Args:
1818
@@ -24,17 +24,22 @@ def __init__(self, alphabet: list, sul: SUL, walks_per_state=10, walk_len=12, de
2424
2525
walk_len:length of random walk
2626
27-
depth_first:first explore newest states
27+
max_tests:number of maximum tests. If set to None, this parameter will be ignored.
28+
29+
depth_first:first explore the newest states
2830
"""
2931

3032
super().__init__(alphabet, sul)
3133
self.walks_per_state = walks_per_state
3234
self.steps_per_walk = walk_len
3335
self.depth_first = depth_first
36+
self.max_tests = max_tests
3437

3538
self.freq_dict = dict()
3639

3740
def find_cex(self, hypothesis):
41+
if self.max_tests and self.num_queries == self.max_tests:
42+
return None
3843

3944
states_to_cover = []
4045
for state in hypothesis.states:

0 commit comments

Comments
 (0)