Package de.learnlib.algorithm.adt.model
Class ObservationTree<S,I,O>
- java.lang.Object
-
- de.learnlib.algorithm.adt.model.ObservationTree<S,I,O>
-
- Type Parameters:
S
- (hypothesis) state typeI
- input alphabet typeO
- output alphabet type
public class ObservationTree<S,I,O> extends Object
A class, that stores observations of the system under learning in a tree-like structure. Can be used to- Store output behavior information about the system under learning
- Query output behavior of the system under learning if it has been stored before (i.e. cache)
- Find separating words of hypothesis states based on the stored output behavior information
-
-
Constructor Summary
Constructors Constructor Description ObservationTree(Alphabet<I> alphabet)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addState(S newState, Word<I> accessSequence, O output)
Registers a new hypothesis state at the observation tree.void
addTrace(S state, ADTNode<S,I,O> adtNode)
void
addTrace(S state, Word<I> input, Word<O> output)
Store input/output information about a hypothesis state in the internal data structure.Word<I>
findSeparatingWord(S s1, S s2)
Find a separating word for two hypothesis states.Optional<Word<I>>
findSeparatingWord(S s1, S s2, Word<I> prefix)
Find a separating word for two hypothesis states, after applying given input sequence first.FastMealy<I,O>
getObservationTree()
void
initialize(Collection<S> states, Function<S,Word<I>> asFunction, Function<Word<I>,Word<O>> outputFunction)
Extended initialization method, that allows to initialize the observation tree with several hypothesis states.void
initialize(S state)
Initialize the observation tree with initial hypothesis state.Word<O>
trace(S s, Word<I> input)
Computes the output of the system under learning when applying the given input sequence in the given hypothesis state.
-
-
-
Method Detail
-
initialize
public void initialize(S state)
Initialize the observation tree with initial hypothesis state. Usually used duringLearningAlgorithm.startLearning()
- Parameters:
state
- the initial state of the hypothesis
-
initialize
public void initialize(Collection<S> states, Function<S,Word<I>> asFunction, Function<Word<I>,Word<O>> outputFunction)
Extended initialization method, that allows to initialize the observation tree with several hypothesis states.- Parameters:
states
- The hypothesis states to initialize the observation tree withasFunction
- Function to compute the access sequence of a nodeoutputFunction
- Function to compute the output of the access sequences
-
addTrace
public void addTrace(S state, Word<I> input, Word<O> output)
Store input/output information about a hypothesis state in the internal data structure.- Parameters:
state
- the hypothesis state for which information should be storedinput
- the input sequence applied when in the given stateoutput
- the observed output sequence
-
addTrace
public void addTrace(S state, ADTNode<S,I,O> adtNode)
SeeaddState(Object, Word, Object)
. Convenience method that stores all information that the traces of the givenADTNode
holds.- Parameters:
state
- the hypothesis state for which information should be storedadtNode
- theADTNode
whose traces should be stored
-
addState
public void addState(S newState, Word<I> accessSequence, O output)
Registers a new hypothesis state at the observation tree. It is expected to register states in the order of their discovery, meaning whenever a new state is added, information about all prefixes of its access sequence are already stored. Therefore, providing only the output of the last symbol of its access sequence is sufficient.- Parameters:
newState
- the hypothesis state in questionaccessSequence
- the access sequence of the hypothesis state in the system under learningoutput
- the output of the last symbol of the access sequence.
-
findSeparatingWord
public Optional<Word<I>> findSeparatingWord(S s1, S s2, Word<I> prefix)
Find a separating word for two hypothesis states, after applying given input sequence first.- Parameters:
s1
- first states2
- second stateprefix
- input sequence- Returns:
- A
Word
separating the two states reached after applying the prefix to s1 and s2.Optional.empty()
if not separating word exists.
-
findSeparatingWord
public Word<I> findSeparatingWord(S s1, S s2)
Find a separating word for two hypothesis states.- Parameters:
s1
- first states2
- second state- Returns:
- A
Word
separating the two words.null
if no such word is found.
-
trace
public Word<O> trace(S s, Word<I> input)
Computes the output of the system under learning when applying the given input sequence in the given hypothesis state. Requires the input/output behavior information to be stored before.- Parameters:
s
- the hypothesis stateinput
- the input sequence of interest- Returns:
- the previously stored output behavior of the system under learning
-
-