Class LSharpMealy<I,​O>

  • Type Parameters:
    I - input symbol type
    O - output symbol type
    All Implemented Interfaces:
    LearningAlgorithm<net.automatalib.automaton.transducer.MealyMachine<?,​I,​?,​O>,​I,​net.automatalib.word.Word<O>>, LearningAlgorithm.MealyLearner<I,​O>

    public class LSharpMealy<I,​O>
    extends Object
    implements LearningAlgorithm.MealyLearner<I,​O>
    Implementation of the L# algorithm for MealyMachines. The implementation is based on the original implementation of the authors. However, it does not support all features (such as compressed ADSs or some of the more intricate equivalence checks on observation trees).
    • Constructor Detail

      • LSharpMealy

        public LSharpMealy​(net.automatalib.alphabet.Alphabet<I> alphabet,
                           AdaptiveMembershipOracle<I,​O> oracle,
                           Rule2 rule2,
                           Rule3 rule3,
                           @Nullable net.automatalib.word.Word<I> sinkState,
                           O sinkOutput,
                           Random random)
    • Method Detail

      • processCex

        public boolean processCex​(DefaultQuery<I,​net.automatalib.word.Word<O>> cex,
                                  net.automatalib.automaton.transducer.MealyMachine<Integer,​I,​?,​O> mealy)
      • processBinarySearch

        public void processBinarySearch​(net.automatalib.word.Word<I> ceInput,
                                        net.automatalib.word.Word<O> ceOutput,
                                        net.automatalib.automaton.transducer.MealyMachine<Integer,​I,​?,​O> mealy)
      • makeObsTreeAdequate

        public void makeObsTreeAdequate()
      • promoteFrontierState

        public void promoteFrontierState()
      • treeIsAdequate

        public boolean treeIsAdequate()
      • updateFrontierAndBasis

        public void updateFrontierAndBasis()
      • buildHypothesis

        public net.automatalib.automaton.transducer.impl.CompactMealy<I,​O> buildHypothesis()
      • constructHypothesis

        public net.automatalib.automaton.transducer.impl.CompactMealy<I,​O> constructHypothesis()
      • identifyFrontierOrBasis

        public net.automatalib.common.util.Pair<net.automatalib.word.Word<I>,​Boolean> identifyFrontierOrBasis​(net.automatalib.word.Word<I> seq)
      • initObsTree

        public void initObsTree​(@Nullable List<net.automatalib.common.util.Pair<net.automatalib.word.Word<I>,​net.automatalib.word.Word<O>>> logs)
      • checkFrontierConsistency

        public void checkFrontierConsistency()
      • checkConsistency

        public @Nullable DefaultQuery<I,​net.automatalib.word.Word<O>> checkConsistency​(net.automatalib.automaton.transducer.MealyMachine<Integer,​I,​?,​O> mealy)
      • startLearning

        public void startLearning()
        Description copied from interface: LearningAlgorithm
        Starts the model inference process, creating an initial hypothesis in the provided model object. Please note that it should be illegal to invoke this method twice.
        Specified by:
        startLearning in interface LearningAlgorithm<net.automatalib.automaton.transducer.MealyMachine<?,​I,​?,​O>,​I,​net.automatalib.word.Word<O>>
      • refineHypothesis

        public boolean refineHypothesis​(DefaultQuery<I,​net.automatalib.word.Word<O>> ceQuery)
        Description copied from interface: LearningAlgorithm
        Triggers a refinement of the model by providing a counterexample. A counterexample is a query which exposes different behavior of the real SUL compared to the hypothesis. Please note that invoking this method before an initial invocation of LearningAlgorithm.startLearning() should be illegal.
        Specified by:
        refineHypothesis in interface LearningAlgorithm<net.automatalib.automaton.transducer.MealyMachine<?,​I,​?,​O>,​I,​net.automatalib.word.Word<O>>
        Parameters:
        ceQuery - the query which exposes diverging behavior, as posed to the real SUL (i.e. with the SULs output).
        Returns:
        true if the counterexample triggered a refinement of the hypothesis, false otherwise (i.e., it was no counterexample).
      • getHypothesisModel

        public net.automatalib.automaton.transducer.MealyMachine<?,​I,​?,​O> getHypothesisModel()
        Description copied from interface: LearningAlgorithm
        Returns the current hypothesis model.

        N.B.: By the contract of this interface, the model returned by this method should not be modified by external code (i.e., M generally should refer to an immutable interface), and its validity is retained only until the next invocation of LearningAlgorithm.refineHypothesis(DefaultQuery). If older hypotheses have to be maintained, a copy of the returned model must be made.

        Please note that it should be illegal to invoke this method before an initial invocation of LearningAlgorithm.startLearning().

        Specified by:
        getHypothesisModel in interface LearningAlgorithm<net.automatalib.automaton.transducer.MealyMachine<?,​I,​?,​O>,​I,​net.automatalib.word.Word<O>>
        Returns:
        the current hypothesis model.