Package org.tweetyproject.commons
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
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
Modifier and TypeFieldDescriptionstatic final int
This constant specifies the default length for sampled formulas. -
Constructor Summary
ConstructorDescriptionFormulaSampler
(Signature signature) Creates a new formula sampler for the given signature. -
Method Summary
Modifier and TypeMethodDescriptionReturns 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.
-
Field Details
-
DEFAULT_MAXIMAL_FORMULA_LENGTH
public static final int DEFAULT_MAXIMAL_FORMULA_LENGTHThis 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
Creates a new formula sampler for the given signature.- Parameters:
signature
- a signature.
-
-
Method Details
-
randomSample
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
This method randomly samples a single formula of the given signature with the default maximal formula length.- Returns:
- a single formula.
-
randomSample
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
Returns the signature of this sampler.- Returns:
- the signature of this sampler.
-