I - input symbol typeD - output domain typepublic abstract class AbstractObservationTable<I,D> extends Object implements MutableObservationTable<I,D>, Serializable
An observation table (OT) is the central data structure used by Angluin's L* algorithm, as described in the paper "Learning Regular Sets from Queries and Counterexamples".
An observation table is a two-dimensional table, with rows indexed by prefixes, and columns indexed by suffixes. For
a prefix u and a suffix v, the respective cell contains the result of the membership query
(u, v).
The set of prefixes (row labels) is divided into two disjoint sets: short and long prefixes. Each long prefix is a one-letter extension of a short prefix; conversely, every time a prefix is added to the set of short prefixes, all possible one-letter extensions are added to the set of long prefixes.
In order to derive a well-defined hypothesis from an observation table, it must satisfy two properties: closedness and consistency.
u there exists
a short prefix u' such that the row contents for both prefixes are equal. u and u' with identical row contents, it
holds that for every input symbol a the rows indexed by ua and u'a also have
identical contents. | Modifier and Type | Field and Description |
|---|---|
protected boolean |
initialConsistencyCheckRequired |
protected List<de.learnlib.datastructure.observationtable.RowImpl<I>> |
shortPrefixRows |
NO_DISTINGUISHING_SUFFIX| Constructor and Description |
|---|
AbstractObservationTable(Alphabet<I> alphabet)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
List<List<Row<I>>> |
addShortPrefixes(List<? extends Word<I>> shortPrefixes,
MembershipOracle<I,D> oracle) |
List<List<Row<I>>> |
addSuffix(Word<I> suffix,
MembershipOracle<I,D> oracle)
Adds a suffix to the list of distinguishing suffixes.
|
List<List<Row<I>>> |
addSuffixes(Collection<? extends Word<I>> newSuffixes,
MembershipOracle<I,D> oracle)
Adds suffixes to the list of distinguishing suffixes.
|
protected static <I,D> void |
buildQueries(List<DefaultQuery<I,D>> queryList,
Word<I> prefix,
List<? extends Word<I>> suffixes) |
protected static <I,D> void |
buildRowQueries(List<DefaultQuery<I,D>> queryList,
List<? extends Row<I>> rows,
List<? extends Word<I>> suffixes) |
protected void |
checkInitialShortPrefixes(List<Word<I>> initialShortPrefixes) |
protected de.learnlib.datastructure.observationtable.RowImpl<I> |
createLpRow(Word<I> prefix) |
protected de.learnlib.datastructure.observationtable.RowImpl<I> |
createSpRow(Word<I> prefix) |
protected static <I,D> void |
fetchResults(Iterator<DefaultQuery<I,D>> queryIt,
List<D> output,
int numSuffixes)
Fetches the given number of query responses and adds them to the specified output list.
|
Alphabet<I> |
getInputAlphabet()
Retrieves the input alphabet used in this observation table.
|
Collection<Row<I>> |
getLongPrefixRows() |
de.learnlib.datastructure.observationtable.RowImpl<I> |
getRow(int rowId) |
de.learnlib.datastructure.observationtable.RowImpl<I> |
getRow(Word<I> prefix) |
List<Row<I>> |
getShortPrefixRows() |
List<Word<I>> |
getSuffixes()
Retrieves all suffixes in the table.
|
protected List<Word<I>> |
initializeSuffixes(List<Word<I>> initialSuffixes) |
boolean |
isAccessSequence(Word<I> word) |
boolean |
isInitialConsistencyCheckRequired() |
boolean |
isInitialized()
Checks whether this observation table has been initialized yet (i.e., contains any rows).
|
protected void |
makeShort(de.learnlib.datastructure.observationtable.RowImpl<I> row) |
int |
numberOfDistinctRows()
Returns the number of distinct (regarding row values) rows in this observation table.
|
int |
numberOfRows()
Returns the total number of rows in this observation table.
|
protected boolean |
processContents(de.learnlib.datastructure.observationtable.RowImpl<I> row,
List<D> rowContents,
boolean makeCanonical) |
List<D> |
rowContents(Row<I> row) |
void |
setInputAlphabet(Alphabet<I> alphabet)
This is an internal method used for de-serializing.
|
Word<I> |
transformAccessSequence(Word<I> word) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddAlphabetSymbol, initialize, toShortPrefixescellContents, findDistinguishingSuffix, findDistinguishingSuffix, findDistinguishingSuffixIndex, findDistinguishingSuffixIndex, findInconsistency, findUnclosedRow, getAllPrefixes, getAllRows, getLongPrefixes, getRowSuccessor, getShortPrefixes, getSuffix, isClosed, isConsistent, numberOfLongPrefixRows, numberOfShortPrefixRows, numberOfSuffixeslongestASPrefixprotected final List<de.learnlib.datastructure.observationtable.RowImpl<I>> shortPrefixRows
protected boolean initialConsistencyCheckRequired
protected static <I,D> void buildQueries(List<DefaultQuery<I,D>> queryList, Word<I> prefix, List<? extends Word<I>> suffixes)
protected void checkInitialShortPrefixes(List<Word<I>> initialShortPrefixes)
protected de.learnlib.datastructure.observationtable.RowImpl<I> createSpRow(Word<I> prefix)
protected de.learnlib.datastructure.observationtable.RowImpl<I> createLpRow(Word<I> prefix)
protected static <I,D> void fetchResults(Iterator<DefaultQuery<I,D>> queryIt, List<D> output, int numSuffixes)
queryIt - the query iteratoroutput - the output list to write tonumSuffixes - the number of suffixes (queries)protected boolean processContents(de.learnlib.datastructure.observationtable.RowImpl<I> row, List<D> rowContents, boolean makeCanonical)
public int numberOfDistinctRows()
ObservationTablenumberOfDistinctRows in interface ObservationTable<I,D>Row.getRowContentId()public List<List<Row<I>>> addSuffix(Word<I> suffix, MembershipOracle<I,D> oracle)
MutableObservationTableaddSufixes(Collections.singletonList(suffix), oracle).addSuffix in interface MutableObservationTable<I,D>suffix - the suffix to addoracle - the membership oraclepublic List<List<Row<I>>> addSuffixes(Collection<? extends Word<I>> newSuffixes, MembershipOracle<I,D> oracle)
MutableObservationTableaddSuffixes in interface MutableObservationTable<I,D>newSuffixes - the suffixes to addoracle - the membership oraclepublic boolean isInitialConsistencyCheckRequired()
isInitialConsistencyCheckRequired in interface MutableObservationTable<I,D>public List<List<Row<I>>> addShortPrefixes(List<? extends Word<I>> shortPrefixes, MembershipOracle<I,D> oracle)
addShortPrefixes in interface MutableObservationTable<I,D>protected void makeShort(de.learnlib.datastructure.observationtable.RowImpl<I> row)
protected static <I,D> void buildRowQueries(List<DefaultQuery<I,D>> queryList, List<? extends Row<I>> rows, List<? extends Word<I>> suffixes)
public List<D> rowContents(Row<I> row)
rowContents in interface ObservationTable<I,D>public de.learnlib.datastructure.observationtable.RowImpl<I> getRow(int rowId)
getRow in interface ObservationTable<I,D>public de.learnlib.datastructure.observationtable.RowImpl<I> getRow(Word<I> prefix)
getRow in interface ObservationTable<I,D>public int numberOfRows()
ObservationTablenumberOfRows in interface ObservationTable<I,D>Row.getRowId()public List<Word<I>> getSuffixes()
ObservationTablegetSuffixes in interface ObservationTable<I,D>public boolean isInitialized()
MutableObservationTableisInitialized in interface MutableObservationTable<I,D>true iff the table has been initializedpublic Alphabet<I> getInputAlphabet()
ObservationTablegetInputAlphabet in interface ObservationTable<I,D>public void setInputAlphabet(Alphabet<I> alphabet)
alphabet - the input alphabet corresponding to the previously serialized one.public Word<I> transformAccessSequence(Word<I> word)
transformAccessSequence in interface AccessSequenceTransformer<I>public boolean isAccessSequence(Word<I> word)
isAccessSequence in interface AccessSequenceTransformer<I>@Nonnull public List<Row<I>> getShortPrefixRows()
getShortPrefixRows in interface ObservationTable<I,D>@Nonnull public Collection<Row<I>> getLongPrefixRows()
getLongPrefixRows in interface ObservationTable<I,D>Copyright © 2019. All rights reserved.