Package net.sf.tweety.logics.pl.util
Class CnfSampler
- java.lang.Object
-
- net.sf.tweety.commons.BeliefSetSampler<PlFormula,PlBeliefSet>
-
- net.sf.tweety.logics.pl.util.CnfSampler
-
- All Implemented Interfaces:
java.util.Iterator<PlBeliefSet>
,BeliefSetIterator<PlFormula,PlBeliefSet>
public class CnfSampler extends BeliefSetSampler<PlFormula,PlBeliefSet>
A simple sampler for propositional belief bases. This sampler always generates belief bases in CNF, i.e. every formula appearing in the belief base is a disjunction of literals.- Author:
- Matthias Thimm
-
-
Field Summary
-
Fields inherited from class net.sf.tweety.commons.BeliefSetSampler
DEFAULT_MAXIMUM_BELIEFBASE_LENGTH, DEFAULT_MINIMUM_BELIEFBASE_LENGTH
-
-
Constructor Summary
Constructors Constructor Description CnfSampler(Signature signature, double maxVariableRatio)
Creates a new sampler for the given signature.CnfSampler(Signature signature, double maxVariableRatio, int minLength, int maxLength)
Creates a new sampler for the given signature.
-
Method Summary
Modifier and Type Method Description PlBeliefSet
next()
PlFormula
sampleFormula()
Returns a random formula-
Methods inherited from class net.sf.tweety.commons.BeliefSetSampler
getMaxLength, getMinLength, getSamplerSignature, hasNext
-
-
-
-
Constructor Detail
-
CnfSampler
public CnfSampler(Signature signature, double maxVariableRatio)
Creates a new sampler for the given signature.- Parameters:
signature
- a signaturemaxVariableRatio
- the maximum ratio (a value between 0 and 1) of variables of the signature appearing in some formula.
-
CnfSampler
public CnfSampler(Signature signature, double maxVariableRatio, int minLength, int maxLength)
Creates a new sampler for the given signature.- Parameters:
signature
- a signaturemaxVariableRatio
- the maximum ratio (a value between 0 and 1) of variables of the signature appearing in some formula.minLength
- the minimum length of knowledge basesmaxLength
- the maximum length of knowledge bases
-
-
Method Detail
-
next
public PlBeliefSet next()
- Specified by:
next
in interfaceBeliefSetIterator<PlFormula,PlBeliefSet>
- Specified by:
next
in interfacejava.util.Iterator<PlBeliefSet>
- Specified by:
next
in classBeliefSetSampler<PlFormula,PlBeliefSet>
-
sampleFormula
public PlFormula sampleFormula()
Returns a random formula- Returns:
- a random formula
-
-