Module de.learnlib.algorithm.ttt
Package de.learnlib.algorithm.ttt.base
Class AbstractTTTLearner<A,I,D>
java.lang.Object
de.learnlib.algorithm.ttt.base.AbstractTTTLearner<A,I,D>
- Type Parameters:
A- hypothesis automaton typeI- input symbol typeD- output domain type
- All Implemented Interfaces:
AccessSequenceTransformer<I>,LearningAlgorithm<A,,I, D> LearnerStateTracker,Resumable<TTTLearnerState<I,,D>> SupportsGrowingAlphabet<I>
- Direct Known Subclasses:
TTTLearnerDFA,TTTLearnerMealy,TTTLearnerMoore
public abstract class AbstractTTTLearner<A,I,D>
extends Object
implements LearningAlgorithm<A,I,D>, AccessSequenceTransformer<I>, SupportsGrowingAlphabet<I>, Resumable<TTTLearnerState<I,D>>, LearnerStateTracker
The TTT learning algorithm for generic automata.
Implementation note: this learner uses the AccessSequenceTransformer interface to provide access to
the representatives of the states of the current hypothesis model.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic final classData structure for representing a splitter.Nested classes/interfaces inherited from interface de.learnlib.algorithm.LearningAlgorithm
LearningAlgorithm.DFALearner<I>, LearningAlgorithm.MealyLearner<I,O>, LearningAlgorithm.MooreLearner<I, O>, LearningAlgorithm.NFALearner<I> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AcexAnalyzerprotected final IntrusiveList<AbstractBaseDTNode<I,D>> The blocks during a split operation.protected BaseTTTDiscriminationTree<I,D> protected AbstractTTTHypothesis<?,I, D, ?> protected final IntrusiveList<TTTTransition<I,D>> Open transitions, i.e., transitions that possibly point to a non-leaf node in the discrimination tree.protected final MembershipOracle<I,D> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractTTTLearner(Alphabet<I> alphabet, MembershipOracle<I, D> oracle, AbstractTTTHypothesis<?, I, D, ?> hypothesis, BaseTTTDiscriminationTree<I, D> dtree, AcexAnalyzer analyzer) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAlphabetSymbol(I symbol) protected booleanprotected voidprotected abstract Dprotected abstract AbstractBaseDTNode<I,D> createNewNode(AbstractBaseDTNode<I, D> parent, D parentOutput) protected TTTTransition<I,D> createTransition(TTTState<I, D> state, I sym) protected voiddeclareFinal(AbstractBaseDTNode<I, D> blockRoot) protected OutInconsPrefixTransformAcex<I,D> deriveAcex(OutputInconsistency<I, D> outIncons) protected booleanChooses a block root, and finalizes the corresponding discriminator.protected OutputInconsistency<I,D> getAnySuccessor(TTTState<I, D> state, I sym) getAnyTarget(TTTTransition<I, D> trans) Retrieves the target state of a given transition.Returns the discrimination tree.AbstractTTTHypothesis<?,I, D, ?> getNonDetSuccessors(Collection<? extends TTTState<I, D>> states, I sym) booleanReturns whether the learning process has started yet.protected voidinitializeState(TTTState<I, D> state) Initializes a state.protected voidinitTransitions(TTTTransition<I, D> head, int num) A post-processing hook for transitions created bycreateTransition(TTTState, Object), e.g., afterinitializeState(TTTState)oraddAlphabetSymbol(Object).protected static <I,D> void link(AbstractBaseDTNode<I, D> dtNode, TTTState<I, D> state) Establish the connection between a node in the discrimination tree and a state of the hypothesis.makeTree(TTTTransition<I, D> trans) protected abstract DpredictSuccOutcome(TTTTransition<I, D> trans, AbstractBaseDTNode<I, D> succSeparator) booleanrefineHypothesis(DefaultQuery<I, D> ceQuery) Triggers a refinement of the model by providing a counterexample.protected booleanrefineHypothesisSingle(DefaultQuery<I, D> ceQuery) Performs a single refinement of the hypothesis, i.e., without repeated counterexample evaluation.voidresume(TTTLearnerState<I, D> state) Resume the data structure from a previously suspended point in time.voidStarts the model inference process, creating an initial hypothesis in the provided model object.protected abstract DsuccEffect(D effect) suspend()Expose the state object.transformAccessSequence(Word<I> word) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.learnlib.AccessSequenceTransformer
isAccessSequence, longestASPrefixMethods inherited from interface de.learnlib.LearnerStateTracker
requireLearningProcessNotStarted, requireLearningProcessStartedMethods inherited from interface de.learnlib.algorithm.LearningAlgorithm
getHypothesisModel
-
Field Details
-
alphabet
-
oracle
-
analyzer
-
openTransitions
Open transitions, i.e., transitions that possibly point to a non-leaf node in the discrimination tree. -
blockList
The blocks during a split operation. A block is a maximal subtree of the discrimination tree containing temporary discriminators at its root. -
hypothesis
-
dtree
-
-
Constructor Details
-
AbstractTTTLearner
protected AbstractTTTLearner(Alphabet<I> alphabet, MembershipOracle<I, D> oracle, AbstractTTTHypothesis<?, I, D, ?> hypothesis, BaseTTTDiscriminationTree<I, D> dtree, AcexAnalyzer analyzer)
-
-
Method Details
-
link
Establish the connection between a node in the discrimination tree and a state of the hypothesis.- Type Parameters:
I- input symbol typeD- output domain type- Parameters:
dtNode- the node in the discrimination treestate- the state in the hypothesis
-
startLearning
public void startLearning()Description copied from interface:LearningAlgorithmStarts the model inference process, creating an initial hypothesis in the provided model object.- Specified by:
startLearningin interfaceLearningAlgorithm<A,I, D>
-
refineHypothesis
Description copied from interface:LearningAlgorithmTriggers 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.- Specified by:
refineHypothesisin interfaceLearningAlgorithm<A,I, D> - Parameters:
ceQuery- the query which exposes diverging behavior, as posed to the real SUL (i.e. with the SULs output).- Returns:
trueif the counterexample triggered a refinement of the hypothesis,falseotherwise (i.e., it was no counterexample).
-
hasLearningProcessStarted
public boolean hasLearningProcessStarted()Description copied from interface:LearnerStateTrackerReturns whether the learning process has started yet.- Specified by:
hasLearningProcessStartedin interfaceLearnerStateTracker- Returns:
trueif the learning process has started,falseotherwise
-
initializeState
Initializes a state. Creates its outgoing transition objects, and adds them to the "open" list.- Parameters:
state- the state to initialize
-
createTransition
-
initTransitions
A post-processing hook for transitions created bycreateTransition(TTTState, Object), e.g., afterinitializeState(TTTState)oraddAlphabetSymbol(Object). This is mainly useful for transition output hypotheses that want to initialize the transition outputs in a bulk operation.- Parameters:
head- the head of (the list of) the created transitionsnum- the number of created transitions
-
refineHypothesisSingle
Performs a single refinement of the hypothesis, i.e., without repeated counterexample evaluation. The parameter and return value have the same significance as inrefineHypothesis(DefaultQuery).- Parameters:
ceQuery- the counterexample (query) to be used for refinement- Returns:
trueif the hypothesis was refined,falseotherwise
-
deriveAcex
-
succEffect
-
finalizeAny
protected boolean finalizeAny()Chooses a block root, and finalizes the corresponding discriminator.- Returns:
trueif a splittable block root was found,falseotherwise.
-
getDeterministicState
-
getNonDetSuccessors
-
getAnySuccessor
-
getAnySuccessor
-
getAnyTarget
Retrieves the target state of a given transition. This method works for both tree and non-tree transitions. If a non-tree transition points to a non-leaf node, it is updated accordingly before a result is obtained.- Parameters:
trans- the transition- Returns:
- the target state of this transition (possibly after it having been updated)
-
findOutputInconsistency
-
allNodesFinal
protected boolean allNodesFinal() -
declareFinal
-
predictSuccOutcome
protected abstract D predictSuccOutcome(TTTTransition<I, D> trans, AbstractBaseDTNode<I, D> succSeparator) -
createMap
-
computeHypothesisOutput
-
getHypothesisDS
-
closeTransitions
protected void closeTransitions() -
makeTree
-
getDiscriminationTree
Returns the discrimination tree.- Returns:
- the discrimination tree
-
transformAccessSequence
- Specified by:
transformAccessSequencein interfaceAccessSequenceTransformer<A>
-
addAlphabetSymbol
- Specified by:
addAlphabetSymbolin interfaceSupportsGrowingAlphabet<A>
-
createNewNode
protected abstract AbstractBaseDTNode<I,D> createNewNode(AbstractBaseDTNode<I, D> parent, D parentOutput) -
suspend
Description copied from interface:ResumableExpose the state object. -
resume
Description copied from interface:ResumableResume the data structure from a previously suspended point in time.
-