diff --git a/aalpy/oracles/kWayStateCoverageEqOracle.py b/aalpy/oracles/kWayStateCoverageEqOracle.py index e66f404c..d259e53b 100644 --- a/aalpy/oracles/kWayStateCoverageEqOracle.py +++ b/aalpy/oracles/kWayStateCoverageEqOracle.py @@ -10,7 +10,7 @@ class KWayStateCoverageEqOracle(Oracle): random walk at the end. """ - def __init__(self, alphabet: list, sul: SUL, k=2, random_walk_len=20, method='combinations'): + def __init__(self, alphabet: list, sul: SUL, k=2, random_walk_len=20, method='permutations'): """ Args: @@ -61,10 +61,23 @@ def find_cex(self, hypothesis): index = 0 path = comb[0].prefix + + # in case of non-strongly connected automata test case might not be possible as a path between 2 states + # might not exist + possible_test_case = True while index < len(comb) - 1: - path += hypothesis.get_shortest_path(comb[index], comb[index + 1]) + path_between_states = hypothesis.get_shortest_path(comb[index], comb[index + 1]) index += 1 + if not path_between_states: + possible_test_case = False + break + + path += path_between_states + + if possible_test_case is None: + continue + path += tuple(choices(self.alphabet, k=self.random_walk_len)) self.reset_hyp_and_sul(hypothesis)