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 corresponding RobustnessOracle has a robustness cache mapping an abstract input word to the robustness values of its prefixes.
When the SUL is executed for a membership query, only the abstract output is computed and cached. When the SUL is executed for a 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>
  • Field Details

  • Constructor Details

  • Method Details

    • processQueries

      public void processQueries(Collection<? extends Query<String,net.automatalib.word.Word<String>>> queries)
      Specified by:
      processQueries in interface MembershipOracle<String,net.automatalib.word.Word<String>>
    • registerCostFunction

      public RobustnessOracle registerCostFunction(Function<IOSignal<List<Double>>,Double> costFunc)
      Registers a cost function and returns the oracle computing its robustness values. The robustness values for costFunc are 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:
      true if and only if the abstract output for abstractInput is 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. If requester is not null, the robustness caches of requester and the oracles registered after it are also updated.
      Parameters:
      abstractInput - the abstract input word
      requester - 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)