Class MealyDHC<I,O>
- java.lang.Object
-
- de.learnlib.algorithm.dhc.mealy.MealyDHC<I,O>
-
- All Implemented Interfaces:
AccessSequenceTransformer<I>
,GlobalSuffixLearner<MealyMachine<?,I,?,O>,I,Word<O>>
,GlobalSuffixLearner.GlobalSuffixLearnerMealy<I,O>
,LearningAlgorithm<MealyMachine<?,I,?,O>,I,Word<O>>
,LearningAlgorithm.MealyLearner<I,O>
,Resumable<MealyDHCState<I,O>>
,SupportsGrowingAlphabet<I>
public class MealyDHC<I,O> extends Object implements LearningAlgorithm.MealyLearner<I,O>, AccessSequenceTransformer<I>, GlobalSuffixLearner.GlobalSuffixLearnerMealy<I,O>, SupportsGrowingAlphabet<I>, Resumable<MealyDHCState<I,O>>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface de.learnlib.algorithm.GlobalSuffixLearner
GlobalSuffixLearner.GlobalSuffixLearnerDFA<I>, GlobalSuffixLearner.GlobalSuffixLearnerMealy<I,O>
-
Nested classes/interfaces inherited from interface de.learnlib.algorithm.LearningAlgorithm
LearningAlgorithm.DFALearner<I>, LearningAlgorithm.MealyLearner<I,O>, LearningAlgorithm.MooreLearner<I,O>, LearningAlgorithm.NFALearner<I>
-
-
Constructor Summary
Constructors Constructor Description MealyDHC(Alphabet<I> alphabet, MembershipOracle<I,Word<O>> oracle)
Constructor, provided for backwards compatibility reasons.MealyDHC(Alphabet<I> alphabet, MembershipOracle<I,Word<O>> oracle, GlobalSuffixFinder<? super I,? super Word<O>> suffixFinder, Collection<? extends Word<I>> initialSplitters)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAlphabetSymbol(I symbol)
boolean
addGlobalSuffixes(Collection<? extends Word<I>> newGlobalSuffixes)
Add the provided suffixes to the collection of global suffixes.protected boolean
addSuffixesUnchecked(Collection<? extends Word<I>> newSuffixes)
Collection<Word<I>>
getGlobalSuffixes()
Retrieves the global suffixes of this learner.CompactMealy<I,O>
getHypothesisModel()
Returns the current hypothesis model.boolean
refineHypothesis(DefaultQuery<I,Word<O>> ceQuery)
Triggers a refinement of the model by providing a counterexample.void
resume(MealyDHCState<I,O> state)
Resume the datastructure from a previously suspended point in time.void
startLearning()
Starts the model inference process, creating an initial hypothesis in the provided model object.MealyDHCState<I,O>
suspend()
Expose the state object.Word<I>
transformAccessSequence(Word<I> word)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.learnlib.AccessSequenceTransformer
isAccessSequence, longestASPrefix
-
-
-
-
Constructor Detail
-
MealyDHC
public MealyDHC(Alphabet<I> alphabet, MembershipOracle<I,Word<O>> oracle)
Constructor, provided for backwards compatibility reasons.- Parameters:
alphabet
- the learning alphabetoracle
- the learning membership oracle
-
MealyDHC
public MealyDHC(Alphabet<I> alphabet, MembershipOracle<I,Word<O>> oracle, GlobalSuffixFinder<? super I,? super Word<O>> suffixFinder, Collection<? extends Word<I>> initialSplitters)
Constructor.- Parameters:
alphabet
- the learning alphabetoracle
- the learning membership oraclesuffixFinder
- thesuffix finder
to use for analyzing counterexamplesinitialSplitters
- the initial set of splitters,null
or an empty collection will result in the set of splitters being initialized as the set of alphabet symbols (interpreted asWord
s)
-
-
Method Detail
-
getGlobalSuffixes
public Collection<Word<I>> getGlobalSuffixes()
Description copied from interface:GlobalSuffixLearner
Retrieves the global suffixes of this learner. Calling this method beforeLearningAlgorithm.startLearning()
should return an empty collection.The return value should not be modified; attempting to do so may result in an
UnsupportedOperationException
. It is the implementation's responsibility to ensure attempted modifications do not corrupt the learner's internal state.- Specified by:
getGlobalSuffixes
in interfaceGlobalSuffixLearner<MealyMachine<?,I,?,O>,I,Word<O>>
- Returns:
- the global suffixes used by this algorithm
-
addGlobalSuffixes
public boolean addGlobalSuffixes(Collection<? extends Word<I>> newGlobalSuffixes)
Description copied from interface:GlobalSuffixLearner
Add the provided suffixes to the collection of global suffixes. As this method is designed to possibly trigger a refinement, it is illegal to invoke it beforeLearningAlgorithm.startLearning()
has been called.The implementation may choose to (but is not required to) omit suffixes which are already present (that is, manage the global suffixes as a proper set).
- Specified by:
addGlobalSuffixes
in interfaceGlobalSuffixLearner<MealyMachine<?,I,?,O>,I,Word<O>>
- Parameters:
newGlobalSuffixes
- the global suffixes to add- Returns:
true
if a refinement was triggered by adding the global suffixes,false otherwise
.
-
addSuffixesUnchecked
protected boolean addSuffixesUnchecked(Collection<? extends Word<I>> newSuffixes)
-
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 interfaceLearningAlgorithm<MealyMachine<?,I,?,O>,I,Word<O>>
-
refineHypothesis
public boolean refineHypothesis(DefaultQuery<I,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 ofLearningAlgorithm.startLearning()
should be illegal.- Specified by:
refineHypothesis
in interfaceLearningAlgorithm<MealyMachine<?,I,?,O>,I,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 CompactMealy<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 may not be modified (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 interfaceLearningAlgorithm<MealyMachine<?,I,?,O>,I,Word<O>>
- Returns:
- the current hypothesis model.
-
addAlphabetSymbol
public void addAlphabetSymbol(I symbol)
- Specified by:
addAlphabetSymbol
in interfaceSupportsGrowingAlphabet<I>
-
suspend
public MealyDHCState<I,O> suspend()
Description copied from interface:Resumable
Expose the state object.
-
resume
public void resume(MealyDHCState<I,O> state)
Description copied from interface:Resumable
Resume the datastructure from a previously suspended point in time.
-
transformAccessSequence
public Word<I> transformAccessSequence(Word<I> word)
- Specified by:
transformAccessSequence
in interfaceAccessSequenceTransformer<I>
-
-