Eclipse 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-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
19 // A distribution described by parameters such as the mean value and std-dev
20 /****************************************************************************/
21 #pragma once
22 #include <config.h>
23 
24 #include <vector>
25 #include <random>
26 
27 #include "Distribution.h"
28 
29 
30 // ===========================================================================
31 // class definitions
32 // ===========================================================================
41 
42 public:
44  Distribution_Parameterized(const std::string& id, double mean, double deviation);
45 
47  Distribution_Parameterized(const std::string& id, double mean, double deviation, double min, double max);
48 
51 
53  void parse(const std::string& description, const bool hardFail);
54 
62  double sample(std::mt19937* which = 0) const;
63 
65  double getMax() const;
66 
68  std::vector<double>& getParameter();
69 
71  const std::vector<double>& getParameter() const;
72 
74  bool isValid(std::string& error);
75 
77  std::string toStr(std::streamsize accuracy) const;
78 
79 private:
81  std::vector<double> myParameter;
82 };
void parse(const std::string &description, const bool hardFail)
Overwrite by parsable distribution description.
virtual ~Distribution_Parameterized()
Destructor.
double getMax() const
Returns the maximum value of this distribution.
std::string toStr(std::streamsize accuracy) const
Returns the string representation of this distribution.
double sample(std::mt19937 *which=0) const
Draw a sample of the distribution.
std::vector< double > & getParameter()
Returns the parameters of this distribution.
bool isValid(std::string &error)
check whether the distribution is valid
Distribution_Parameterized(const std::string &id, double mean, double deviation)
Constructor for standard normal distribution.
std::vector< double > myParameter
The distribution's parameters.