1 | /*
|
---|
2 | * RandomNumberDistribution_Parameters.hpp
|
---|
3 | *
|
---|
4 | * Created on: Jan 6, 2011
|
---|
5 | * Author: heber
|
---|
6 | */
|
---|
7 |
|
---|
8 | #ifndef RANDOMNUMBERDISTRIBUTION_PARAMETERS_HPP_
|
---|
9 | #define RANDOMNUMBERDISTRIBUTION_PARAMETERS_HPP_
|
---|
10 |
|
---|
11 | // include config.h
|
---|
12 | #ifdef HAVE_CONFIG_H
|
---|
13 | #include <config.h>
|
---|
14 | #endif
|
---|
15 |
|
---|
16 | #include <iosfwd>
|
---|
17 | #include <map>
|
---|
18 |
|
---|
19 | class RandomNumberDistribution;
|
---|
20 |
|
---|
21 | struct RandomNumberDistribution_Parameters
|
---|
22 | {
|
---|
23 | /** Constructor of class RandomNumberDistribution_Parameters.
|
---|
24 | *
|
---|
25 | * @note sets all values to noset_value.
|
---|
26 | */
|
---|
27 | RandomNumberDistribution_Parameters();
|
---|
28 |
|
---|
29 | /** Copy constructor of class RandomNumberDistribution_Parameters.
|
---|
30 | *
|
---|
31 | *
|
---|
32 | * @param _ref reference to instance to copy
|
---|
33 | */
|
---|
34 | RandomNumberDistribution_Parameters(const RandomNumberDistribution_Parameters &_ref);
|
---|
35 |
|
---|
36 | /** Destructor of class RandomNumberDistribution_Parameters.
|
---|
37 | *
|
---|
38 | */
|
---|
39 | ~RandomNumberDistribution_Parameters();
|
---|
40 |
|
---|
41 | enum ParamList {
|
---|
42 | param_min,
|
---|
43 | param_max,
|
---|
44 | param_p,
|
---|
45 | param_t,
|
---|
46 | param_median,
|
---|
47 | param_sigma,
|
---|
48 | param_alpha,
|
---|
49 | param_mean,
|
---|
50 | param_a,
|
---|
51 | param_b,
|
---|
52 | param_c,
|
---|
53 | param_lambda
|
---|
54 | };
|
---|
55 |
|
---|
56 | /** This value is chosen such that no parameter can have it as a sensible
|
---|
57 | * value.
|
---|
58 | */
|
---|
59 | static const double noset_value;
|
---|
60 |
|
---|
61 | /** Fills the structure from the parameters obtained from \a _distribution.
|
---|
62 | *
|
---|
63 | * @param _distribution
|
---|
64 | */
|
---|
65 | void getParameters(const RandomNumberDistribution* const _distribution);
|
---|
66 |
|
---|
67 | /** Merges this parameter set with another, where other has priority.
|
---|
68 | *
|
---|
69 | * @note we ignore entries in \a _params with noset_value.
|
---|
70 | *
|
---|
71 | * @param _params other parameter set to update with
|
---|
72 | */
|
---|
73 | void update(const RandomNumberDistribution_Parameters &_params);
|
---|
74 |
|
---|
75 | /** Checks whether all parameters are set to noset_value values.
|
---|
76 | *
|
---|
77 | * noset_value
|
---|
78 | *
|
---|
79 | * @return true - all are equal noset_value,
|
---|
80 | * false - at least is not equal noset_value
|
---|
81 | */
|
---|
82 | bool isDefault() const;
|
---|
83 |
|
---|
84 | double min; //!< minimum of distribution
|
---|
85 | double max; //!< minimum of distribution
|
---|
86 | double p; //!< probability of distribution
|
---|
87 | double t; //!< parameter t of distribution
|
---|
88 | double median; //!< median of distribution
|
---|
89 | double sigma; //!< sigma width of distribution
|
---|
90 | double alpha; //!< parameter alpha of distribution
|
---|
91 | double mean; //!< mean of distribution
|
---|
92 | double a; //!< triangle parameter a
|
---|
93 | double b; //!< triangle parameter b
|
---|
94 | double c; //!< triangle parameter c
|
---|
95 | double lambda; //!< exponential decay parameter of distribution
|
---|
96 |
|
---|
97 | typedef std::map<
|
---|
98 | std::string,
|
---|
99 | ParamList
|
---|
100 | > ParamNames;
|
---|
101 |
|
---|
102 | static ParamNames params;
|
---|
103 | };
|
---|
104 |
|
---|
105 | std::ostream & operator << (std::ostream& ost, const RandomNumberDistribution_Parameters ¶ms);
|
---|
106 | std::istream & operator >> (std::istream& ist, RandomNumberDistribution_Parameters ¶ms);
|
---|
107 |
|
---|
108 | #endif /* RANDOMNUMBERDISTRIBUTION_PARAMETERS_HPP_ */
|
---|