Module de.learnlib.algorithm.adt
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
- All Implemented Interfaces:
AdaptiveMembershipOracle<I,O>
,BatchProcessor<AdaptiveQuery<I,O>>
,net.automatalib.alphabet.SupportsGrowingAlphabet<I>
public class ObservationTree<S,I,O> extends Object implements AdaptiveMembershipOracle<I,O>, net.automatalib.alphabet.SupportsGrowingAlphabet<I>
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(net.automatalib.alphabet.Alphabet<I> alphabet, AdaptiveMembershipOracle<I,O> delegate, boolean useCache)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAlphabetSymbol(I i)
void
addState(S newState, net.automatalib.word.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, net.automatalib.word.Word<I> input, net.automatalib.word.Word<O> output)
Store input/output information about a hypothesis state in the internal data structure.@Nullable net.automatalib.word.Word<I>
findSeparatingWord(S s1, S s2)
Find a separating word for two hypothesis states.@Nullable net.automatalib.word.Word<I>
findSeparatingWord(S s1, S s2, net.automatalib.word.Word<I> prefix)
Find a separating word for two hypothesis states, after applying given input sequence first.void
initialize(Collection<S> states, Function<S,net.automatalib.word.Word<I>> asFunction, Function<net.automatalib.word.Word<I>,net.automatalib.word.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.void
processQueries(Collection<? extends AdaptiveQuery<I,O>> queries)
Processes the specified collection of queries.net.automatalib.word.Word<O>
trace(S s, net.automatalib.word.Word<I> input)
Computes the output of the system under learning when applying the given input sequence in the given hypothesis state.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.learnlib.oracle.AdaptiveMembershipOracle
processBatch, processQuery
-
-
-
-
Constructor Detail
-
ObservationTree
public ObservationTree(net.automatalib.alphabet.Alphabet<I> alphabet, AdaptiveMembershipOracle<I,O> delegate, boolean useCache)
-
-
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,net.automatalib.word.Word<I>> asFunction, Function<net.automatalib.word.Word<I>,net.automatalib.word.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, net.automatalib.word.Word<I> input, net.automatalib.word.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, net.automatalib.word.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 @Nullable net.automatalib.word.Word<I> findSeparatingWord(S s1, S s2, net.automatalib.word.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, ornull
if no separating word exists.
-
findSeparatingWord
public @Nullable net.automatalib.word.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 net.automatalib.word.Word<O> trace(S s, net.automatalib.word.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
-
processQueries
public void processQueries(Collection<? extends AdaptiveQuery<I,O>> queries)
Description copied from interface:AdaptiveMembershipOracle
Processes the specified collection of queries. When this method returns, the provided inputs of theAdaptiveQuery.getInput()
method will have been evaluated on the system under learning and its responses will have been forwarded to theAdaptiveQuery.processOutput(Object)
method until the method has returnedAdaptiveQuery.Response.FINISHED
.- Specified by:
processQueries
in interfaceAdaptiveMembershipOracle<S,I>
- Parameters:
queries
- the queries to process
-
-