aalpy.learning_algs.non_deterministic.NonDeterministicSULWrapper

View Source
from aalpy.base import SUL
from aalpy.learning_algs.non_deterministic.TraceTree import TraceTree


class NonDeterministicSULWrapper(SUL):
    """
    Wrapper for non-deterministic SUL. After every step, input/output pair is added to the tree containing all traces.
    """

    def __init__(self, sul: SUL):
        super().__init__()
        self.sul = sul
        self.cache = TraceTree()

    def pre(self):
        self.cache.reset()
        self.sul.pre()

    def post(self):
        self.sul.post()

    def step(self, letter):
        out = self.sul.step(letter)
        self.cache.add_to_tree(letter, out)
        return out
#   class NonDeterministicSULWrapper(aalpy.base.SUL.SUL):
View Source
class NonDeterministicSULWrapper(SUL):
    """
    Wrapper for non-deterministic SUL. After every step, input/output pair is added to the tree containing all traces.
    """

    def __init__(self, sul: SUL):
        super().__init__()
        self.sul = sul
        self.cache = TraceTree()

    def pre(self):
        self.cache.reset()
        self.sul.pre()

    def post(self):
        self.sul.post()

    def step(self, letter):
        out = self.sul.step(letter)
        self.cache.add_to_tree(letter, out)
        return out

Wrapper for non-deterministic SUL. After every step, input/output pair is added to the tree containing all traces.

#   NonDeterministicSULWrapper(sul: aalpy.base.SUL.SUL)
View Source
    def __init__(self, sul: SUL):
        super().__init__()
        self.sul = sul
        self.cache = TraceTree()
#   def pre(self):
View Source
    def pre(self):
        self.cache.reset()
        self.sul.pre()

Resets the system. Called after post method in the equivalence query.

#   def post(self):
View Source
    def post(self):
        self.sul.post()

Performs additional cleanup on the system in necessary. Called before pre method in the equivalence query.

#   def step(self, letter):
View Source
    def step(self, letter):
        out = self.sul.step(letter)
        self.cache.add_to_tree(letter, out)
        return out

Executes an action on the system under learning and returns its result.

Args:

letter: Single input that is executed on the SUL.

Returns:

Output received after executing the input.
Inherited Members
aalpy.base.SUL.SUL
query