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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
18 // A distribution described by parameters such as the mean value and std-dev
19 /****************************************************************************/
20 #ifndef Distribution_MeanDev_h
21 #define Distribution_MeanDev_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include <vector>
34 #include <random>
35 #include "Distribution.h"
36 
37 
38 // ===========================================================================
39 // class definitions
40 // ===========================================================================
49  public Distribution {
50 public:
52  Distribution_Parameterized(const std::string& id, double mean,
53  double deviation);
54 
56  Distribution_Parameterized(const std::string& id, double mean,
57  double deviation, double min, double max);
58 
61 
63  void parse(const std::string& description);
64 
72  double sample(std::mt19937* which = 0) const;
73 
75  double getMax() const;
76 
78  std::vector<double>& getParameter() {
79  return myParameter;
80  }
81 
83  const std::vector<double>& getParameter() const {
84  return myParameter;
85  }
86 
88  std::string toStr(std::streamsize accuracy) const;
89 
90 private:
92  std::vector<double> myParameter;
93 
94 };
95 
96 
97 #endif
98 
99 /****************************************************************************/
100 
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.