 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
60 const std::string distName = description.substr(0, description.find(
'('));
61 if (distName ==
"norm" || distName ==
"normc") {
62 std::vector<std::string> params =
StringTokenizer(description.substr(distName.size() + 1, description.size() - distName.size() - 2),
',').
getVector();
76 throw ProcessError(
"Invalid format of distribution parameterized");
78 WRITE_ERROR(
"Invalid format of distribution parameterized");
92 const double max =
getMax();
93 while (val < min || val > max) {
116 const std::vector<double>&
virtual ~Distribution_Parameterized()
Destructor.
double sample(std::mt19937 *which=0) const
Draw a sample of the distribution.
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter
bool isValid(std::string &error)
check whether the distribution is valid
static double randNorm(double mean, double variance, std::mt19937 *rng=0)
Access to a random number from a normal distribution.
std::vector< double > myParameter
The distribution's parameters.
std::vector< double > & getParameter()
Returns the parameters of this distribution.
double getMax() const
Returns the maximum value of this distribution.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
std::string toStr(std::streamsize accuracy) const
Returns the string representation of this distribution.
Distribution_Parameterized(const std::string &id, double mean, double deviation)
Constructor for standard normal distribution.
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
std::vector< std::string > getVector()
return vector of strings
void parse(const std::string &description, const bool hardFail)
Overwrite by parsable distribution description.
std::string myID
The name of the object.
void setID(const std::string &newID)
resets the id