Class FormulaSampler<T extends Formula>

java.lang.Object
org.tweetyproject.commons.FormulaSampler<T>
Type Parameters:
T - the class of the formulas.
Direct Known Subclasses:
BasicArgumentSampler

public abstract class FormulaSampler<T extends Formula> extends 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 final int
    This constant specifies the default length for sampled formulas.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new formula sampler for the given signature.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the signature of this sampler.
    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.
    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 Details

    • 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:
  • Constructor Details

    • FormulaSampler

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

    • 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 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.