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
Fields Modifier and Type Field Description static IProbabilityFunctionFactory
eINSTANCE
Singleton instance of the factory.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description IBoxedPDF
createBoxedPDF(List<IContinuousSample> samples, IUnit unit)
Creates a new BoxedPDF, whose boxes are defined by 'samples'.IContinuousSample
createContinuousSample(double value, double probability)
Creates a new ContinuousSample with the attributes value and probability set.IUnit
createDefaultUnit()
Creates new Unit with name DEFAULT_UNIT_NAME, which is "ms".ISamplePDF
createDiracImpulse(int numOfSamplingPoints, double distance, IUnit unit)
creates a distribution function, wich represents a dirac impulse.ISamplePDF
createImpulseAt(int pos, int numOfSamplingPoints, double distance, IUnit unit)
Creates a distribution function, which describes a random variable with a constant outcome.IProbabilityMassFunction
createPMFFromMeasurements(Boolean[] measurements, IUnit unit, boolean hasOrderedDomain)
IProbabilityMassFunction
createPMFFromMeasurements(Double[] measurements, double epsilon, IUnit unit, boolean hasOrderedDomain)
IProbabilityMassFunction
createPMFFromMeasurements(Integer[] measurements, IUnit unit, boolean hasOrderedDomain)
IProbabilityMassFunction
createPMFFromMeasurements(String[] measurements, IUnit unit, boolean hasOrderedDomain)
IProbabilityMassFunction
createProbabilityMassFunction(List<ISample> samples, IUnit unit, boolean hasOrderedDomain)
Creates a new ProbabilityMassFunction whose samples are set to 'samples'.ISample
createSample(Object value, double probability)
Creates a new Sample with the attributes value and probability set.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.ISamplePDF
createSamplePDFFromComplex(double distance, List<org.apache.commons.math.complex.Complex> samples, boolean isInFrequencyDomain, IUnit unit, IRandomGenerator generator)
ISamplePDF
createSamplePDFFromComplex(double distance, List<org.apache.commons.math.complex.Complex> samples, IUnit unit)
ISamplePDF
createSamplePDFFromComplex(double distance, List<org.apache.commons.math.complex.Complex> samples, IUnit unit, IRandomGenerator generator)
ISamplePDF
createSamplePDFFromDouble(double distance, List<Double> samples, boolean isInFrequencyDomain, IUnit unit)
ISamplePDF
createSamplePDFFromDouble(double distance, List<Double> values, boolean isInFrequencyDomain, IUnit unit, IRandomGenerator generator)
ISamplePDF
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.ISamplePDF
createSamplePDFFromDouble(double distance, List<Double> values, IUnit unit, IRandomGenerator generator)
ISamplePDF
createSamplePDFFromMeasurements(double distance, List<Double> measurements, IUnit unit)
IUnit
createUnit(String unitName)
Creates new Unit with name unitName.ISamplePDF
createZeroFunction(int numOfSamplingPoints, double distance, IUnit unit)
creates a distribution function, wich consists of numOfSamplingspoints zeros.IPDFFactory
getPDFFactory()
IRandomGenerator
getRandomGenerator()
void
setRandomGenerator(IRandomGenerator randomGenerator)
Set the random generator to use to the passed one.IBoxedPDF
transformToBoxedPDF(IProbabilityDensityFunction pdf)
Converts a arbitrary PDF to a BoxedPDF.IBoxedPDF
transformToBoxedPDF(ProbabilityDensityFunction ePDF)
Converts a model object to a function object with the same attributes.IBoxedPDF
transformToBoxedPDF(ProbabilityDensityFunction ePDF, IRandomGenerator randomNumberGenerator)
Converts a model object to a function object with the same attributes.IContinuousSample
transformToContinuousSample(ContinuousSample eSample)
Converts a model object to a function object with the same attributes.BoxedPDF
transformToModelBoxedPDF(IProbabilityDensityFunction pdf)
Converts a function object to a model object with the same attributes.ContinuousSample
transformToModelContinuousSample(IContinuousSample sample)
Converts a function object to a model object with the same attributes.ProbabilityDensityFunction
transformToModelPDF(IProbabilityDensityFunction pdf)
Converts a function object to a model object with the same attributes.ProbabilityMassFunction
transformToModelPMF(IProbabilityMassFunction pmf)
Converts a function object to a model object with the same attributes.Sample
transformToModelSample(ISample sample)
Converts a function object to a model object with the same attributes.SamplePDF
transformToModelSamplePDF(IProbabilityDensityFunction pdf)
Converts a function object to a model object with the same attributes.String
transformToModelUnitSpecification(IUnit unit)
Converts a function object to a model object with the same attributes.IProbabilityDensityFunction
transformToPDF(ProbabilityDensityFunction ePDF)
Converts a model object to a function object with the same attributes.IProbabilityDensityFunction
transformToPDF(ProbabilityDensityFunction ePDF, IRandomGenerator randomNumberGenerator)
Converts a model object to a function object with the same attributes.IProbabilityMassFunction
transformToPMF(ProbabilityMassFunction ePMF)
Converts a model object to a function object with the same attributes.IProbabilityMassFunction
transformToPMF(ProbabilityMassFunction ePMF, IRandomGenerator randomNumberGenerator)
Converts a model object to a function object with the same attributes.ISample
transformToSample(Sample eSample)
Converts a model object to a function object with the same attributes.ISamplePDF
transformToSamplePDF(IProbabilityDensityFunction pdf)
Converts a arbitrary PDF to a SamplePDF.ISamplePDF
transformToSamplePDF(IProbabilityDensityFunction pdf, double newDistance)
Converts a arbitrary PDF to a SamplePDF.ISamplePDF
transformToSamplePDF(ProbabilityDensityFunction ePDF)
Converts a model object to a function object with the same attributes.IUnit
transformToUnit(String unitSpecification)
Converts a model object to a function object with the same attributes.
-
-
-
Field Detail
-
eINSTANCE
static final IProbabilityFunctionFactory eINSTANCE
Singleton instance of the factory. TODO: Remove this crap!
-
-
Method Detail
-
createContinuousSample
IContinuousSample createContinuousSample(double value, double probability)
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
ContinuousSample transformToModelContinuousSample(IContinuousSample sample)
Converts a function object to a model object with the same attributes.- Parameters:
sample
- Object to transform.- Returns:
- New ContinuousSample instance.
-
transformToContinuousSample
IContinuousSample transformToContinuousSample(ContinuousSample eSample)
Converts a model object to a function object with the same attributes.- Parameters:
eSample
- Object to transform.- Returns:
- New ContinuousSample instance.
-
createSample
ISample createSample(Object value, double probability)
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
Sample transformToModelSample(ISample sample)
Converts a function object to a model object with the same attributes.- Parameters:
sample
- Object to transform.- Returns:
- New Sample instance.
-
transformToSample
ISample transformToSample(Sample eSample)
Converts a model object to a function object with the same attributes.- Parameters:
eSample
- Object to transform.- Returns:
- New Sample instance.
-
createUnit
IUnit createUnit(String unitName)
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
String transformToModelUnitSpecification(IUnit unit)
Converts a function object to a model object with the same attributes.- Parameters:
unit
- Object to transform.- Returns:
- New Unit instance.
-
transformToUnit
IUnit transformToUnit(String unitSpecification)
Converts a model object to a function object with the same attributes.- Parameters:
eUnit
- Object to transform.- Returns:
- New Unit instance.
-
createSamplePDFFromDouble
ISamplePDF 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. 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
ISamplePDF createSamplePDFFromMeasurements(double distance, List<Double> measurements, IUnit unit)
- Parameters:
distance
-measurements
-- Returns:
-
createDiracImpulse
ISamplePDF createDiracImpulse(int numOfSamplingPoints, double distance, IUnit unit)
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
ISamplePDF createImpulseAt(int pos, int numOfSamplingPoints, double distance, IUnit unit)
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
ISamplePDF createZeroFunction(int numOfSamplingPoints, double distance, IUnit unit)
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
ISamplePDF transformToSamplePDF(IProbabilityDensityFunction pdf) throws UnknownPDFTypeException
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
SamplePDF transformToModelSamplePDF(IProbabilityDensityFunction pdf) throws UnknownPDFTypeException
Converts a function object to a model object with the same attributes.- Parameters:
pdf
- Object to transform.- Returns:
- New SamplePDF instance.
- Throws:
UnknownPDFTypeException
-
createBoxedPDF
IBoxedPDF createBoxedPDF(List<IContinuousSample> samples, IUnit unit) throws DoubleSampleException
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
IProbabilityMassFunction transformToPMF(ProbabilityMassFunction ePMF)
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
ProbabilityMassFunction transformToModelPMF(IProbabilityMassFunction pmf)
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
void setRandomGenerator(IRandomGenerator randomGenerator)
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()
-
-