Class RejectionWrapper
- java.lang.Object
-
- org.apache.commons.math3.distribution.AbstractRealDistribution
-
- org.processmining.plugins.stochasticpetrinet.distribution.AnotherAbstractRealDistribution
-
- org.processmining.plugins.stochasticpetrinet.distribution.RejectionWrapper
-
- All Implemented Interfaces:
java.io.Serializable,org.apache.commons.math3.analysis.UnivariateFunction,org.apache.commons.math3.distribution.RealDistribution
- Direct Known Subclasses:
TruncatedWrapper
public class RejectionWrapper extends AnotherAbstractRealDistribution
A wrapper around a distribution that cuts off a part below a certain thresholdconstraintand rescales the rest of the distribution to become a valid one again.For sampling, a basic rejection sampling approach is implemented in
sample().- Author:
- Andreas Rogge-Solti
- See Also:
for a more advanced version using a slice sampling approach., Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected doubleconstraintthe constraint, such that the distribution is truncated below this constraintprotected doublescalescaling function, such that the truncated distribution will integrate to 1protected org.apache.commons.math3.distribution.RealDistributionwrappedDistThe original distribution-
Fields inherited from class org.processmining.plugins.stochasticpetrinet.distribution.AnotherAbstractRealDistribution
cachedMean, cachedVariance
-
-
Constructor Summary
Constructors Constructor Description RejectionWrapper(org.apache.commons.math3.distribution.RealDistribution dist)RejectionWrapper(org.apache.commons.math3.distribution.RealDistribution dist, double constraint)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doubledensity(double x)doublegetSupportLowerBound()doublegetSupportUpperBound()booleanisSupportConnected()booleanisSupportLowerBoundInclusive()booleanisSupportUpperBoundInclusive()voidreseedRandomGenerator(long seed)doublesample()Perform simple rejection sampling until we find a sample that is above the constraint threshold.double[]sample(int sampleSize)-
Methods inherited from class org.processmining.plugins.stochasticpetrinet.distribution.AnotherAbstractRealDistribution
cumulativeProbability, getNumericalMean, getNumericalVariance, value
-
-
-
-
Field Detail
-
wrappedDist
protected org.apache.commons.math3.distribution.RealDistribution wrappedDist
The original distribution
-
constraint
protected double constraint
the constraint, such that the distribution is truncated below this constraint
-
scale
protected double scale
scaling function, such that the truncated distribution will integrate to 1
-
-
Method Detail
-
density
public double density(double x)
-
getSupportLowerBound
public double getSupportLowerBound()
-
getSupportUpperBound
public double getSupportUpperBound()
-
isSupportLowerBoundInclusive
public boolean isSupportLowerBoundInclusive()
-
isSupportUpperBoundInclusive
public boolean isSupportUpperBoundInclusive()
-
isSupportConnected
public boolean isSupportConnected()
-
reseedRandomGenerator
public void reseedRandomGenerator(long seed)
- Specified by:
reseedRandomGeneratorin interfaceorg.apache.commons.math3.distribution.RealDistribution- Overrides:
reseedRandomGeneratorin classorg.apache.commons.math3.distribution.AbstractRealDistribution
-
sample
public double sample()
Perform simple rejection sampling until we find a sample that is above the constraint threshold.- Specified by:
samplein interfaceorg.apache.commons.math3.distribution.RealDistribution- Overrides:
samplein classorg.apache.commons.math3.distribution.AbstractRealDistribution
-
sample
public double[] sample(int sampleSize)
- Specified by:
samplein interfaceorg.apache.commons.math3.distribution.RealDistribution- Overrides:
samplein classorg.apache.commons.math3.distribution.AbstractRealDistribution
-
-