Class ADTLearner<I,O>
- java.lang.Object
-
- de.learnlib.algorithm.adt.learner.ADTLearner<I,O>
-
- Type Parameters:
I
- input alphabet typeO
- output alphabet type
- All Implemented Interfaces:
PartialTransitionAnalyzer<ADTState<I,O>,I>
,LearningAlgorithm<MealyMachine<?,I,?,O>,I,Word<O>>
,LearningAlgorithm.MealyLearner<I,O>
,Resumable<ADTLearnerState<ADTState<I,O>,I,O>>
,SupportsGrowingAlphabet<I>
public class ADTLearner<I,O> extends Object implements LearningAlgorithm.MealyLearner<I,O>, PartialTransitionAnalyzer<ADTState<I,O>,I>, SupportsGrowingAlphabet<I>, Resumable<ADTLearnerState<ADTState<I,O>,I,O>>
The main learning algorithm.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface de.learnlib.algorithm.LearningAlgorithm
LearningAlgorithm.DFALearner<I>, LearningAlgorithm.MealyLearner<I,O>, LearningAlgorithm.MooreLearner<I,O>, LearningAlgorithm.NFALearner<I>
-
Nested classes/interfaces inherited from interface de.learnlib.algorithm.adt.api.PartialTransitionAnalyzer
PartialTransitionAnalyzer.HypothesisModificationException
-
-
Field Summary
-
Fields inherited from interface de.learnlib.algorithm.adt.api.PartialTransitionAnalyzer
HYPOTHESIS_MODIFICATION_EXCEPTION
-
-
Constructor Summary
Constructors Constructor Description ADTLearner(Alphabet<I> alphabet, SymbolQueryOracle<I,O> oracle, LeafSplitter leafSplitter, ADTExtender adtExtender, SubtreeReplacer subtreeReplacer)
ADTLearner(Alphabet<I> alphabet, SymbolQueryOracle<I,O> oracle, LeafSplitter leafSplitter, ADTExtender adtExtender, SubtreeReplacer subtreeReplacer, boolean useObservationTree)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAlphabetSymbol(I symbol)
void
closeTransition(ADTState<I,O> state, I input)
Determine the successor/output of the transition in question (which is usually achieved by sifting the corresponding long-prefix through the ADT).ADT<ADTState<I,O>,I,O>
getADT()
MealyMachine<?,I,?,O>
getHypothesisModel()
Returns the current hypothesis model.boolean
isTransitionDefined(ADTState<I,O> state, I input)
Check whether the transition in question is defined or not.boolean
refineHypothesis(DefaultQuery<I,Word<O>> ce)
Triggers a refinement of the model by providing a counterexample.boolean
refineHypothesisInternal(DefaultQuery<I,Word<O>> ceQuery)
void
resume(ADTLearnerState<ADTState<I,O>,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.ADTLearnerState<ADTState<I,O>,I,O>
suspend()
Expose the state object.
-
-
-
Constructor Detail
-
ADTLearner
public ADTLearner(Alphabet<I> alphabet, SymbolQueryOracle<I,O> oracle, LeafSplitter leafSplitter, ADTExtender adtExtender, SubtreeReplacer subtreeReplacer)
-
ADTLearner
public ADTLearner(Alphabet<I> alphabet, SymbolQueryOracle<I,O> oracle, LeafSplitter leafSplitter, ADTExtender adtExtender, SubtreeReplacer subtreeReplacer, boolean useObservationTree)
-
-
Method Detail
-
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>> ce)
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:
ce
- 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).
-
refineHypothesisInternal
public boolean refineHypothesisInternal(DefaultQuery<I,Word<O>> ceQuery)
-
getHypothesisModel
public 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 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.
-
closeTransition
public void closeTransition(ADTState<I,O> state, I input)
Description copied from interface:PartialTransitionAnalyzer
Determine the successor/output of the transition in question (which is usually achieved by sifting the corresponding long-prefix through the ADT).- Specified by:
closeTransition
in interfacePartialTransitionAnalyzer<I,O>
- Parameters:
state
- the (source) state of the transition in questioninput
- the input symbol of the transition in question
-
isTransitionDefined
public boolean isTransitionDefined(ADTState<I,O> state, I input)
Description copied from interface:PartialTransitionAnalyzer
Check whether the transition in question is defined or not.- Specified by:
isTransitionDefined
in interfacePartialTransitionAnalyzer<I,O>
- Parameters:
state
- the (source) state of the transition in questioninput
- the input symbol of the transition in question- Returns:
true
if the transition (and thus the successor/output) is defined,false
otherwise
-
addAlphabetSymbol
public void addAlphabetSymbol(I symbol)
- Specified by:
addAlphabetSymbol
in interfaceSupportsGrowingAlphabet<I>
-
suspend
public ADTLearnerState<ADTState<I,O>,I,O> suspend()
Description copied from interface:Resumable
Expose the state object.
-
resume
public void resume(ADTLearnerState<ADTState<I,O>,I,O> state)
Description copied from interface:Resumable
Resume the datastructure from a previously suspended point in time.
-
-