Package de.uka.ipd.sdq.probfunction.math
Interface IProbabilityFunctionFactory
- All Known Implementing Classes:
ProbabilityFunctionFactoryImpl
public interface IProbabilityFunctionFactory
Factory. Provides a set of methods to create all kinds of probability functions and related
objects. It also allows the transformation of different function types.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final IProbabilityFunctionFactory
Singleton instance of the factory. -
Method Summary
Modifier and TypeMethodDescriptioncreateBoxedPDF
(List<IContinuousSample> samples, IUnit unit) Creates a new BoxedPDF, whose boxes are defined by 'samples'.createContinuousSample
(double value, double probability) Creates a new ContinuousSample with the attributes value and probability set.Creates new Unit with name DEFAULT_UNIT_NAME, which is "ms".createDiracImpulse
(int numOfSamplingPoints, double distance, IUnit unit) creates a distribution function, wich represents a dirac impulse.createImpulseAt
(int pos, int numOfSamplingPoints, double distance, IUnit unit) Creates a distribution function, which describes a random variable with a constant outcome.createPMFFromMeasurements
(Boolean[] measurements, IUnit unit, boolean hasOrderedDomain) createPMFFromMeasurements
(Double[] measurements, double epsilon, IUnit unit, boolean hasOrderedDomain) createPMFFromMeasurements
(Integer[] measurements, IUnit unit, boolean hasOrderedDomain) createPMFFromMeasurements
(String[] measurements, IUnit unit, boolean hasOrderedDomain) createProbabilityMassFunction
(List<ISample> samples, IUnit unit, boolean hasOrderedDomain) Creates a new ProbabilityMassFunction whose samples are set to 'samples'.createSample
(Object value, double probability) Creates a new Sample with the attributes value and probability set.createSamplePDFFromComplex
(double distance, List<org.apache.commons.math.complex.Complex> samples, boolean isInFrequencyDomain, IUnit unit) Creates a new SamplePDF instace whose distance is set to 'distance' and whose sampling points are set to samples.createSamplePDFFromComplex
(double distance, List<org.apache.commons.math.complex.Complex> samples, boolean isInFrequencyDomain, IUnit unit, IRandomGenerator generator) createSamplePDFFromComplex
(double distance, List<org.apache.commons.math.complex.Complex> samples, IUnit unit) createSamplePDFFromComplex
(double distance, List<org.apache.commons.math.complex.Complex> samples, IUnit unit, IRandomGenerator generator) createSamplePDFFromDouble
(double distance, List<Double> samples, boolean isInFrequencyDomain, IUnit unit) createSamplePDFFromDouble
(double distance, List<Double> values, boolean isInFrequencyDomain, IUnit unit, IRandomGenerator generator) createSamplePDFFromDouble
(double distance, List<Double> samples, IUnit unit) Creates a new SamplePDF instace whose distance is set to 'distance' and whose sampling points are set to samples.createSamplePDFFromDouble
(double distance, List<Double> values, IUnit unit, IRandomGenerator generator) createSamplePDFFromMeasurements
(double distance, List<Double> measurements, IUnit unit) createUnit
(String unitName) Creates new Unit with name unitName.createZeroFunction
(int numOfSamplingPoints, double distance, IUnit unit) creates a distribution function, wich consists of numOfSamplingspoints zeros.void
setRandomGenerator
(IRandomGenerator randomGenerator) Set the random generator to use to the passed one.Converts a arbitrary PDF to a BoxedPDF.Converts a model object to a function object with the same attributes.transformToBoxedPDF
(ProbabilityDensityFunction ePDF, IRandomGenerator randomNumberGenerator) Converts a model object to a function object with the same attributes.Converts a model object to a function object with the same attributes.Converts a function object to a model object with the same attributes.Converts a function object to a model object with the same attributes.Converts a function object to a model object with the same attributes.Converts a function object to a model object with the same attributes.transformToModelSample
(ISample sample) Converts a function object to a model object with the same attributes.Converts a function object to a model object with the same attributes.Converts a function object to a model object with the same attributes.Converts a model object to a function object with the same attributes.transformToPDF
(ProbabilityDensityFunction ePDF, IRandomGenerator randomNumberGenerator) Converts a model object to a function object with the same attributes.Converts a model object to a function object with the same attributes.transformToPMF
(ProbabilityMassFunction ePMF, IRandomGenerator randomNumberGenerator) Converts a model object to a function object with the same attributes.transformToSample
(Sample eSample) Converts a model object to a function object with the same attributes.Converts a arbitrary PDF to a SamplePDF.transformToSamplePDF
(IProbabilityDensityFunction pdf, double newDistance) Converts a arbitrary PDF to a SamplePDF.Converts a model object to a function object with the same attributes.transformToUnit
(String unitSpecification) Converts a model object to a function object with the same attributes.
-
Field Details
-
eINSTANCE
Singleton instance of the factory. TODO: Remove this crap!
-
-
Method Details
-
createContinuousSample
Creates a new ContinuousSample with the attributes value and probability set.- Parameters:
Value
- domain (x) value of the sample.Probability
- range (y) value of the sample.- Returns:
- New ContinuousSample instance.
-
transformToModelContinuousSample
Converts a function object to a model object with the same attributes.- Parameters:
sample
- Object to transform.- Returns:
- New ContinuousSample instance.
-
transformToContinuousSample
Converts a model object to a function object with the same attributes.- Parameters:
eSample
- Object to transform.- Returns:
- New ContinuousSample instance.
-
createSample
Creates a new Sample with the attributes value and probability set.- Parameters:
Value
- domain (x) value of the sample.Probability
- range (y) value of the sample.- Returns:
- New Sample instance.
-
transformToModelSample
Converts a function object to a model object with the same attributes.- Parameters:
sample
- Object to transform.- Returns:
- New Sample instance.
-
transformToSample
Converts a model object to a function object with the same attributes.- Parameters:
eSample
- Object to transform.- Returns:
- New Sample instance.
-
createUnit
Creates new Unit with name unitName.- Parameters:
unitName
- Name of the unit.- Returns:
- New Unit instance.
-
createDefaultUnit
IUnit createDefaultUnit()Creates new Unit with name DEFAULT_UNIT_NAME, which is "ms".- Parameters:
unitName
- Name of the unit.- Returns:
- New Unit instance.
-
transformToModelUnitSpecification
Converts a function object to a model object with the same attributes.- Parameters:
unit
- Object to transform.- Returns:
- New Unit instance.
-
transformToUnit
Converts a model object to a function object with the same attributes.- Parameters:
eUnit
- Object to transform.- Returns:
- New Unit instance.
-
createSamplePDFFromDouble
Creates a new SamplePDF instace whose distance is set to 'distance' and whose sampling points are set to samples. As the sampling points are complex values in general, this function sets only the real part of the values. The imaginary part is set to zero.- Parameters:
distance
- Distance between the sampling points stored in samples.samples
- Sampling points of the approximated PDF.unit
- TODO- Returns:
- New instance of SamplePDF with set attributes.
-
createSamplePDFFromDouble
ISamplePDF createSamplePDFFromDouble(double distance, List<Double> samples, boolean isInFrequencyDomain, IUnit unit) - Parameters:
distance
-samples
-isInFrequencyDomain
-unit
-- Returns:
-
createSamplePDFFromDouble
ISamplePDF createSamplePDFFromDouble(double distance, List<Double> values, IUnit unit, IRandomGenerator generator) - Parameters:
distance
-values
-unit
-generator
-- Returns:
-
createSamplePDFFromDouble
ISamplePDF createSamplePDFFromDouble(double distance, List<Double> values, boolean isInFrequencyDomain, IUnit unit, IRandomGenerator generator) - Parameters:
distance
-values
-isInFrequencyDomain
-unit
-generator
-- Returns:
-
createSamplePDFFromComplex
ISamplePDF createSamplePDFFromComplex(double distance, List<org.apache.commons.math.complex.Complex> samples, IUnit unit) - Parameters:
distance
-samples
-unit
-- Returns:
-
createSamplePDFFromComplex
ISamplePDF createSamplePDFFromComplex(double distance, List<org.apache.commons.math.complex.Complex> samples, IUnit unit, IRandomGenerator generator) - Parameters:
distance
-samples
-unit
-generator
-- Returns:
-
createSamplePDFFromComplex
ISamplePDF createSamplePDFFromComplex(double distance, List<org.apache.commons.math.complex.Complex> samples, boolean isInFrequencyDomain, IUnit unit, IRandomGenerator generator) - Parameters:
distance
-samples
-isInFrequencyDomain
-unit
-generator
-- Returns:
-
createSamplePDFFromComplex
ISamplePDF createSamplePDFFromComplex(double distance, List<org.apache.commons.math.complex.Complex> samples, boolean isInFrequencyDomain, IUnit unit) Creates a new SamplePDF instace whose distance is set to 'distance' and whose sampling points are set to samples.- Parameters:
distance
- Distance between the sampling points stored in samples.samples
- Sampling points of the approximated PDF.isInFrequencyDomain
- Indicates whether the values are in frequency domain (true) or time domain (false).unit
- TODO- Returns:
- New instance of SamplePDF with set attributes.
-
createSamplePDFFromMeasurements
- Parameters:
distance
-measurements
-- Returns:
-
createDiracImpulse
creates a distribution function, wich represents a dirac impulse. The returned function consists of numOfSamplingPoints equidistant points.- Parameters:
numOfSamplingPoints
- number of points.distance
- distance between each two points.unit
- TODO- Returns:
- a new probability density function with entered parameters.
-
createImpulseAt
Creates a distribution function, which describes a random variable with a constant outcome. In this case, it is given by distance * pos.- Parameters:
pos
-numOfSamplingPoints
-distance
-unit
-- Returns:
- a new probability density function with entered parameters.
-
createZeroFunction
creates a distribution function, wich consists of numOfSamplingspoints zeros.- Parameters:
numOfSamplingPoints
- number of points.distance
- distance between each two points.- Returns:
- a new "zeros" DistributionFunction.
-
transformToSamplePDF
Converts a arbitrary PDF to a SamplePDF. So far, only two cases are supported: The input PDF is a SamplePDF, then a reference to the original PDF is returned or the input pdf is a BoxedPDF, then the a new SamplePDF is created from the BoxedPDF.- Parameters:
pdf
- PDF to transform.- Returns:
- Either a reference to the input PDF or a new SamplePDF with the same properties as the input pdf.
- Throws:
UnknownPDFTypeException
- Thrown in case pdf is neither a BoxedPDF nor a SamplePDF.
-
transformToSamplePDF
ISamplePDF transformToSamplePDF(IProbabilityDensityFunction pdf, double newDistance) throws UnknownPDFTypeException, NegativeDistanceException, FunctionNotInTimeDomainException Converts a arbitrary PDF to a SamplePDF. So far, only two cases are supported: The input PDF is a SamplePDF, then a reference to a new Sample PDF with the given distance is returned or the input pdf is a BoxedPDF, then a new SamplePDF is created from the BoxedPDF.- Parameters:
pdf
- PDF to transform.newDistance
- the new distance- Returns:
- Either a reference to the input PDF or a new SamplePDF with the same properties as the input pdf.
- Throws:
UnknownPDFTypeException
- Thrown in case pdf is neither a BoxedPDF nor a SamplePDF.FunctionNotInTimeDomainException
NegativeDistanceException
-
transformToSamplePDF
ISamplePDF transformToSamplePDF(ProbabilityDensityFunction ePDF) throws UnknownPDFTypeException, ProbabilitySumNotOneException, DoubleSampleException Converts a model object to a function object with the same attributes.- Parameters:
ePDF
- Object to transform.- Returns:
- New SamplePDF instance.
- Throws:
UnknownPDFTypeException
- Thrown in case pdf is neither a BoxedPDF nor a SamplePDFDoubleSampleException
ProbabilitySumNotOneException
-
transformToModelSamplePDF
Converts a function object to a model object with the same attributes.- Parameters:
pdf
- Object to transform.- Returns:
- New SamplePDF instance.
- Throws:
UnknownPDFTypeException
-
createBoxedPDF
Creates a new BoxedPDF, whose boxes are defined by 'samples'.- Parameters:
samples
- List of ContinuousSamples, which defines the upper right corners of the PDF's boxes. The list may be unsorted. The values of all samples must be greater or equal to zero.- Returns:
- New BoxedPDF instance.
- Throws:
ProbabilitySumNotOneException
DoubleSampleException
-
transformToBoxedPDF
IBoxedPDF transformToBoxedPDF(IProbabilityDensityFunction pdf) throws UnknownPDFTypeException, ProbabilitySumNotOneException, DoubleSampleException, FunctionNotInTimeDomainException Converts a arbitrary PDF to a BoxedPDF. So far, only two cases are supported: The input PDF is a BoxedPDF, then a reference to the original PDF is returned or the input pdf is a SamplePDF, then the a new BoxedPDF is created from the SamplePDF.- Parameters:
pdf
- PDF to transform.- Returns:
- Either a reference to the input PDF or a new BoxedPDF with the same properties as the input pdf.
- Throws:
UnknownPDFTypeException
- Thrown in case pdf is neither a BoxedPDF nor a SamplePDF.DoubleSampleException
ProbabilitySumNotOneException
FunctionNotInTimeDomainException
-
transformToBoxedPDF
IBoxedPDF transformToBoxedPDF(ProbabilityDensityFunction ePDF) throws ProbabilitySumNotOneException, DoubleSampleException Converts a model object to a function object with the same attributes.- Parameters:
ePDF
- Object to transform.- Returns:
- New BoxedPDF instance.
- Throws:
DoubleSampleException
ProbabilitySumNotOneException
-
transformToBoxedPDF
IBoxedPDF transformToBoxedPDF(ProbabilityDensityFunction ePDF, IRandomGenerator randomNumberGenerator) throws ProbabilitySumNotOneException, DoubleSampleException Converts a model object to a function object with the same attributes.- Parameters:
ePDF
- Object to transform.randomNumberGenerator
- Number generator to use- Returns:
- New BoxedPDF instance.
- Throws:
DoubleSampleException
ProbabilitySumNotOneException
-
transformToModelBoxedPDF
BoxedPDF transformToModelBoxedPDF(IProbabilityDensityFunction pdf) throws UnknownPDFTypeException, ProbabilitySumNotOneException, DoubleSampleException, FunctionNotInTimeDomainException Converts a function object to a model object with the same attributes.- Parameters:
pdf
- Object to transform.- Returns:
- New BoxedPDF instance.
- Throws:
DoubleSampleException
ProbabilitySumNotOneException
FunctionNotInTimeDomainException
UnknownPDFTypeException
-
createProbabilityMassFunction
IProbabilityMassFunction createProbabilityMassFunction(List<ISample> samples, IUnit unit, boolean hasOrderedDomain) Creates a new ProbabilityMassFunction whose samples are set to 'samples'. If the samples are marked as ordered, they will be sorted and stochastic values such as median and percentile are available.- Parameters:
samples
- List of samples for the PMF.hasOrderedDomain
- Marks a set as ordered.- Returns:
- New ProbabilityMassFunction instance.
-
createPMFFromMeasurements
IProbabilityMassFunction createPMFFromMeasurements(Double[] measurements, double epsilon, IUnit unit, boolean hasOrderedDomain) - Parameters:
measurements
-unit
-hasOrderedDomain
-- Returns:
-
createPMFFromMeasurements
IProbabilityMassFunction createPMFFromMeasurements(Integer[] measurements, IUnit unit, boolean hasOrderedDomain) - Parameters:
measurements
-unit
-hasOrderedDomain
-- Returns:
-
createPMFFromMeasurements
IProbabilityMassFunction createPMFFromMeasurements(String[] measurements, IUnit unit, boolean hasOrderedDomain) - Parameters:
measurements
-unit
-hasOrderedDomain
-- Returns:
-
createPMFFromMeasurements
IProbabilityMassFunction createPMFFromMeasurements(Boolean[] measurements, IUnit unit, boolean hasOrderedDomain) - Parameters:
measurements
-unit
-hasOrderedDomain
-- Returns:
-
transformToPMF
Converts a model object to a function object with the same attributes.- Parameters:
ePMF
- Object to transform.- Returns:
- New ProbabilityMassFunction instance.
-
transformToPMF
IProbabilityMassFunction transformToPMF(ProbabilityMassFunction ePMF, IRandomGenerator randomNumberGenerator) Converts a model object to a function object with the same attributes.- Parameters:
ePMF
- Object to transform.- Returns:
- New ProbabilityMassFunction instance.
-
transformToModelPMF
Converts a function object to a model object with the same attributes.- Parameters:
pmf
- Object to transform.- Returns:
- New ProbabilityMassFunction instance.
-
transformToPDF
IProbabilityDensityFunction transformToPDF(ProbabilityDensityFunction ePDF) throws UnknownPDFTypeException, ProbabilitySumNotOneException, DoubleSampleException Converts a model object to a function object with the same attributes. (BoxedPDF -> IBoxedPDF, SamplePDF -> ISamplePDF)- Parameters:
ePDF
- Object to transform.- Returns:
- New ProbabilityDensityFunction instance.
- Throws:
DoubleSampleException
ProbabilitySumNotOneException
UnknownPDFTypeException
-
transformToPDF
IProbabilityDensityFunction transformToPDF(ProbabilityDensityFunction ePDF, IRandomGenerator randomNumberGenerator) throws UnknownPDFTypeException, ProbabilitySumNotOneException, DoubleSampleException Converts a model object to a function object with the same attributes. (BoxedPDF -> IBoxedPDF, SamplePDF -> ISamplePDF)- Parameters:
ePDF
- Object to transform.- Returns:
- New ProbabilityDensityFunction instance.
- Throws:
DoubleSampleException
ProbabilitySumNotOneException
UnknownPDFTypeException
-
transformToModelPDF
ProbabilityDensityFunction transformToModelPDF(IProbabilityDensityFunction pdf) throws UnknownPDFTypeException, DoubleSampleException, FunctionNotInTimeDomainException Converts a function object to a model object with the same attributes.- Parameters:
pdf
- Object to transform.- Returns:
- New ProbabilityDensityFunction instance.
- Throws:
DoubleSampleException
FunctionNotInTimeDomainException
ProbabilitySumNotOneException
UnknownPDFTypeException
-
setRandomGenerator
Set the random generator to use to the passed one. If this method is never called, theDefaultRandomGenerator
is used. This method can be called at any time, however, to get consistent results it should be called before retrieving any functions from this factory.- Parameters:
randomGenerator
-
-
getRandomGenerator
IRandomGenerator getRandomGenerator() -
getPDFFactory
IPDFFactory getPDFFactory()
-