Package de.learnlib.filter.cache.mealy
Class AdaptiveQueryCache<I,O>
- java.lang.Object
-
- de.learnlib.filter.cache.mealy.AdaptiveQueryCache<I,O>
-
- Type Parameters:
I- input symbol typeO- output symbol type
- All Implemented Interfaces:
LearningCache<net.automatalib.automaton.transducer.MealyMachine<?,I,?,O>,I,net.automatalib.word.Word<O>>,AdaptiveMembershipOracle<I,O>,BatchProcessor<AdaptiveQuery<I,O>>,Resumable<AdaptiveQueryCache.AdaptiveQueryCacheState<I,O>>,net.automatalib.alphabet.SupportsGrowingAlphabet<I>
public class AdaptiveQueryCache<I,O> extends Object implements AdaptiveMembershipOracle<I,O>, LearningCache<net.automatalib.automaton.transducer.MealyMachine<?,I,?,O>,I,net.automatalib.word.Word<O>>, net.automatalib.alphabet.SupportsGrowingAlphabet<I>, Resumable<AdaptiveQueryCache.AdaptiveQueryCacheState<I,O>>
A cache for anAdaptiveMembershipOracle. 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. Queried symbols that have to be delegated are incorporated into the cache directly.Internally, an incrementally growing tree (in form of a mealy automaton) is used for caching.
Note that due to the step-wise processing of
adaptive queries, duplicates within a singlebatchcannot be cached. If you want to maximize cache efficiency, you would have to give up on potential parallelization and pose queries one by one.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAdaptiveQueryCache.AdaptiveQueryCacheState<I,O>-
Nested classes/interfaces inherited from interface de.learnlib.filter.cache.LearningCache
LearningCache.DFALearningCache<I>, LearningCache.MealyLearningCache<I,O>, LearningCache.MooreLearningCache<I,O>
-
-
Constructor Summary
Constructors Constructor Description AdaptiveQueryCache(AdaptiveMembershipOracle<I,O> delegate, net.automatalib.alphabet.Alphabet<I> alphabet)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAlphabetSymbol(I symbol)EquivalenceOracle<net.automatalib.automaton.transducer.MealyMachine<?,I,?,O>,I,net.automatalib.word.Word<O>>createCacheConsistencyTest()Creates a cache consistency test.net.automatalib.automaton.transducer.MealyMachine<Integer,I,?,O>getCache()Returns a (structural) view of the cache in form of aMealyMachine.IntegergetInit()Returns the initial state of the structural view of the cache.Integerinsert(Integer state, net.automatalib.word.Word<I> input, net.automatalib.word.Word<O> output)Inserts the given trace of input symbols at the given cache state and associates the trace of given output symbols with it.Integerinsert(net.automatalib.word.Word<I> input, net.automatalib.word.Word<O> output)Inserts the given trace of input symbols and associates the trace of given output symbols with it.voidprocessQueries(Collection<? extends AdaptiveQuery<I,O>> queries)voidresume(AdaptiveQueryCache.AdaptiveQueryCacheState<I,O> state)AdaptiveQueryCache.AdaptiveQueryCacheState<I,O>suspend()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.learnlib.oracle.AdaptiveMembershipOracle
processBatch, processQuery
-
-
-
-
Constructor Detail
-
AdaptiveQueryCache
public AdaptiveQueryCache(AdaptiveMembershipOracle<I,O> delegate, net.automatalib.alphabet.Alphabet<I> alphabet)
-
-
Method Detail
-
processQueries
public void processQueries(Collection<? extends AdaptiveQuery<I,O>> queries)
- Specified by:
processQueriesin interfaceAdaptiveMembershipOracle<I,O>
-
createCacheConsistencyTest
public EquivalenceOracle<net.automatalib.automaton.transducer.MealyMachine<?,I,?,O>,I,net.automatalib.word.Word<O>> createCacheConsistencyTest()
Description copied from interface:LearningCacheCreates 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:
createCacheConsistencyTestin interfaceLearningCache<net.automatalib.automaton.transducer.MealyMachine<?,I,?,O>,I,net.automatalib.word.Word<O>>- Returns:
- a cache consistency test for the contents of this cache
-
suspend
public AdaptiveQueryCache.AdaptiveQueryCacheState<I,O> suspend()
-
resume
public void resume(AdaptiveQueryCache.AdaptiveQueryCacheState<I,O> state)
-
addAlphabetSymbol
public void addAlphabetSymbol(I symbol)
- Specified by:
addAlphabetSymbolin interfacenet.automatalib.alphabet.SupportsGrowingAlphabet<I>
-
getCache
public net.automatalib.automaton.transducer.MealyMachine<Integer,I,?,O> getCache()
Returns a (structural) view of the cache in form of aMealyMachine.- Returns:
- a view of the cache
-
getInit
public Integer getInit()
Returns the initial state of the structural view of the cache.- Returns:
- the initial state of the cache
- See Also:
getCache()
-
insert
public Integer insert(net.automatalib.word.Word<I> input, net.automatalib.word.Word<O> output)
Inserts the given trace of input symbols and associates the trace of given output symbols with it.- Parameters:
input- the sequence of input symbolsoutput- the sequence of output symbols- Returns:
- the identifier of the state reached by the input sequence
-
insert
public Integer insert(Integer state, net.automatalib.word.Word<I> input, net.automatalib.word.Word<O> output)
Inserts the given trace of input symbols at the given cache state and associates the trace of given output symbols with it.- Parameters:
state- the (cache) state at which the traces should be insertedinput- the sequence of input symbolsoutput- the sequence of output symbols- Returns:
- the identifier of the state reached by the input sequence
-
-