public class SyntacticRandomPlBeliefSetSampler extends BeliefBaseSampler<PlBeliefSet>
This sampler implements a random generation algorithm for generating formulas, based on the syntax tree of propositional formulas. Consider the following BNF for a propositional logic formula:
F ::== !F | F && F | F || F | Awith propositions A. The algorithm for constructing formulas takes four parameters:
Modifier and Type | Field and Description |
---|---|
private static byte |
CONJ |
private static byte |
DISJ |
private static byte |
NEG |
private ProbabilityFunction<java.lang.Byte> |
prob
The probability function modeling the random decisions.
|
private ProbabilityFunction<Proposition> |
probProp
The probability function used to sample propositions
|
private static byte |
PROP |
private java.util.Random |
rand |
private double |
recDecrease |
DEFAULT_MAXIMUM_BELIEFBASE_LENGTH, DEFAULT_MINIMUM_BELIEFBASE_LENGTH
Constructor and Description |
---|
SyntacticRandomPlBeliefSetSampler(Signature signature,
Probability probneg,
Probability probconj,
Probability probdisj,
double recDecrease)
Creates a new sampler.
|
Modifier and Type | Method and Description |
---|---|
private ProbabilityFunction<java.lang.Byte> |
decrease(ProbabilityFunction<java.lang.Byte> prob,
double value)
Adapts the given probability function by decreasing the probabilities of NEG, CONJ and DISJ.
|
PlBeliefSet |
randomSample(int minLength,
int maxLength)
This method randomly samples a single belief base of the given signature
with the given belief base length.
|
PropositionalFormula |
sampleFormula(ProbabilityFunction<java.lang.Byte> prob)
Samples a single formula.
|
getSignature, randomSample, randomSample
private ProbabilityFunction<java.lang.Byte> prob
private ProbabilityFunction<Proposition> probProp
private double recDecrease
private static final byte NEG
private static final byte CONJ
private static final byte DISJ
private static final byte PROP
private java.util.Random rand
public SyntacticRandomPlBeliefSetSampler(Signature signature, Probability probneg, Probability probconj, Probability probdisj, double recDecrease)
signature
- some set of propositionsprobneg
- the probability to generate a negationprobconj
- the probability to generate a conjunctionprobdisj
- the probability to generate a disjunctionrecDecrease
- a value in (0,1) by which the above probabilities are multiplied in each recursive step to
increase likelihood of termination.private ProbabilityFunction<java.lang.Byte> decrease(ProbabilityFunction<java.lang.Byte> prob, double value)
prob
- a probability function.value
- some value in (0,1)public PropositionalFormula sampleFormula(ProbabilityFunction<java.lang.Byte> prob)
public PlBeliefSet randomSample(int minLength, int maxLength)
BeliefBaseSampler
randomSample
in class BeliefBaseSampler<PlBeliefSet>
minLength
- the minimum length of the belief base.maxLength
- the maximum length of the belief base.