Class MooreCacheOracle<I,​O>

  • Type Parameters:
    I - input symbol class
    O - output symbol class
    All Implemented Interfaces:
    LearningCache<net.automatalib.automaton.transducer.MooreMachine<?,​I,​?,​O>,​I,​net.automatalib.word.Word<O>>, LearningCache.MooreLearningCache<I,​O>, LearningCacheOracle<net.automatalib.automaton.transducer.MooreMachine<?,​I,​?,​O>,​I,​net.automatalib.word.Word<O>>, LearningCacheOracle.MooreLearningCacheOracle<I,​O>, BatchProcessor<Query<I,​net.automatalib.word.Word<O>>>, MembershipOracle<I,​net.automatalib.word.Word<O>>, MembershipOracle.MooreMembershipOracle<I,​O>, QueryAnswerer<I,​net.automatalib.word.Word<O>>, Resumable<MooreCacheOracle.MooreCacheOracleState<I,​O>>, net.automatalib.alphabet.SupportsGrowingAlphabet<I>
    Direct Known Subclasses:
    ThreadSafeMooreCacheOracle

    public class MooreCacheOracle<I,​O>
    extends Object
    implements LearningCacheOracle.MooreLearningCacheOracle<I,​O>, net.automatalib.alphabet.SupportsGrowingAlphabet<I>, Resumable<MooreCacheOracle.MooreCacheOracleState<I,​O>>
    Moore cache. This cache is implemented as a membership oracle: upon construction, it is provided with a delegate oracle. Queries that can be answered from the cache are answered directly, others are forwarded to the delegate oracle. When the delegate oracle has finished processing these remaining queries, the results are incorporated into the cache.

    This oracle additionally enables the user to define a Moore-style prefix-closure filter: a Mapping from output symbols to output symbols may be provided, with the following semantics: If in an output word a symbol for which the given mapping has a non-null value is encountered, all symbols after this symbol are replaced by the respective value. The rationale behind this is that the concrete error message (key in the mapping) is still reflected in the learned model, it is forced to result in a sink state with only a single repeating output symbol (value in the mapping).

    Note: this implementation is not thread-safe. If you require a cache that is usable in a parallel environment. use the ThreadSafeMooreCacheOracle (or rather the ThreadSafeMooreCaches factory) from the learnlib-parallelism artifact.

    • Method Detail

      • createCacheConsistencyTest

        public EquivalenceOracle.MooreEquivalenceOracle<I,​O> createCacheConsistencyTest()
        Description copied from interface: LearningCache
        Creates a cache consistency test. A cache consistency test is an equivalence oracle which checks a given hypothesis against the current contents of the cache. Hence, no queries are posed to the underlying system.

        The created cache consistency test is backed by the cache contents. This method does not need to be invoked repeatedly when the cache contents change.

        Specified by:
        createCacheConsistencyTest in interface LearningCache<net.automatalib.automaton.transducer.MooreMachine<?,​I,​?,​O>,​I,​net.automatalib.word.Word<O>>
        Returns:
        a cache consistency test for the contents of this cache
      • processQueries

        public void processQueries​(Collection<? extends Query<I,​net.automatalib.word.Word<O>>> queries)
        Description copied from interface: MembershipOracle
        Processes the specified collection of queries. When this method returns, each of the contained queries Query.answer(Object) method should have been called with an argument reflecting the SUL response to the respective query.
        Specified by:
        processQueries in interface MembershipOracle<I,​O>
        Parameters:
        queries - the queries to process
        See Also:
        Query.answer(Object)
      • addAlphabetSymbol

        public void addAlphabetSymbol​(I symbol)
        Specified by:
        addAlphabetSymbol in interface net.automatalib.alphabet.SupportsGrowingAlphabet<I>