Package net.maswag.falcaun.oracle
Class NumericMembershipOracle
java.lang.Object
net.maswag.falcaun.oracle.NumericMembershipOracle
- All Implemented Interfaces:
BatchProcessor<Query<String,,net.automatalib.word.Word<String>>> MembershipOracle<String,,net.automatalib.word.Word<String>> MembershipOracle.MealyMembershipOracle<String,,String> QueryAnswerer<String,net.automatalib.word.Word<String>>
public class NumericMembershipOracle
extends Object
implements MembershipOracle.MealyMembershipOracle<String,String>
The membership oracle for a
NumericSUL.
This class is the single owner of the full-word executions of the SUL for membership queries and for the robustness-based equivalence oracles. It maintains the following caches.
- The abstract-output cache maps an abstract input word to the abstract output word. It is independent of the properties.
- For each cost function registered by
registerCostFunction(Function), the correspondingRobustnessOraclehas a robustness cache mapping an abstract input word to the robustness values of its prefixes.
RobustnessOracle, the prefix-wise robustness values are computed for that
oracle and for the oracles registered after it, and cached. In both cases, the concrete trace is discarded after the
computation. Thus, a robustness value that is not cached requires another execution of the word even if its
abstract output is cached: an abstract output is not sufficient to compute the robustness.
Computing the robustness values only for the requesting oracle and the later ones keeps the computation cost of the robustness values the same as the previous implementation sharing the observations among the cost oracles.
- Author:
- Masaki Waga <masakiwaga@gmail.com>
-
Nested Class Summary
Nested classes/interfaces inherited from interface de.learnlib.oracle.MembershipOracle
MembershipOracle.DFAMembershipOracle<I>, MembershipOracle.MealyMembershipOracle<I,O>, MembershipOracle.MooreMembershipOracle<I, O> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final SignalDiscretizerprivate final List<RobustnessOracle> private final NumericSUL -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) net.automatalib.word.Word<String> execute(net.automatalib.word.Word<String> abstractInput, @Nullable RobustnessOracle requester) Executes the SUL for an abstract input word and updates the abstract-output cache.private static SULExceptionexecutionFailure(net.automatalib.word.Word<String> abstractInput, net.automatalib.word.Word<List<Double>> concreteInput, Exception cause) (package private) booleanlookup(net.automatalib.word.Word<String> abstractInput, net.automatalib.word.WordBuilder<String> output) Looks up the abstract-output cache.private net.automatalib.word.Word<Double> Computes the robustness values of the non-empty prefixes of a concrete trace.voidprocessQueries(Collection<? extends Query<String, net.automatalib.word.Word<String>>> queries) Registers a cost function and returns the oracle computing its robustness values.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.learnlib.oracle.MembershipOracle
answerQuery, answerQuery, asOracle, processBatch, processQuery
-
Field Details
-
sul
-
discretizer
-
outputCache
-
robustnessOracles
-
-
Constructor Details
-
NumericMembershipOracle
-
-
Method Details
-
processQueries
public void processQueries(Collection<? extends Query<String, net.automatalib.word.Word<String>>> queries) - Specified by:
processQueriesin interfaceMembershipOracle<String,net.automatalib.word.Word<String>>
-
registerCostFunction
Registers a cost function and returns the oracle computing its robustness values. The robustness values forcostFuncare computed for the executions of the SUL requested by the returned oracle or by the oracles registered before it.- Parameters:
costFunc- the cost function, typically an STL formula- Returns:
- the oracle computing the robustness values for
costFunc
-
lookup
boolean lookup(net.automatalib.word.Word<String> abstractInput, net.automatalib.word.WordBuilder<String> output) Looks up the abstract-output cache.- Returns:
trueif and only if the abstract output forabstractInputis cached.
-
execute
net.automatalib.word.Word<String> execute(net.automatalib.word.Word<String> abstractInput, @Nullable @Nullable RobustnessOracle requester) Executes the SUL for an abstract input word and updates the abstract-output cache. Ifrequesteris not null, the robustness caches ofrequesterand the oracles registered after it are also updated.- Parameters:
abstractInput- the abstract input wordrequester- the oracle requesting the execution, or null for a membership query- Returns:
- the abstract output word
- Throws:
SULException- if the execution of the SUL fails
-
prefixRobustness
private net.automatalib.word.Word<Double> prefixRobustness(IOSignal<List<Double>> trace, Function<IOSignal<List<Double>>, Double> costFunc) Computes the robustness values of the non-empty prefixes of a concrete trace. The cost function is applied to the concrete signals including the derived signals. -
executionFailure
private static SULException executionFailure(net.automatalib.word.Word<String> abstractInput, net.automatalib.word.Word<List<Double>> concreteInput, Exception cause)
-