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:
LearningAlgorithm<A,I,D>,Resumable<TTTLearnerState<I,D>>,net.automatalib.alphabet.SupportsGrowingAlphabet<I>
- Direct Known Subclasses:
TTTLearnerDFA,TTTLearnerMealy,TTTLearnerMoore
public abstract class AbstractTTTLearner<A,I,D> extends Object implements LearningAlgorithm<A,I,D>, net.automatalib.alphabet.SupportsGrowingAlphabet<I>, Resumable<TTTLearnerState<I,D>>
The TTT learning algorithm for generic automata.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractTTTLearner.BuilderDefaultsstatic classAbstractTTTLearner.Splitter<I,D>Data 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
Fields Modifier and Type Field Description protected net.automatalib.alphabet.Alphabet<I>alphabetprotected AcexAnalyzeranalyzerprotected IntrusiveList<AbstractBaseDTNode<I,D>>blockListThe blocks during a split operation.protected BaseTTTDiscriminationTree<I,D>dtreeprotected AbstractTTTHypothesis<?,I,D,?>hypothesisprotected IntrusiveList<TTTTransition<I,D>>openTransitionsOpen transitions, i.e., transitions that possibly point to a non-leaf node in the discrimination tree.protected MembershipOracle<I,D>oracle
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractTTTLearner(net.automatalib.alphabet.Alphabet<I> alphabet, MembershipOracle<I,D> oracle, AbstractTTTHypothesis<?,I,D,?> hypothesis, BaseTTTDiscriminationTree<I,D> dtree, AcexAnalyzer analyzer)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddAlphabetSymbol(I symbol)protected booleanallNodesFinal()protected voidcloseTransitions()protected abstract DcomputeHypothesisOutput(TTTState<I,D> state, net.automatalib.word.Word<I> suffix)protected <V> Map<D,V>createMap()protected 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 booleanfinalizeAny()Chooses a block root, and finalizes the corresponding discriminator.protected OutputInconsistency<I,D>findOutputInconsistency()protected TTTState<I,D>getAnySuccessor(TTTState<I,D> state, I sym)protected TTTState<I,D>getAnySuccessor(TTTState<I,D> state, Iterable<? extends I> suffix)protected TTTState<I,D>getAnyTarget(TTTTransition<I,D> trans)Retrieves the target state of a given transition.protected TTTState<I,D>getDeterministicState(TTTState<I,D> start, net.automatalib.word.Word<I> word)BaseTTTDiscriminationTree<I,D>getDiscriminationTree()Returns the discrimination tree.AbstractTTTHypothesis<?,I,D,?>getHypothesisDS()protected Set<TTTState<I,D>>getNondetSuccessors(Collection<? extends TTTState<I,D>> states, I sym)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>
voidlink(AbstractBaseDTNode<I,D> dtNode, TTTState<I,D> state)Establish the connection between a node in the discrimination tree and a state of the hypothesis.protected TTTState<I,D>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 datastructure from a previously suspended point in time.voidstartLearning()Starts the model inference process, creating an initial hypothesis in the provided model object.protected abstract DsuccEffect(D effect)TTTLearnerState<I,D>suspend()Expose the state object.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.learnlib.algorithm.LearningAlgorithm
getHypothesisModel
-
-
-
-
Field Detail
-
alphabet
protected final net.automatalib.alphabet.Alphabet<I> alphabet
-
oracle
protected final MembershipOracle<I,D> oracle
-
analyzer
protected final AcexAnalyzer analyzer
-
openTransitions
protected final IntrusiveList<TTTTransition<I,D>> openTransitions
Open transitions, i.e., transitions that possibly point to a non-leaf node in the discrimination tree.
-
blockList
protected final IntrusiveList<AbstractBaseDTNode<I,D>> blockList
The blocks during a split operation. A block is a maximal subtree of the discrimination tree containing temporary discriminators at its root.
-
hypothesis
protected AbstractTTTHypothesis<?,I,D,?> hypothesis
-
dtree
protected BaseTTTDiscriminationTree<I,D> dtree
-
-
Constructor Detail
-
AbstractTTTLearner
protected AbstractTTTLearner(net.automatalib.alphabet.Alphabet<I> alphabet, MembershipOracle<I,D> oracle, AbstractTTTHypothesis<?,I,D,?> hypothesis, BaseTTTDiscriminationTree<I,D> dtree, AcexAnalyzer analyzer)
-
-
Method Detail
-
link
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.- 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. Please note that it should be illegal to invoke this method twice.- Specified by:
startLearningin interfaceLearningAlgorithm<A,I,D>
-
refineHypothesis
public boolean refineHypothesis(DefaultQuery<I,D> ceQuery)
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. Please note that invoking this method before an initial invocation ofLearningAlgorithm.startLearning()should be illegal.- 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).
-
initializeState
protected void initializeState(TTTState<I,D> state)
Initializes a state. Creates its outgoing transition objects, and adds them to the "open" list.- Parameters:
state- the state to initialize
-
initTransitions
protected void initTransitions(TTTTransition<I,D> head, int num)
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
protected boolean refineHypothesisSingle(DefaultQuery<I,D> ceQuery)
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
protected OutInconsPrefixTransformAcex<I,D> deriveAcex(OutputInconsistency<I,D> outIncons)
-
finalizeAny
protected boolean finalizeAny()
Chooses a block root, and finalizes the corresponding discriminator.- Returns:
trueif a splittable block root was found,falseotherwise.
-
getDeterministicState
protected TTTState<I,D> getDeterministicState(TTTState<I,D> start, net.automatalib.word.Word<I> word)
-
getNondetSuccessors
protected Set<TTTState<I,D>> getNondetSuccessors(Collection<? extends TTTState<I,D>> states, I sym)
-
getAnySuccessor
protected TTTState<I,D> getAnySuccessor(TTTState<I,D> state, Iterable<? extends I> suffix)
-
getAnyTarget
protected TTTState<I,D> getAnyTarget(TTTTransition<I,D> trans)
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
protected OutputInconsistency<I,D> findOutputInconsistency()
-
allNodesFinal
protected boolean allNodesFinal()
-
declareFinal
protected void declareFinal(AbstractBaseDTNode<I,D> blockRoot)
-
predictSuccOutcome
protected abstract D predictSuccOutcome(TTTTransition<I,D> trans, AbstractBaseDTNode<I,D> succSeparator)
-
computeHypothesisOutput
protected abstract D computeHypothesisOutput(TTTState<I,D> state, net.automatalib.word.Word<I> suffix)
-
getHypothesisDS
public AbstractTTTHypothesis<?,I,D,?> getHypothesisDS()
-
closeTransitions
protected void closeTransitions()
-
getDiscriminationTree
public BaseTTTDiscriminationTree<I,D> getDiscriminationTree()
Returns the discrimination tree.- Returns:
- the discrimination tree
-
addAlphabetSymbol
public void addAlphabetSymbol(I symbol)
- Specified by:
addAlphabetSymbolin interfacenet.automatalib.alphabet.SupportsGrowingAlphabet<A>
-
createNewNode
protected abstract AbstractBaseDTNode<I,D> createNewNode(AbstractBaseDTNode<I,D> parent, D parentOutput)
-
suspend
public TTTLearnerState<I,D> suspend()
Description copied from interface:ResumableExpose the state object.
-
-