Package de.learnlib.oracle.equivalence
Class SampleSetEQOracle<I,D>
- java.lang.Object
-
- de.learnlib.oracle.equivalence.SampleSetEQOracle<I,D>
-
- Type Parameters:
I
- input symbol typeD
- output domain type
- All Implemented Interfaces:
EquivalenceOracle<SuffixOutput<I,D>,I,D>
public class SampleSetEQOracle<I,D> extends Object implements EquivalenceOracle<SuffixOutput<I,D>,I,D>
An equivalence oracle that tests a hypothesis against a fixed set of sample queries.Sample queries are provided through one of the
add(...)
oraddAll(...)
methods of this class. A query consists of an input word (split into a prefix and a suffix), and an expected output. During an equivalence query, for each of those queries if the respective actual suffix output of the hypothesis equals the expected output.This oracle will always repeatedly test queries from the sample set if they turned out to be counterexamples. However, the oracle can be configured to remove queries from the sample set if they did not serve as counterexamples.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface de.learnlib.oracle.EquivalenceOracle
EquivalenceOracle.DFAEquivalenceOracle<I>, EquivalenceOracle.MealyEquivalenceOracle<I,O>, EquivalenceOracle.MooreEquivalenceOracle<I,O>
-
-
Constructor Summary
Constructors Constructor Description SampleSetEQOracle(boolean removeUnsuccessful)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SampleSetEQOracle<I,D>
add(Word<I> input, D expectedOutput)
Adds a query word along with its expected output to the sample set.SampleSetEQOracle<I,D>
addAll(MembershipOracle<I,D> oracle, Collection<? extends Word<I>> words)
Adds words to the sample set.SampleSetEQOracle<I,D>
addAll(MembershipOracle<I,D> oracle, Word<I>... words)
Adds several query words to the sample set.SampleSetEQOracle<I,D>
addAll(DefaultQuery<I,D>... newTestQueries)
Adds queries to the sample set.SampleSetEQOracle<I,D>
addAll(Collection<? extends DefaultQuery<I,D>> newTestQueries)
Adds queries to the sample set.@Nullable DefaultQuery<I,D>
findCounterExample(SuffixOutput<I,D> hypothesis, Collection<? extends I> inputs)
Searches for a counterexample disproving the subjected hypothesis.
-
-
-
Constructor Detail
-
SampleSetEQOracle
public SampleSetEQOracle(boolean removeUnsuccessful)
Constructor. Initializes the oracle with an empty sample set.- Parameters:
removeUnsuccessful
- if set totrue
, queries will be removed from the sample set if they did not reveal a counterexample. Otherwise, all queries from the sample set will always be tested upon each invocation offindCounterExample(SuffixOutput, Collection)
.
-
-
Method Detail
-
add
public SampleSetEQOracle<I,D> add(Word<I> input, D expectedOutput)
Adds a query word along with its expected output to the sample set.- Parameters:
input
- the input wordexpectedOutput
- the expected output for this word- Returns:
this
, to enable chainedadd
oraddAll
calls
-
addAll
@SafeVarargs public final SampleSetEQOracle<I,D> addAll(MembershipOracle<I,D> oracle, Word<I>... words)
Adds several query words to the sample set. The expected output is determined by means of the specified membership oracle.- Parameters:
oracle
- the membership oracle used to determine expected outputswords
- the words to be added to the sample set- Returns:
this
, to enable chainedadd
oraddAll
calls
-
addAll
public SampleSetEQOracle<I,D> addAll(MembershipOracle<I,D> oracle, Collection<? extends Word<I>> words)
Adds words to the sample set. The expected output is determined by means of the specified membership oracle.- Parameters:
oracle
- the membership oracle used to determine the expected outputwords
- the words to add- Returns:
this
, to enable chainedadd
oraddAll
calls
-
addAll
@SafeVarargs public final SampleSetEQOracle<I,D> addAll(DefaultQuery<I,D>... newTestQueries)
Adds queries to the sample set. These must beDefaultQuery
s, which allow for retrieving the corresponding (expected) output.- Parameters:
newTestQueries
- the queries to add to the sample set- Returns:
this
, to enable chainedadd
oraddAll
calls
-
addAll
public SampleSetEQOracle<I,D> addAll(Collection<? extends DefaultQuery<I,D>> newTestQueries)
Adds queries to the sample set. These must beDefaultQuery
s, which allow for retrieving the corresponding (expected) output.- Parameters:
newTestQueries
- the queries to add to the sample set- Returns:
this
, to enable chainedadd
oraddAll
calls
-
findCounterExample
public @Nullable DefaultQuery<I,D> findCounterExample(SuffixOutput<I,D> hypothesis, Collection<? extends I> inputs)
Description copied from interface:EquivalenceOracle
Searches for a counterexample disproving the subjected hypothesis. A counterexample is query which, when performed on the SUL, yields a different output than what was predicted by the hypothesis. If no counterexample could be found (this does not necessarily mean that none exists),null
is returned.- Specified by:
findCounterExample
in interfaceEquivalenceOracle<SuffixOutput<I,D>,I,D>
- Parameters:
hypothesis
- the conjectureinputs
- the set of inputs to consider, this should be a subset of the input alphabet of the provided hypothesis- Returns:
- a query exposing different behavior, or
null
if no counterexample could be found. In case a non-null
value is returned, the output field in theDefaultQuery
contains the SUL output for the respective query.
-
-