Class STLAbstractAtomic

java.lang.Object
net.maswag.falcaun.temporal.AbstractTemporalLogic<List<Double>>
net.maswag.falcaun.temporal.STLAbstractAtomic
All Implemented Interfaces:
Function<IOSignal<List<Double>>,Double>, TemporalLogic<List<Double>>, TemporalLogic.STLCost
Direct Known Subclasses:
STLInputAtomic, STLOutputAtomic

public abstract class STLAbstractAtomic extends AbstractTemporalLogic<List<Double>> implements TemporalLogic.STLCost

STLAtomic class.

Author:
Masaki Waga <masakiwaga@gmail.com>
  • Field Details

  • Constructor Details

    • STLAbstractAtomic

      public STLAbstractAtomic(int sigIndex, STLAbstractAtomic.Operation op, double comparator)

      Constructor for STLAbstractAtomic.

      Parameters:
      sigIndex - An index of signals
      op - The comparison operator STLAbstractAtomic.Operation
      comparator - The value to compare against
  • Method Details

    • getAllAPs

      protected Set<String> getAllAPs(int signalSize)
      Parameters:
      signalSize - the length of the signal greater than this.sigIndex
    • getRoSISingle

      public RoSI getRoSISingle(net.automatalib.word.Word<List<Double>> signal)
    • getSignalName

      protected abstract String getSignalName()
    • toString

      public String toString()
      Returns a human-readable string representation of the formula.

      The representation is unambiguous only for the formulas supported by the parsers: if a formula is structurally equal to one constructed by STLFactory or LTLFactory, its string representation is parsed back to a structurally equal formula. Otherwise, structurally different formulas may have the same string representation, e.g.:

      • empty or singleton conjunctions and disjunctions,
      • n-ary conjunctions and disjunctions, which are parsed back as left-nested binary ones,
      • the next operator, whose nullPositive flag is not printed,
      • LTL atomic propositions with both input and output symbols, which are printed like conjunctions,
      • LTL symbols outside the grammar and non-finite STL thresholds, which the parsers reject, and
      • other formulas outside the grammar, e.g., TemporalConst.

      Thus, this method must not be used as a substitute for structural equality or as a unique key, e.g., of a cache.

      Specified by:
      toString in interface TemporalLogic<List<Double>>
      Overrides:
      toString in class Object
      Returns:
      a human-readable string representation of the formula
    • formatThreshold

      static String formatThreshold(double value)
      Returns the string representation of a threshold without loss of precision and without the exponent notation, which the STL grammar does not support. Non-finite values cannot be parsed.
      Parameters:
      value - the threshold to print
      Returns:
      the string representation of value
    • structuralKind

      protected Class<?> structuralKind()
      Returns the class representing the operator of this formula, shared by its STL/LTL-specific subclasses.
      Specified by:
      structuralKind in class AbstractTemporalLogic<List<Double>>
      Returns:
      the class representing the operator of this formula, e.g., TemporalGlobally.class
    • structuralFields

      protected List<Object> structuralFields()
      Returns the syntactic fields of this formula, e.g., the operands and the bounds of a bounded temporal operator. Derived state, caches, and the abstraction configuration must not be included. Each element must have a deterministic hash code, e.g., an enum constant must be represented by its Enum.name().
      Specified by:
      structuralFields in class AbstractTemporalLogic<List<Double>>
      Returns:
      the syntactic fields of this formula in a fixed order
    • constructAtomicStrings

      protected void constructAtomicStrings(int signalSize)
      Parameters:
      signalSize - the length of the signal
    • toAbstractString

      public String toAbstractString()
      Returns a string representation of the formula in the format of LTSMin.
      Specified by:
      toAbstractString in interface TemporalLogic<List<Double>>
      Returns:
      a String object representing the formula in the format of LTSMin.
    • toAbstractLTLString

      public String toAbstractLTLString(Map<String,String> mapper)
      Specified by:
      toAbstractLTLString in interface TemporalLogic<List<Double>>
    • toOwlString

      public String toOwlString()
      Specified by:
      toOwlString in interface TemporalLogic<List<Double>>
    • constructSmallerOrEqualAPs

      protected abstract Set<Character> constructSmallerOrEqualAPs(int index, double threshold)
      Constructs a set of characters representing atomic propositions whose values are smaller than or equal to the given threshold for the specified signal index. This is used for the non-strict comparison <= (STLAbstractAtomic.Operation.LE).
      Parameters:
      index - The index of the signal.
      Returns:
      A set of characters representing the atomic propositions.
    • constructLargerAPs

      protected abstract Set<Character> constructLargerAPs(int index, double threshold)
      Constructs a set of characters representing atomic propositions that are greater than the given threshold for the specified signal index.
      Parameters:
      index - The index of the signal.
      Returns:
      A set of characters representing the atomic propositions.
    • constructEqAPs

      protected abstract Set<Character> constructEqAPs(int index, double threshold)
      Constructs a set of characters representing atomic propositions that are equal to the given threshold for the specified signal index.
      Parameters:
      index - The index of the signal.
      Returns:
      A set of characters representing the atomic propositions.
    • constructAllAPs

      protected abstract Set<Character> constructAllAPs(int index)
      Construct the characters that represent the abstract values of the signal.
      Parameters:
      index - The index of the signal
    • cartesianProductCharacters

      @NotNull public static @NotNull Set<String> cartesianProductCharacters(@NotNull @NotNull List<Set<Character>> charList)
      Take the cartesian product of a list of sets of characters and return a set of strings by concatenating the characters.

      For example, if the input is [[a, b], [c, d]], the output will be {ac, ad, bc, bd}.

      Parameters:
      charList - a list of sets of characters
      Returns:
      a set of concatenated character combinations
    • decomposeMap

      static <T> org.apache.commons.math3.util.Pair<List<T>,List<Double>> decomposeMap(Map<T,Double> map)
      Decomposes a map with value Doubles into a pair of lists of keys and Doubles.
      Type Parameters:
      T - the type of the keys
      Parameters:
      map - a map to Doubles
      Returns:
      a pair of lists of keys and Doubles. The first element is a list of keys and the second element is a list of values. The returned lists are sorted in ascending order of the values.
    • decomposeMapList

      static <T> void decomposeMapList(List<Map<T,Double>> maps, List<List<T>> keyLists, List<List<Double>> valueLists)
      Decomposes a list of maps with value Doubles into a list of pair of lists of keys and Doubles.
      Type Parameters:
      T - the type of the keys
      Parameters:
      maps - a list of maps to Doubles.
      keyLists - a list of lists of keys. The contents of this list will be cleared.
      valueLists - a list of lists of values. The contents of this list will be cleared.