Package net.sf.tweety.logics.pl.util
Class RandomSampler
- java.lang.Object
 - 
- net.sf.tweety.commons.BeliefSetSampler<PlFormula,PlBeliefSet>
 - 
- net.sf.tweety.logics.pl.util.RandomSampler
 
 
 
- 
- All Implemented Interfaces:
 java.util.Iterator<PlBeliefSet>,BeliefSetIterator<PlFormula,PlBeliefSet>
public class RandomSampler extends BeliefSetSampler<PlFormula,PlBeliefSet>
- Author:
 - mthimm
 
 
- 
- 
Field Summary
Fields Modifier and Type Field Description private java.util.List<PossibleWorld>allWorldsAll possible worldsprivate java.util.Randomrandfor generating random numbersprivate doubleworldProbProbability of selecting any world as a model of a formula- 
Fields inherited from class net.sf.tweety.commons.BeliefSetSampler
DEFAULT_MAXIMUM_BELIEFBASE_LENGTH, DEFAULT_MINIMUM_BELIEFBASE_LENGTH 
 - 
 
- 
Constructor Summary
Constructors Constructor Description RandomSampler(Signature signature, double worldProb)Creates a new sampler for the given signatureRandomSampler(Signature signature, double worldProb, int minLength, int maxLength)Creates a new sampler for the given signature 
- 
Method Summary
Modifier and Type Method Description PlBeliefSetnext()private PlFormularandomFormula()Returns a random formula.- 
Methods inherited from class net.sf.tweety.commons.BeliefSetSampler
getMaxLength, getMinLength, getSamplerSignature, hasNext 
 - 
 
 - 
 
- 
- 
Field Detail
- 
allWorlds
private java.util.List<PossibleWorld> allWorlds
All possible worlds 
- 
rand
private java.util.Random rand
for generating random numbers 
- 
worldProb
private double worldProb
Probability of selecting any world as a model of a formula 
 - 
 
- 
Constructor Detail
- 
RandomSampler
public RandomSampler(Signature signature, double worldProb)
Creates a new sampler for the given signature- Parameters:
 signature- some signatureworldProb- Probability of selecting any world as a model of a formula
 
- 
RandomSampler
public RandomSampler(Signature signature, double worldProb, int minLength, int maxLength)
Creates a new sampler for the given signature- Parameters:
 signature- some signatureworldProb- Probability of selecting any world as a model of a formulaminLength- the minimum length of knowledge basesmaxLength- the maximum length of knowledge bases
 
 - 
 
- 
Method Detail
- 
next
public PlBeliefSet next()
- Specified by:
 nextin interfaceBeliefSetIterator<PlFormula,PlBeliefSet>- Specified by:
 nextin interfacejava.util.Iterator<PlBeliefSet>- Specified by:
 nextin classBeliefSetSampler<PlFormula,PlBeliefSet>
 
- 
randomFormula
private PlFormula randomFormula()
Returns a random formula.- Returns:
 - a random formula.
 
 
 - 
 
 -