Package org.arakhne.afc.math.stochastic
Class StochasticLaw
- java.lang.Object
-
- org.arakhne.afc.math.stochastic.StochasticLaw
-
- All Implemented Interfaces:
MathFunction
,MathInversableFunction
,JsonableObject
- Direct Known Subclasses:
BernoulliStochasticLaw
,CauchyStochasticLaw
,ConstantStochasticLaw
,ExponentialStochasticLaw
,GaussianStochasticLaw
,LinearStochasticLaw
,LogisticStochasticLaw
,LogNormalStochasticLaw
,ParetoStochasticLaw
,TriangularStochasticLaw
,UniformStochasticLaw
public abstract class StochasticLaw extends Object implements MathInversableFunction, JsonableObject
Abstract implementation of a stochastic law that provides the bounds of a law.- Since:
- 13.0
- Version:
- 17.0 2020-01-04 14:41:41
- Author:
- Christophe BOHRHAUER
- Maven Group Id:
- org.arakhne.afc.core
- Maven Artifact Id:
- mathstochastic
-
-
Constructor Summary
Constructors Constructor Description StochasticLaw()
Construct a stochastic law.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description double
generateRandomValue()
Replies a random value that respect the current stochastic law.protected String
getLawName()
Replies the name of the law.abstract double
inverseF(double u)
Replies the x according to the value of the inverted cummulative distribution functionF<sup>-1</sup>(u)
whereu = U(0, 1)
.protected double
inverseF(Random u)
Replies the x according to the value of the inverted cummulative distribution functionF<sup>-1</sup>(u)
whereu = U(0, 1)
.protected static boolean
paramBoolean(String paramName, Map<String,String> parameters)
Extract a parameter value from a map of parameters.protected static double
paramDouble(String paramName, Map<String,String> parameters)
Extract a parameter value from a map of parameters.String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.arakhne.afc.vmutil.json.JsonableObject
toJson
-
Methods inherited from interface org.arakhne.afc.math.stochastic.MathFunction
f, getRange
-
-
-
-
Field Detail
-
NAME_NAME
protected static final String NAME_NAME
Name of the property that contains the law's name.- See Also:
- Constant Field Values
-
-
Method Detail
-
getLawName
protected String getLawName()
Replies the name of the law.- Returns:
- the name.
-
paramDouble
@Pure protected static double paramDouble(String paramName, Map<String,String> parameters) throws LawParameterNotFoundException
Extract a parameter value from a map of parameters.- Parameters:
paramName
- is the nameof the parameter to extract.parameters
- is the map of available parameters- Returns:
- the extract value
- Throws:
LawParameterNotFoundException
- if the parameter was not found or the value is not a double.
-
paramBoolean
@Pure protected static boolean paramBoolean(String paramName, Map<String,String> parameters) throws LawParameterNotFoundException
Extract a parameter value from a map of parameters.- Parameters:
paramName
- is the nameof the parameter to extract.parameters
- is the map of available parameters- Returns:
- the extract value
- Throws:
LawParameterNotFoundException
- if the parameter was not found or the value is not a double.
-
generateRandomValue
public double generateRandomValue() throws MathException
Replies a random value that respect the current stochastic law.- Returns:
- a value depending of the stochastic law parameters
- Throws:
MathException
- when error in math definition.
-
inverseF
protected double inverseF(Random u) throws MathException
Replies the x according to the value of the inverted cummulative distribution functionF<sup>-1</sup>(u)
whereu = U(0, 1)
.- Parameters:
u
- is the uniform random variable generatorU(0, 1)
.- Returns:
F<sup>-1</sup>(u)
- Throws:
MathException
- in caseF<sup>-1</sup>(u)
could not be computed
-
inverseF
@Pure public abstract double inverseF(double u) throws MathException
Replies the x according to the value of the inverted cummulative distribution functionF<sup>-1</sup>(u)
whereu = U(0, 1)
.- Specified by:
inverseF
in interfaceMathInversableFunction
- Parameters:
u
- is a value given by the uniform random variable generatorU(0, 1)
.- Returns:
F<sup>-1</sup>(u)
- Throws:
MathException
- in caseF<sup>-1</sup>(u)
could not be computed
-
-