Package de.learnlib.algorithm.lstar
Class AbstractLStar<A,I,D>
- java.lang.Object
-
- de.learnlib.algorithm.lstar.AbstractLStar<A,I,D>
-
- Type Parameters:
A- automaton typeI- input symbol typeD- output domain type
- All Implemented Interfaces:
GlobalSuffixLearner<A,I,D>,LearningAlgorithm<A,I,D>,ObservationTableFeature<I,D>,OTLearner<A,I,D>,net.automatalib.alphabet.SupportsGrowingAlphabet<I>
- Direct Known Subclasses:
AbstractAutomatonLStar
public abstract class AbstractLStar<A,I,D> extends Object implements OTLearner<A,I,D>, GlobalSuffixLearner<A,I,D>, net.automatalib.alphabet.SupportsGrowingAlphabet<I>
An abstract base class for L*-style algorithms.This class implements basic management features (table, alphabet, oracle) and the main loop of alternating completeness and consistency checks. It does not take care of choosing how to initialize the table and hypothesis construction.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface de.learnlib.algorithm.GlobalSuffixLearner
GlobalSuffixLearner.GlobalSuffixLearnerDFA<I extends Object>, GlobalSuffixLearner.GlobalSuffixLearnerMealy<I extends Object,O extends Object>
-
Nested classes/interfaces inherited from interface de.learnlib.algorithm.LearningAlgorithm
LearningAlgorithm.DFALearner<I extends Object>, LearningAlgorithm.MealyLearner<I extends Object,O extends Object>, LearningAlgorithm.MooreLearner<I extends Object,O extends Object>, LearningAlgorithm.NFALearner<I extends Object>
-
Nested classes/interfaces inherited from interface de.learnlib.datastructure.observationtable.OTLearner
OTLearner.OTLearnerDFA<I extends Object>, OTLearner.OTLearnerMealy<I extends Object,O extends Object>, OTLearner.OTLearnerMoore<I extends Object,O extends Object>
-
-
Field Summary
Fields Modifier and Type Field Description protected net.automatalib.alphabet.Alphabet<I>alphabetprotected MembershipOracle<I,D>oracleprotected GenericObservationTable<I,D>table
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractLStar(net.automatalib.alphabet.Alphabet<I> alphabet, MembershipOracle<I,D> oracle)Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddAlphabetSymbol(I symbol)booleanaddGlobalSuffixes(Collection<? extends net.automatalib.word.Word<I>> newGlobalSuffixes)protected net.automatalib.word.Word<I>analyzeInconsistency(Inconsistency<I> incons)Analyzes an inconsistency.protected booleancompleteConsistentTable(List<List<Row<I>>> unclosed, boolean checkConsistency)Iteratively checks for unclosedness and inconsistencies in the table, and fixes any occurrences thereof.protected voiddoRefineHypothesis(DefaultQuery<I,D> ceQuery)Collection<net.automatalib.word.Word<I>>getGlobalSuffixes()ObservationTable<I,D>getObservationTable()protected abstract net.automatalib.automaton.concept.SuffixOutput<I,D>hypothesisOutput()protected List<List<Row<I>>>incorporateCounterExample(DefaultQuery<I,D> ce)Incorporates the information provided by a counterexample into the observation data structure.protected List<net.automatalib.word.Word<I>>initialPrefixes()protected abstract List<net.automatalib.word.Word<I>>initialSuffixes()Returns the list of initial suffixes which are used to initialize the table.booleanrefineHypothesis(DefaultQuery<I,D> ceQuery)protected List<Row<I>>selectClosingRows(List<List<Row<I>>> unclosed)This method selects a set of rows to use for closing the table.voidstartLearning()-
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
-
table
protected GenericObservationTable<I,D> table
-
-
Constructor Detail
-
AbstractLStar
protected AbstractLStar(net.automatalib.alphabet.Alphabet<I> alphabet, MembershipOracle<I,D> oracle)
Constructor.- Parameters:
alphabet- the learning alphabet.oracle- the membership oracle.
-
-
Method Detail
-
startLearning
public void startLearning()
- Specified by:
startLearningin interfaceLearningAlgorithm<A,I,D>
-
refineHypothesis
public final boolean refineHypothesis(DefaultQuery<I,D> ceQuery)
- Specified by:
refineHypothesisin interfaceLearningAlgorithm<A,I,D>
-
hypothesisOutput
protected abstract net.automatalib.automaton.concept.SuffixOutput<I,D> hypothesisOutput()
-
doRefineHypothesis
protected void doRefineHypothesis(DefaultQuery<I,D> ceQuery)
-
incorporateCounterExample
protected List<List<Row<I>>> incorporateCounterExample(DefaultQuery<I,D> ce)
Incorporates the information provided by a counterexample into the observation data structure.- Parameters:
ce- the query which contradicts the hypothesis- Returns:
- the rows (equivalence classes) which became unclosed by adding the information.
-
initialSuffixes
protected abstract List<net.automatalib.word.Word<I>> initialSuffixes()
Returns the list of initial suffixes which are used to initialize the table.- Returns:
- the list of initial suffixes.
-
completeConsistentTable
protected boolean completeConsistentTable(List<List<Row<I>>> unclosed, boolean checkConsistency)
Iteratively checks for unclosedness and inconsistencies in the table, and fixes any occurrences thereof. This process is repeated until the observation table is both closed and consistent.- Parameters:
unclosed- the unclosed rows (equivalence classes) to start with.checkConsistency- a flag indicating whether consistency should be checked as well. Iffalse, only closedness is ensured.- Returns:
trueif unclosed rows have been closed,falseotherwise
-
selectClosingRows
protected List<Row<I>> selectClosingRows(List<List<Row<I>>> unclosed)
This method selects a set of rows to use for closing the table. It receives as input a list of row lists, such that each (inner) list contains long prefix rows with (currently) identical contents, which have no matching short prefix row. The outer list is the list of all those equivalence classes.- Parameters:
unclosed- a list of equivalence classes of unclosed rows.- Returns:
- a list containing a representative row from each class to move to the short prefix part.
-
analyzeInconsistency
protected net.automatalib.word.Word<I> analyzeInconsistency(Inconsistency<I> incons)
Analyzes an inconsistency. This analysis consists in determining the column in which the two successor rows differ.- Parameters:
incons- the inconsistency description- Returns:
- the suffix to add in order to fix the inconsistency
-
getGlobalSuffixes
public Collection<net.automatalib.word.Word<I>> getGlobalSuffixes()
- Specified by:
getGlobalSuffixesin interfaceGlobalSuffixLearner<A,I,D>
-
addGlobalSuffixes
public boolean addGlobalSuffixes(Collection<? extends net.automatalib.word.Word<I>> newGlobalSuffixes)
- Specified by:
addGlobalSuffixesin interfaceGlobalSuffixLearner<A,I,D>
-
getObservationTable
public ObservationTable<I,D> getObservationTable()
- Specified by:
getObservationTablein interfaceObservationTableFeature<A,I>
-
-