SUMO - Simulation of Urban MObility
Distribution_Parameterized.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2018 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
16 // A distribution described by parameters such as the mean value and std-dev
17 /****************************************************************************/
18 #ifndef Distribution_MeanDev_h
19 #define Distribution_MeanDev_h
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
27 #include <vector>
28 #include <random>
29 #include "Distribution.h"
30 
31 
32 // ===========================================================================
33 // class definitions
34 // ===========================================================================
43  public Distribution {
44 public:
46  Distribution_Parameterized(const std::string& id, double mean,
47  double deviation);
48 
50  Distribution_Parameterized(const std::string& id, double mean,
51  double deviation, double min, double max);
52 
55 
57  void parse(const std::string& description);
58 
66  double sample(std::mt19937* which = 0) const;
67 
69  double getMax() const;
70 
72  std::vector<double>& getParameter() {
73  return myParameter;
74  }
75 
77  const std::vector<double>& getParameter() const {
78  return myParameter;
79  }
80 
82  bool isValid(std::string& error);
83 
85  std::string toStr(std::streamsize accuracy) const;
86 
87 private:
89  std::vector<double> myParameter;
90 
91 };
92 
93 
94 #endif
95 
96 /****************************************************************************/
97 
std::vector< double > myParameter
The distribution&#39;s parameters.
std::vector< double > & getParameter()
Returns the parameters of this distribution.
double getMax() const
Returns the maximum value of this distribution.
void parse(const std::string &description)
Overwrite by parsable distribution description.
virtual ~Distribution_Parameterized()
Destructor.
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.
double sample(std::mt19937 *which=0) const
Draw a sample of the distribution.
const std::vector< double > & getParameter() const
Returns the unmodifiable parameters of this distribution.
bool isValid(std::string &error)
check whether the distribution is valid