Class FormulaSampler<T extends Formula>

  • Type Parameters:
    T - the class of the formulas.
    Direct Known Subclasses:
    BasicArgumentSampler

    public abstract class FormulaSampler<T extends Formula>
    extends java.lang.Object
    This abstract class models a sampler for formulas. It comprises of a set of sample methods which generates some random formulas wrt. to a given signature.
    Author:
    Matthias Thimm
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int DEFAULT_MAXIMAL_FORMULA_LENGTH
      This constant specifies the default length for sampled formulas.
    • Constructor Summary

      Constructors 
      Constructor Description
      FormulaSampler​(Signature signature)
      Creates a new formula sampler for the given signature.
    • Method Summary

      Modifier and Type Method Description
      Signature getSignature()
      Returns the signature of this sampler.
      T randomSample()
      This method randomly samples a single formula of the given signature with the default maximal formula length.
      abstract T randomSample​(int formula_length)
      This method randomly samples a single formula of the given signature with the given maximal formula length.
      java.util.Set<T> randomSample​(int formula_length, int numFormulas)
      This method randomly samples a total of "numFormulas" of the given signature and maximal formula length.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DEFAULT_MAXIMAL_FORMULA_LENGTH

        public static final int DEFAULT_MAXIMAL_FORMULA_LENGTH
        This constant specifies the default length for sampled formulas. The interpretation of this int depends on the actual type of knowledge representation but should resemble the number of atomic expressions and connectives used.
        See Also:
        Constant Field Values
    • Constructor Detail

      • FormulaSampler

        public FormulaSampler​(Signature signature)
        Creates a new formula sampler for the given signature.
        Parameters:
        signature - a signature.
    • Method Detail

      • randomSample

        public abstract T randomSample​(int formula_length)
        This method randomly samples a single formula of the given signature with the given maximal formula length.
        Parameters:
        formula_length - the maximal length of the formula to be sampled.
        Returns:
        a single formula.
      • randomSample

        public T randomSample()
        This method randomly samples a single formula of the given signature with the default maximal formula length.
        Returns:
        a single formula.
      • randomSample

        public java.util.Set<T> randomSample​(int formula_length,
                                             int numFormulas)
        This method randomly samples a total of "numFormulas" of the given signature and maximal formula length.
        Parameters:
        formula_length - the maximal length of the formulas to be sampled.
        numFormulas - the number of formulas to be sampled.
        Returns:
        a set of formulas.
      • getSignature

        public Signature getSignature()
        Returns the signature of this sampler.
        Returns:
        the signature of this sampler.