author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Sat, 04 Jul 2009 08:15:48 +0200 | |
changeset 4654 | 2eaebe77d66b |
parent 4640 | 77dd5c573116 |
permissions | -rw-r--r-- |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
2 |
// |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
3 |
// Copyright (c) 2006 Georgia Tech Research Corporation |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
4 |
// |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
5 |
// This program is free software; you can redistribute it and/or modify |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
6 |
// it under the terms of the GNU General Public License version 2 as |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
7 |
// published by the Free Software Foundation; |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
8 |
// |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
9 |
// This program is distributed in the hope that it will be useful, |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
10 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
11 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
12 |
// GNU General Public License for more details. |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
13 |
// |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
14 |
// You should have received a copy of the GNU General Public License |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
15 |
// along with this program; if not, write to the Free Software |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
16 |
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
17 |
// |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
18 |
// Author: Rajib Bhattacharjea<raj.b@gatech.edu> |
4218
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
19 |
// Author: Hadi Arbabi<marbabi@cs.odu.edu> |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
20 |
// |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
21 |
|
4218
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
22 |
#ifndef __random_variable_h |
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
23 |
#define __random_variable_h |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
24 |
|
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
25 |
#include <vector> |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
26 |
#include <algorithm> |
676
0cf407300fa6
Fixed the problems that were found by Mathieu Lacage in the first
Emmanuelle Laprise
parents:
675
diff
changeset
|
27 |
#include <stdint.h> |
2409
8744ec60e8e6
convert RandomVariable, Rectangle, Vector, and Time to the new Class Helper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2408
diff
changeset
|
28 |
#include <istream> |
8744ec60e8e6
convert RandomVariable, Rectangle, Vector, and Time to the new Class Helper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2408
diff
changeset
|
29 |
#include <ostream> |
2438
e2ac9f9aeeb9
value.h -> attribute.h
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2437
diff
changeset
|
30 |
#include "attribute.h" |
2451
8979f07befd5
value-helper.h -> attribute-helper.h
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2445
diff
changeset
|
31 |
#include "attribute-helper.h" |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
32 |
|
396
7b4349cd88bc
add a randomvariable group
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
364
diff
changeset
|
33 |
/** |
2217 | 34 |
* \ingroup core |
396
7b4349cd88bc
add a randomvariable group
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
364
diff
changeset
|
35 |
* \defgroup randomvariable Random Variable Distributions |
7b4349cd88bc
add a randomvariable group
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
364
diff
changeset
|
36 |
* |
7b4349cd88bc
add a randomvariable group
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
364
diff
changeset
|
37 |
*/ |
7b4349cd88bc
add a randomvariable group
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
364
diff
changeset
|
38 |
|
4317
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
39 |
namespace ns3 { |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
40 |
|
2336
28ce210b91bb
bug 133: automate RandomVariable memory management.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2217
diff
changeset
|
41 |
class RandomVariableBase; |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
42 |
|
4218
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
43 |
class SeedManager |
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
44 |
{ |
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
45 |
public: |
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
46 |
|
4224
40e5d5af3c71
Commit Mathieu's coding style cleanup of random-variable
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
4223
diff
changeset
|
47 |
/** |
40e5d5af3c71
Commit Mathieu's coding style cleanup of random-variable
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
4223
diff
changeset
|
48 |
* \brief set the seed |
40e5d5af3c71
Commit Mathieu's coding style cleanup of random-variable
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
4223
diff
changeset
|
49 |
* it will duplicate the seed value 6 times |
40e5d5af3c71
Commit Mathieu's coding style cleanup of random-variable
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
4223
diff
changeset
|
50 |
* \code |
40e5d5af3c71
Commit Mathieu's coding style cleanup of random-variable
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
4223
diff
changeset
|
51 |
* SeedManger::SetSeed(15); |
40e5d5af3c71
Commit Mathieu's coding style cleanup of random-variable
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
4223
diff
changeset
|
52 |
* UniformVariable x(2,3); //these will give the same output everytime |
40e5d5af3c71
Commit Mathieu's coding style cleanup of random-variable
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
4223
diff
changeset
|
53 |
* ExponentialVariable y(120); //as long as the seed stays the same |
40e5d5af3c71
Commit Mathieu's coding style cleanup of random-variable
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
4223
diff
changeset
|
54 |
* \endcode |
40e5d5af3c71
Commit Mathieu's coding style cleanup of random-variable
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
4223
diff
changeset
|
55 |
* \param seed |
4247
d1b2785e4509
clarify the working between SeedManager set/get seed and the underlying package seed, in comments
Tom Henderson <tomh@tomh.org>
parents:
4242
diff
changeset
|
56 |
* |
d1b2785e4509
clarify the working between SeedManager set/get seed and the underlying package seed, in comments
Tom Henderson <tomh@tomh.org>
parents:
4242
diff
changeset
|
57 |
* Note, while the underlying RNG takes six integer values as a seed; |
d1b2785e4509
clarify the working between SeedManager set/get seed and the underlying package seed, in comments
Tom Henderson <tomh@tomh.org>
parents:
4242
diff
changeset
|
58 |
* it is sufficient to set these all to the same integer, so we provide |
d1b2785e4509
clarify the working between SeedManager set/get seed and the underlying package seed, in comments
Tom Henderson <tomh@tomh.org>
parents:
4242
diff
changeset
|
59 |
* a simpler interface here that just takes one integer. |
4224
40e5d5af3c71
Commit Mathieu's coding style cleanup of random-variable
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
4223
diff
changeset
|
60 |
*/ |
40e5d5af3c71
Commit Mathieu's coding style cleanup of random-variable
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
4223
diff
changeset
|
61 |
static void SetSeed (uint32_t seed); |
4218
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
62 |
|
4224
40e5d5af3c71
Commit Mathieu's coding style cleanup of random-variable
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
4223
diff
changeset
|
63 |
/** |
40e5d5af3c71
Commit Mathieu's coding style cleanup of random-variable
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
4223
diff
changeset
|
64 |
* \brief Get the seed value |
4234
7ec503ed040d
Almost have env variable support for RNG right
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
4229
diff
changeset
|
65 |
* \return the seed value |
4247
d1b2785e4509
clarify the working between SeedManager set/get seed and the underlying package seed, in comments
Tom Henderson <tomh@tomh.org>
parents:
4242
diff
changeset
|
66 |
* |
d1b2785e4509
clarify the working between SeedManager set/get seed and the underlying package seed, in comments
Tom Henderson <tomh@tomh.org>
parents:
4242
diff
changeset
|
67 |
* Note: returns the first of the six seed values used in the underlying RNG |
4224
40e5d5af3c71
Commit Mathieu's coding style cleanup of random-variable
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
4223
diff
changeset
|
68 |
*/ |
4234
7ec503ed040d
Almost have env variable support for RNG right
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
4229
diff
changeset
|
69 |
static uint32_t GetSeed (); |
4218
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
70 |
|
4224
40e5d5af3c71
Commit Mathieu's coding style cleanup of random-variable
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
4223
diff
changeset
|
71 |
/** |
4218
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
72 |
* \brief Set the run number of simulation |
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
73 |
* |
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
74 |
* \code |
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
75 |
* SeedManager::SetSeed(12); |
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
76 |
* int N = atol(argv[1]); //read in run number from command line |
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
77 |
* SeedManager::SetRun(N); |
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
78 |
* UniformVariable x(0,10); |
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
79 |
* ExponentialVariable y(2902); |
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
80 |
* \endcode |
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
81 |
* In this example, N could successivly be equal to 1,2,3, etc. and the user |
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
82 |
* would continue to get independent runs out of the single simulation. For |
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
83 |
* this simple example, the following might work: |
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
84 |
* \code |
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
85 |
* ./simulation 0 |
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
86 |
* ...Results for run 0:... |
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
87 |
* |
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
88 |
* ./simulation 1 |
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
89 |
* ...Results for run 1:... |
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
90 |
* \endcode |
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
91 |
*/ |
4224
40e5d5af3c71
Commit Mathieu's coding style cleanup of random-variable
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
4223
diff
changeset
|
92 |
static void SetRun (uint32_t run); |
40e5d5af3c71
Commit Mathieu's coding style cleanup of random-variable
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
4223
diff
changeset
|
93 |
/** |
40e5d5af3c71
Commit Mathieu's coding style cleanup of random-variable
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
4223
diff
changeset
|
94 |
* \returns the current run number |
40e5d5af3c71
Commit Mathieu's coding style cleanup of random-variable
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
4223
diff
changeset
|
95 |
* @sa SetRun |
40e5d5af3c71
Commit Mathieu's coding style cleanup of random-variable
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
4223
diff
changeset
|
96 |
*/ |
40e5d5af3c71
Commit Mathieu's coding style cleanup of random-variable
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
4223
diff
changeset
|
97 |
static uint32_t GetRun (void); |
40e5d5af3c71
Commit Mathieu's coding style cleanup of random-variable
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
4223
diff
changeset
|
98 |
|
40e5d5af3c71
Commit Mathieu's coding style cleanup of random-variable
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
4223
diff
changeset
|
99 |
/** |
40e5d5af3c71
Commit Mathieu's coding style cleanup of random-variable
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
4223
diff
changeset
|
100 |
* \brief Check if seed value is valid if wanted to be used as seed |
40e5d5af3c71
Commit Mathieu's coding style cleanup of random-variable
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
4223
diff
changeset
|
101 |
* \return true if valid and false if invalid |
40e5d5af3c71
Commit Mathieu's coding style cleanup of random-variable
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
4223
diff
changeset
|
102 |
*/ |
40e5d5af3c71
Commit Mathieu's coding style cleanup of random-variable
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
4223
diff
changeset
|
103 |
static bool CheckSeed (uint32_t seed); |
4218
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
104 |
}; |
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
105 |
|
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
106 |
|
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
107 |
/** |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
108 |
* \brief The basic RNG for NS-3. |
396
7b4349cd88bc
add a randomvariable group
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
364
diff
changeset
|
109 |
* \ingroup randomvariable |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
110 |
* |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
111 |
* Note: The underlying random number generation method used |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
112 |
* by NS-3 is the RngStream code by Pierre L'Ecuyer at |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
113 |
* the University of Montreal. |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
114 |
* |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
115 |
* NS-3 has a rich set of random number generators. |
2762
f56860663c54
Cleanup of RandomVariable doxygen (bug 110)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
2451
diff
changeset
|
116 |
* Class RandomVariable defines the base class functionalty |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
117 |
* required for all random number generators. By default, the underlying |
4640
77dd5c573116
use the new global value anchors to reference RngSeed and RndRun
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4579
diff
changeset
|
118 |
* generator is seeded all the time with the same seed value and run number |
77dd5c573116
use the new global value anchors to reference RngSeed and RndRun
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4579
diff
changeset
|
119 |
* coming from the ns3::GlobalValue \ref GlobalValueRngSeed "RngSeed" and \ref GlobalValueRngRun "RngRun". |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
120 |
*/ |
2336
28ce210b91bb
bug 133: automate RandomVariable memory management.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2217
diff
changeset
|
121 |
class RandomVariable |
28ce210b91bb
bug 133: automate RandomVariable memory management.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2217
diff
changeset
|
122 |
{ |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
123 |
public: |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
124 |
RandomVariable(); |
2336
28ce210b91bb
bug 133: automate RandomVariable memory management.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2217
diff
changeset
|
125 |
RandomVariable(const RandomVariable&o); |
28ce210b91bb
bug 133: automate RandomVariable memory management.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2217
diff
changeset
|
126 |
RandomVariable &operator = (const RandomVariable &o); |
28ce210b91bb
bug 133: automate RandomVariable memory management.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2217
diff
changeset
|
127 |
~RandomVariable(); |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
128 |
|
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
129 |
/** |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
130 |
* \brief Returns a random double from the underlying distribution |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
131 |
* \return A floating point random value |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
132 |
*/ |
2336
28ce210b91bb
bug 133: automate RandomVariable memory management.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2217
diff
changeset
|
133 |
double GetValue (void) const; |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
134 |
|
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
135 |
/** |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
136 |
* \brief Returns a random integer integer from the underlying distribution |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
137 |
* \return Integer cast of ::GetValue() |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
138 |
*/ |
2439
4a0b22a3f5fa
UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
139 |
uint32_t GetInteger (void) const; |
2384
500ada6a4874
add Value support to RandomVariable.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2336
diff
changeset
|
140 |
|
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
141 |
private: |
2409
8744ec60e8e6
convert RandomVariable, Rectangle, Vector, and Time to the new Class Helper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2408
diff
changeset
|
142 |
friend std::ostream &operator << (std::ostream &os, const RandomVariable &var); |
8744ec60e8e6
convert RandomVariable, Rectangle, Vector, and Time to the new Class Helper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2408
diff
changeset
|
143 |
friend std::istream &operator >> (std::istream &os, RandomVariable &var); |
8744ec60e8e6
convert RandomVariable, Rectangle, Vector, and Time to the new Class Helper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2408
diff
changeset
|
144 |
|
2336
28ce210b91bb
bug 133: automate RandomVariable memory management.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2217
diff
changeset
|
145 |
RandomVariableBase *m_variable; |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
146 |
protected: |
2336
28ce210b91bb
bug 133: automate RandomVariable memory management.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2217
diff
changeset
|
147 |
RandomVariable (const RandomVariableBase &variable); |
2384
500ada6a4874
add Value support to RandomVariable.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2336
diff
changeset
|
148 |
RandomVariableBase *Peek (void) const; |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
149 |
}; |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
150 |
|
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
151 |
/** |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
152 |
* \brief The uniform distribution RNG for NS-3. |
396
7b4349cd88bc
add a randomvariable group
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
364
diff
changeset
|
153 |
* \ingroup randomvariable |
1872
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
154 |
* |
442
96d3e7dc8bb2
Added static RNGs, like ExponentialVariable::GetSingleValue(mean)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
438
diff
changeset
|
155 |
* This class supports the creation of objects that return random numbers |
96d3e7dc8bb2
Added static RNGs, like ExponentialVariable::GetSingleValue(mean)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
438
diff
changeset
|
156 |
* from a fixed uniform distribution. It also supports the generation of |
96d3e7dc8bb2
Added static RNGs, like ExponentialVariable::GetSingleValue(mean)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
438
diff
changeset
|
157 |
* single random numbers from various uniform distributions. |
1872
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
158 |
* |
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
159 |
* The low end of the range is always included and the high end |
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
160 |
* of the range is always excluded. |
442
96d3e7dc8bb2
Added static RNGs, like ExponentialVariable::GetSingleValue(mean)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
438
diff
changeset
|
161 |
* \code |
96d3e7dc8bb2
Added static RNGs, like ExponentialVariable::GetSingleValue(mean)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
438
diff
changeset
|
162 |
* UniformVariable x(0,10); |
1872
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
163 |
* x.GetValue(); //will always return numbers [0,10) |
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
164 |
* UniformVariable::GetSingleValue(100,1000); //returns a value [100,1000) |
592
f7e4beac3e31
fix dox warnings
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
442
diff
changeset
|
165 |
* \endcode |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
166 |
*/ |
2336
28ce210b91bb
bug 133: automate RandomVariable memory management.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2217
diff
changeset
|
167 |
class UniformVariable : public RandomVariable |
28ce210b91bb
bug 133: automate RandomVariable memory management.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2217
diff
changeset
|
168 |
{ |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
169 |
public: |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
170 |
/** |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
171 |
* Creates a uniform random number generator in the |
1872
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
172 |
* range [0.0 .. 1.0). |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
173 |
*/ |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
174 |
UniformVariable(); |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
175 |
|
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
176 |
/** |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
177 |
* Creates a uniform random number generator with the specified range |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
178 |
* \param s Low end of the range |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
179 |
* \param l High end of the range |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
180 |
*/ |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
181 |
UniformVariable(double s, double l); |
4218
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
182 |
|
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
183 |
/** |
4242
3d4788bd1ddd
improve coherency between UniformVariable and RandomVariable, explain why the extra overload is necessary.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4240
diff
changeset
|
184 |
* \brief call RandomVariable::GetValue |
4218
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
185 |
* \return A floating point random value |
4242
3d4788bd1ddd
improve coherency between UniformVariable and RandomVariable, explain why the extra overload is necessary.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4240
diff
changeset
|
186 |
* |
3d4788bd1ddd
improve coherency between UniformVariable and RandomVariable, explain why the extra overload is necessary.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4240
diff
changeset
|
187 |
* Note: we have to re-implement this method here because the method is |
3d4788bd1ddd
improve coherency between UniformVariable and RandomVariable, explain why the extra overload is necessary.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4240
diff
changeset
|
188 |
* overloaded below for the two-argument variant and the c++ name resolution |
3d4788bd1ddd
improve coherency between UniformVariable and RandomVariable, explain why the extra overload is necessary.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4240
diff
changeset
|
189 |
* rules don't work well with overloads split between parent and child |
3d4788bd1ddd
improve coherency between UniformVariable and RandomVariable, explain why the extra overload is necessary.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4240
diff
changeset
|
190 |
* classes. |
4218
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
191 |
*/ |
4242
3d4788bd1ddd
improve coherency between UniformVariable and RandomVariable, explain why the extra overload is necessary.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4240
diff
changeset
|
192 |
double GetValue (void) const; |
4218
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
193 |
|
442
96d3e7dc8bb2
Added static RNGs, like ExponentialVariable::GetSingleValue(mean)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
438
diff
changeset
|
194 |
/** |
4218
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
195 |
* \brief Returns a random double with the specified range |
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
196 |
* \param s Low end of the range |
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
197 |
* \param l High end of the range |
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
198 |
* \return A floating point random value |
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
199 |
*/ |
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
200 |
double GetValue(double s, double l); |
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
201 |
|
4256
cc06d903ca09
Adding UniformVariable::GetInteger and using it to fix bug in RealRandomStream::GetNext.
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4247
diff
changeset
|
202 |
/** |
cc06d903ca09
Adding UniformVariable::GetInteger and using it to fix bug in RealRandomStream::GetNext.
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4247
diff
changeset
|
203 |
* \brief Returns a random unsigned integer from the interval [s,l] including both ends. |
cc06d903ca09
Adding UniformVariable::GetInteger and using it to fix bug in RealRandomStream::GetNext.
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4247
diff
changeset
|
204 |
* \param s Low end of the range |
cc06d903ca09
Adding UniformVariable::GetInteger and using it to fix bug in RealRandomStream::GetNext.
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4247
diff
changeset
|
205 |
* \param l High end of the range |
cc06d903ca09
Adding UniformVariable::GetInteger and using it to fix bug in RealRandomStream::GetNext.
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4247
diff
changeset
|
206 |
* \return A random unsigned integer value. |
cc06d903ca09
Adding UniformVariable::GetInteger and using it to fix bug in RealRandomStream::GetNext.
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4247
diff
changeset
|
207 |
*/ |
cc06d903ca09
Adding UniformVariable::GetInteger and using it to fix bug in RealRandomStream::GetNext.
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4247
diff
changeset
|
208 |
uint32_t GetInteger (uint32_t s, uint32_t l); |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
209 |
}; |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
210 |
|
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
211 |
/** |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
212 |
* \brief A random variable that returns a constant |
396
7b4349cd88bc
add a randomvariable group
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
364
diff
changeset
|
213 |
* \ingroup randomvariable |
360
7bffd987426c
Fixed major memory bug and docs in RandomVariable
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
346
diff
changeset
|
214 |
* |
2762
f56860663c54
Cleanup of RandomVariable doxygen (bug 110)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
2451
diff
changeset
|
215 |
* Class ConstantVariable defines a random number generator that |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
216 |
* returns the same value every sample. |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
217 |
*/ |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
218 |
class ConstantVariable : public RandomVariable { |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
219 |
|
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
220 |
public: |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
221 |
/** |
2762
f56860663c54
Cleanup of RandomVariable doxygen (bug 110)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
2451
diff
changeset
|
222 |
* Construct a ConstantVariable RNG that returns zero every sample |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
223 |
*/ |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
224 |
ConstantVariable(); |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
225 |
|
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
226 |
/** |
2762
f56860663c54
Cleanup of RandomVariable doxygen (bug 110)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
2451
diff
changeset
|
227 |
* Construct a ConstantVariable RNG that returns the specified value |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
228 |
* every sample. |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
229 |
* \param c Unchanging value for this RNG. |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
230 |
*/ |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
231 |
ConstantVariable(double c); |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
232 |
|
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
233 |
/** |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
234 |
* \brief Specify a new constant RNG for this generator. |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
235 |
* \param c New constant value for this RNG. |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
236 |
*/ |
2336
28ce210b91bb
bug 133: automate RandomVariable memory management.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2217
diff
changeset
|
237 |
void SetConstant(double c); |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
238 |
|
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
239 |
}; |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
240 |
|
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
241 |
/** |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
242 |
* \brief Return a sequential list of values |
396
7b4349cd88bc
add a randomvariable group
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
364
diff
changeset
|
243 |
* \ingroup randomvariable |
360
7bffd987426c
Fixed major memory bug and docs in RandomVariable
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
346
diff
changeset
|
244 |
* |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
245 |
* Class SequentialVariable defines a random number generator that |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
246 |
* returns a sequential sequence. The sequence monotonically |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
247 |
* increases for a period, then wraps around to the low value |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
248 |
* and begins monotonicaly increasing again. |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
249 |
*/ |
2336
28ce210b91bb
bug 133: automate RandomVariable memory management.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2217
diff
changeset
|
250 |
class SequentialVariable : public RandomVariable |
28ce210b91bb
bug 133: automate RandomVariable memory management.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2217
diff
changeset
|
251 |
{ |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
252 |
public: |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
253 |
/** |
2762
f56860663c54
Cleanup of RandomVariable doxygen (bug 110)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
2451
diff
changeset
|
254 |
* \brief Constructor for the SequentialVariable RNG. |
360
7bffd987426c
Fixed major memory bug and docs in RandomVariable
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
346
diff
changeset
|
255 |
* |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
256 |
* The four parameters define the sequence. For example |
2762
f56860663c54
Cleanup of RandomVariable doxygen (bug 110)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
2451
diff
changeset
|
257 |
* SequentialVariable(0,5,1,2) creates a RNG that has the sequence |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
258 |
* 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 0, 0 ... |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
259 |
* \param f First value of the sequence. |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
260 |
* \param l One more than the last value of the sequence. |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
261 |
* \param i Increment between sequence values |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
262 |
* \param c Number of times each member of the sequence is repeated |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
263 |
*/ |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
264 |
SequentialVariable(double f, double l, double i = 1, uint32_t c = 1); |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
265 |
|
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
266 |
/** |
2762
f56860663c54
Cleanup of RandomVariable doxygen (bug 110)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
2451
diff
changeset
|
267 |
* \brief Constructor for the SequentialVariable RNG. |
360
7bffd987426c
Fixed major memory bug and docs in RandomVariable
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
346
diff
changeset
|
268 |
* |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
269 |
* Differs from the first only in that the increment parameter is a |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
270 |
* random variable |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
271 |
* \param f First value of the sequence. |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
272 |
* \param l One more than the last value of the sequence. |
2762
f56860663c54
Cleanup of RandomVariable doxygen (bug 110)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
2451
diff
changeset
|
273 |
* \param i Reference to a RandomVariable for the sequence increment |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
274 |
* \param c Number of times each member of the sequence is repeated |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
275 |
*/ |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
276 |
SequentialVariable(double f, double l, const RandomVariable& i, uint32_t c = 1); |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
277 |
|
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
278 |
}; |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
279 |
|
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
280 |
/** |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
281 |
* \brief Exponentially Distributed random var |
396
7b4349cd88bc
add a randomvariable group
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
364
diff
changeset
|
282 |
* \ingroup randomvariable |
1872
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
283 |
* |
442
96d3e7dc8bb2
Added static RNGs, like ExponentialVariable::GetSingleValue(mean)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
438
diff
changeset
|
284 |
* This class supports the creation of objects that return random numbers |
96d3e7dc8bb2
Added static RNGs, like ExponentialVariable::GetSingleValue(mean)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
438
diff
changeset
|
285 |
* from a fixed exponential distribution. It also supports the generation of |
96d3e7dc8bb2
Added static RNGs, like ExponentialVariable::GetSingleValue(mean)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
438
diff
changeset
|
286 |
* single random numbers from various exponential distributions. |
1872
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
287 |
* |
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
288 |
* The probability density function of an exponential variable |
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
289 |
* is defined over the interval [0, +inf) as: |
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
290 |
* \f$ \alpha e^{-\alpha x} \f$ |
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
291 |
* where \f$ \alpha = \frac{1}{mean} \f$ |
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
292 |
* |
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
293 |
* The bounded version is defined over the internal [0,+inf) as: |
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
294 |
* \f$ \left\{ \begin{array}{cl} \alpha e^{-\alpha x} & x < bound \\ bound & x > bound \end{array}\right. \f$ |
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
295 |
* |
442
96d3e7dc8bb2
Added static RNGs, like ExponentialVariable::GetSingleValue(mean)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
438
diff
changeset
|
296 |
* \code |
2762
f56860663c54
Cleanup of RandomVariable doxygen (bug 110)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
2451
diff
changeset
|
297 |
* ExponentialVariable x(3.14); |
442
96d3e7dc8bb2
Added static RNGs, like ExponentialVariable::GetSingleValue(mean)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
438
diff
changeset
|
298 |
* x.GetValue(); //will always return with mean 3.14 |
2762
f56860663c54
Cleanup of RandomVariable doxygen (bug 110)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
2451
diff
changeset
|
299 |
* ExponentialVariable::GetSingleValue(20.1); //returns with mean 20.1 |
f56860663c54
Cleanup of RandomVariable doxygen (bug 110)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
2451
diff
changeset
|
300 |
* ExponentialVariable::GetSingleValue(108); //returns with mean 108 |
442
96d3e7dc8bb2
Added static RNGs, like ExponentialVariable::GetSingleValue(mean)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
438
diff
changeset
|
301 |
* \endcode |
360
7bffd987426c
Fixed major memory bug and docs in RandomVariable
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
346
diff
changeset
|
302 |
* |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
303 |
*/ |
2336
28ce210b91bb
bug 133: automate RandomVariable memory management.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2217
diff
changeset
|
304 |
class ExponentialVariable : public RandomVariable |
28ce210b91bb
bug 133: automate RandomVariable memory management.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2217
diff
changeset
|
305 |
{ |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
306 |
public: |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
307 |
/** |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
308 |
* Constructs an exponential random variable with a mean |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
309 |
* value of 1.0. |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
310 |
*/ |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
311 |
ExponentialVariable(); |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
312 |
|
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
313 |
/** |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
314 |
* \brief Constructs an exponential random variable with a specified mean |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
315 |
* \param m Mean value for the random variable |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
316 |
*/ |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
317 |
explicit ExponentialVariable(double m); |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
318 |
|
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
319 |
/** |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
320 |
* \brief Constructs an exponential random variable with spefified |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
321 |
* \brief mean and upper limit. |
360
7bffd987426c
Fixed major memory bug and docs in RandomVariable
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
346
diff
changeset
|
322 |
* |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
323 |
* Since exponential distributions can theoretically return unbounded values, |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
324 |
* it is sometimes useful to specify a fixed upper limit. Note however when |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
325 |
* the upper limit is specified, the true mean of the distribution is |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
326 |
* slightly smaller than the mean value specified. |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
327 |
* \param m Mean value of the random variable |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
328 |
* \param b Upper bound on returned values |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
329 |
*/ |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
330 |
ExponentialVariable(double m, double b); |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
331 |
|
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
332 |
}; |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
333 |
|
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
334 |
/** |
2762
f56860663c54
Cleanup of RandomVariable doxygen (bug 110)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
2451
diff
changeset
|
335 |
* \brief ParetoVariable distributed random var |
396
7b4349cd88bc
add a randomvariable group
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
364
diff
changeset
|
336 |
* \ingroup randomvariable |
1872
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
337 |
* |
442
96d3e7dc8bb2
Added static RNGs, like ExponentialVariable::GetSingleValue(mean)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
438
diff
changeset
|
338 |
* This class supports the creation of objects that return random numbers |
96d3e7dc8bb2
Added static RNGs, like ExponentialVariable::GetSingleValue(mean)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
438
diff
changeset
|
339 |
* from a fixed pareto distribution. It also supports the generation of |
96d3e7dc8bb2
Added static RNGs, like ExponentialVariable::GetSingleValue(mean)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
438
diff
changeset
|
340 |
* single random numbers from various pareto distributions. |
1872
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
341 |
* |
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
342 |
* The probability density function is defined over the range [\f$x_m\f$,+inf) as: |
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
343 |
* \f$ k \frac{x_m^k}{x^{k+1}}\f$ where \f$x_m > 0\f$ is called the location |
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
344 |
* parameter and \f$ k > 0\f$ is called the pareto index or shape. |
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
345 |
* |
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
346 |
* The parameter \f$ x_m \f$ can be infered from the mean and the parameter \f$ k \f$ |
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
347 |
* with the equation \f$ x_m = mean \frac{k-1}{k}, k > 1\f$. |
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
348 |
* |
442
96d3e7dc8bb2
Added static RNGs, like ExponentialVariable::GetSingleValue(mean)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
438
diff
changeset
|
349 |
* \code |
2762
f56860663c54
Cleanup of RandomVariable doxygen (bug 110)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
2451
diff
changeset
|
350 |
* ParetoVariable x(3.14); |
442
96d3e7dc8bb2
Added static RNGs, like ExponentialVariable::GetSingleValue(mean)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
438
diff
changeset
|
351 |
* x.GetValue(); //will always return with mean 3.14 |
2762
f56860663c54
Cleanup of RandomVariable doxygen (bug 110)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
2451
diff
changeset
|
352 |
* ParetoVariable::GetSingleValue(20.1); //returns with mean 20.1 |
f56860663c54
Cleanup of RandomVariable doxygen (bug 110)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
2451
diff
changeset
|
353 |
* ParetoVariable::GetSingleValue(108); //returns with mean 108 |
442
96d3e7dc8bb2
Added static RNGs, like ExponentialVariable::GetSingleValue(mean)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
438
diff
changeset
|
354 |
* \endcode |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
355 |
*/ |
2336
28ce210b91bb
bug 133: automate RandomVariable memory management.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2217
diff
changeset
|
356 |
class ParetoVariable : public RandomVariable |
28ce210b91bb
bug 133: automate RandomVariable memory management.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2217
diff
changeset
|
357 |
{ |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
358 |
public: |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
359 |
/** |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
360 |
* Constructs a pareto random variable with a mean of 1 and a shape |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
361 |
* parameter of 1.5 |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
362 |
*/ |
2336
28ce210b91bb
bug 133: automate RandomVariable memory management.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2217
diff
changeset
|
363 |
ParetoVariable (); |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
364 |
|
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
365 |
/** |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
366 |
* Constructs a pareto random variable with specified mean and shape |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
367 |
* parameter of 1.5 |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
368 |
* \param m Mean value of the distribution |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
369 |
*/ |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
370 |
explicit ParetoVariable(double m); |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
371 |
|
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
372 |
/** |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
373 |
* Constructs a pareto random variable with the specified mean value and |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
374 |
* shape parameter. |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
375 |
* \param m Mean value of the distribution |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
376 |
* \param s Shape parameter for the distribution |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
377 |
*/ |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
378 |
ParetoVariable(double m, double s); |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
379 |
|
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
380 |
/** |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
381 |
* \brief Constructs a pareto random variable with the specified mean |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
382 |
* \brief value, shape (alpha), and upper bound. |
442
96d3e7dc8bb2
Added static RNGs, like ExponentialVariable::GetSingleValue(mean)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
438
diff
changeset
|
383 |
* |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
384 |
* Since pareto distributions can theoretically return unbounded values, |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
385 |
* it is sometimes useful to specify a fixed upper limit. Note however |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
386 |
* when the upper limit is specified, the true mean of the distribution |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
387 |
* is slightly smaller than the mean value specified. |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
388 |
* \param m Mean value |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
389 |
* \param s Shape parameter |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
390 |
* \param b Upper limit on returned values |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
391 |
*/ |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
392 |
ParetoVariable(double m, double s, double b); |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
393 |
|
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
394 |
}; |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
395 |
|
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
396 |
/** |
2762
f56860663c54
Cleanup of RandomVariable doxygen (bug 110)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
2451
diff
changeset
|
397 |
* \brief WeibullVariable distributed random var |
396
7b4349cd88bc
add a randomvariable group
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
364
diff
changeset
|
398 |
* \ingroup randomvariable |
1872
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
399 |
* |
442
96d3e7dc8bb2
Added static RNGs, like ExponentialVariable::GetSingleValue(mean)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
438
diff
changeset
|
400 |
* This class supports the creation of objects that return random numbers |
96d3e7dc8bb2
Added static RNGs, like ExponentialVariable::GetSingleValue(mean)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
438
diff
changeset
|
401 |
* from a fixed weibull distribution. It also supports the generation of |
96d3e7dc8bb2
Added static RNGs, like ExponentialVariable::GetSingleValue(mean)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
438
diff
changeset
|
402 |
* single random numbers from various weibull distributions. |
1872
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
403 |
* |
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
404 |
* The probability density function is defined over the interval [0, +inf] |
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
405 |
* as: \f$ \frac{k}{\lambda}\left(\frac{x}{\lambda}\right)^{k-1}e^{-\left(\frac{x}{\lambda}\right)^k} \f$ |
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
406 |
* where \f$ k > 0\f$ is the shape parameter and \f$ \lambda > 0\f$ is the scale parameter. The |
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
407 |
* specified mean is related to the scale and shape parameters by the following relation: |
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
408 |
* \f$ mean = \lambda\Gamma\left(1+\frac{1}{k}\right) \f$ where \f$ \Gamma \f$ is the Gamma function. |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
409 |
*/ |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
410 |
class WeibullVariable : public RandomVariable { |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
411 |
public: |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
412 |
/** |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
413 |
* Constructs a weibull random variable with a mean |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
414 |
* value of 1.0 and a shape (alpha) parameter of 1 |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
415 |
*/ |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
416 |
WeibullVariable(); |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
417 |
|
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
418 |
|
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
419 |
/** |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
420 |
* Constructs a weibull random variable with the specified mean |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
421 |
* value and a shape (alpha) parameter of 1.5. |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
422 |
* \param m mean value of the distribution |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
423 |
*/ |
4317
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
424 |
WeibullVariable(double m) ; |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
425 |
|
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
426 |
/** |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
427 |
* Constructs a weibull random variable with the specified mean |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
428 |
* value and a shape (alpha). |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
429 |
* \param m Mean value for the distribution. |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
430 |
* \param s Shape (alpha) parameter for the distribution. |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
431 |
*/ |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
432 |
WeibullVariable(double m, double s); |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
433 |
|
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
434 |
/** |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
435 |
* \brief Constructs a weibull random variable with the specified mean |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
436 |
* \brief value, shape (alpha), and upper bound. |
2762
f56860663c54
Cleanup of RandomVariable doxygen (bug 110)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
2451
diff
changeset
|
437 |
* Since WeibullVariable distributions can theoretically return unbounded values, |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
438 |
* it is sometimes usefull to specify a fixed upper limit. Note however |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
439 |
* that when the upper limit is specified, the true mean of the distribution |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
440 |
* is slightly smaller than the mean value specified. |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
441 |
* \param m Mean value for the distribution. |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
442 |
* \param s Shape (alpha) parameter for the distribution. |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
443 |
* \param b Upper limit on returned values |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
444 |
*/ |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
445 |
WeibullVariable(double m, double s, double b); |
4218
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
446 |
|
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
447 |
}; |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
448 |
|
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
449 |
/** |
2762
f56860663c54
Cleanup of RandomVariable doxygen (bug 110)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
2451
diff
changeset
|
450 |
* \brief Class NormalVariable defines a random variable with a |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
451 |
* normal (Gaussian) distribution. |
1872
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
452 |
* \ingroup randomvariable |
442
96d3e7dc8bb2
Added static RNGs, like ExponentialVariable::GetSingleValue(mean)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
438
diff
changeset
|
453 |
* |
96d3e7dc8bb2
Added static RNGs, like ExponentialVariable::GetSingleValue(mean)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
438
diff
changeset
|
454 |
* This class supports the creation of objects that return random numbers |
96d3e7dc8bb2
Added static RNGs, like ExponentialVariable::GetSingleValue(mean)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
438
diff
changeset
|
455 |
* from a fixed normal distribution. It also supports the generation of |
96d3e7dc8bb2
Added static RNGs, like ExponentialVariable::GetSingleValue(mean)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
438
diff
changeset
|
456 |
* single random numbers from various normal distributions. |
1872
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
457 |
* |
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
458 |
* The density probability function is defined over the interval (-inf,+inf) |
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
459 |
* as: \f$ \frac{1}{\sigma\sqrt{2\pi}} e^{-\frac{(x-\mu)^2}{s\sigma^2}}\f$ |
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
460 |
* where \f$ mean = \mu \f$ and \f$ variance = \sigma^2 \f$ |
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
461 |
* |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
462 |
*/ |
2336
28ce210b91bb
bug 133: automate RandomVariable memory management.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2217
diff
changeset
|
463 |
class NormalVariable : public RandomVariable |
28ce210b91bb
bug 133: automate RandomVariable memory management.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2217
diff
changeset
|
464 |
{ |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
465 |
public: |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
466 |
/** |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
467 |
* Constructs an normal random variable with a mean |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
468 |
* value of 0 and variance of 1. |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
469 |
*/ |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
470 |
NormalVariable(); |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
471 |
|
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
472 |
/** |
4223
86a97665dcb0
Fix old code that crept in
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
4218
diff
changeset
|
473 |
* \brief Construct a normal random variable with specified mean and variance. |
86a97665dcb0
Fix old code that crept in
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
4218
diff
changeset
|
474 |
* \param m Mean value |
86a97665dcb0
Fix old code that crept in
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
4218
diff
changeset
|
475 |
* \param v Variance |
86a97665dcb0
Fix old code that crept in
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
4218
diff
changeset
|
476 |
*/ |
86a97665dcb0
Fix old code that crept in
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
4218
diff
changeset
|
477 |
NormalVariable(double m, double v); |
86a97665dcb0
Fix old code that crept in
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
4218
diff
changeset
|
478 |
|
86a97665dcb0
Fix old code that crept in
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
4218
diff
changeset
|
479 |
/** |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
480 |
* \brief Construct a normal random variable with specified mean and variance |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
481 |
* \param m Mean value |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
482 |
* \param v Variance |
4223
86a97665dcb0
Fix old code that crept in
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
4218
diff
changeset
|
483 |
* \param b Bound. The NormalVariable is bounded symetrically about the mean |
86a97665dcb0
Fix old code that crept in
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
4218
diff
changeset
|
484 |
* [mean-bound,mean+bound] |
3267
d0c70dbe918e
bug 181: Normal Variable Infinite Value & Bounds
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
2969
diff
changeset
|
485 |
*/ |
4223
86a97665dcb0
Fix old code that crept in
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
4218
diff
changeset
|
486 |
NormalVariable(double m, double v, double b); |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
487 |
}; |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
488 |
|
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
489 |
/** |
2762
f56860663c54
Cleanup of RandomVariable doxygen (bug 110)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
2451
diff
changeset
|
490 |
* \brief EmpiricalVariable distribution random var |
396
7b4349cd88bc
add a randomvariable group
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
364
diff
changeset
|
491 |
* \ingroup randomvariable |
360
7bffd987426c
Fixed major memory bug and docs in RandomVariable
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
346
diff
changeset
|
492 |
* |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
493 |
* Defines a random variable that has a specified, empirical |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
494 |
* distribution. The distribution is specified by a |
1872
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
495 |
* series of calls to the CDF member function, specifying a |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
496 |
* value and the probability that the function value is less than |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
497 |
* the specified value. When values are requested, |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
498 |
* a uniform random variable is used to select a probabililty, |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
499 |
* and the return value is interpreted linerarly between the |
2762
f56860663c54
Cleanup of RandomVariable doxygen (bug 110)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
2451
diff
changeset
|
500 |
* two appropriate points in the CDF. The method is known |
f56860663c54
Cleanup of RandomVariable doxygen (bug 110)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
2451
diff
changeset
|
501 |
* as inverse transform sampling: |
f56860663c54
Cleanup of RandomVariable doxygen (bug 110)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
2451
diff
changeset
|
502 |
* (http://en.wikipedia.org/wiki/Inverse_transform_sampling). |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
503 |
*/ |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
504 |
class EmpiricalVariable : public RandomVariable { |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
505 |
public: |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
506 |
/** |
2762
f56860663c54
Cleanup of RandomVariable doxygen (bug 110)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
2451
diff
changeset
|
507 |
* Constructor for the EmpiricalVariable random variables. |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
508 |
*/ |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
509 |
explicit EmpiricalVariable(); |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
510 |
|
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
511 |
/** |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
512 |
* \brief Specifies a point in the empirical distribution |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
513 |
* \param v The function value for this point |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
514 |
* \param c Probability that the function is less than or equal to v |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
515 |
*/ |
2336
28ce210b91bb
bug 133: automate RandomVariable memory management.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2217
diff
changeset
|
516 |
void CDF(double v, double c); // Value, prob <= Value |
28ce210b91bb
bug 133: automate RandomVariable memory management.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2217
diff
changeset
|
517 |
protected: |
28ce210b91bb
bug 133: automate RandomVariable memory management.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2217
diff
changeset
|
518 |
EmpiricalVariable (const RandomVariableBase &variable); |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
519 |
}; |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
520 |
|
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
521 |
/** |
396
7b4349cd88bc
add a randomvariable group
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
364
diff
changeset
|
522 |
* \brief Integer-based empirical distribution |
7b4349cd88bc
add a randomvariable group
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
364
diff
changeset
|
523 |
* \ingroup randomvariable |
7b4349cd88bc
add a randomvariable group
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
364
diff
changeset
|
524 |
* |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
525 |
* Defines an empirical distribution where all values are integers. |
2762
f56860663c54
Cleanup of RandomVariable doxygen (bug 110)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
2451
diff
changeset
|
526 |
* Indentical to EmpiricalVariable, except that the inverse transform |
f56860663c54
Cleanup of RandomVariable doxygen (bug 110)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
2451
diff
changeset
|
527 |
* sampling interpolation described in the EmpiricalVariable documentation |
f56860663c54
Cleanup of RandomVariable doxygen (bug 110)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
2451
diff
changeset
|
528 |
* is modified to only return integers. |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
529 |
*/ |
2336
28ce210b91bb
bug 133: automate RandomVariable memory management.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2217
diff
changeset
|
530 |
class IntEmpiricalVariable : public EmpiricalVariable |
28ce210b91bb
bug 133: automate RandomVariable memory management.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2217
diff
changeset
|
531 |
{ |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
532 |
public: |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
533 |
IntEmpiricalVariable(); |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
534 |
}; |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
535 |
|
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
536 |
/** |
396
7b4349cd88bc
add a randomvariable group
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
364
diff
changeset
|
537 |
* \brief a non-random variable |
7b4349cd88bc
add a randomvariable group
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
364
diff
changeset
|
538 |
* \ingroup randomvariable |
7b4349cd88bc
add a randomvariable group
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
364
diff
changeset
|
539 |
* |
7b4349cd88bc
add a randomvariable group
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
364
diff
changeset
|
540 |
* Defines a random variable that has a specified, predetermined |
7b4349cd88bc
add a randomvariable group
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
364
diff
changeset
|
541 |
* sequence. This would be useful when trying to force |
7b4349cd88bc
add a randomvariable group
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
364
diff
changeset
|
542 |
* the RNG to return a known sequence, perhaps to |
7b4349cd88bc
add a randomvariable group
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
364
diff
changeset
|
543 |
* compare NS-3 to some other simulator |
7b4349cd88bc
add a randomvariable group
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
364
diff
changeset
|
544 |
*/ |
2336
28ce210b91bb
bug 133: automate RandomVariable memory management.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2217
diff
changeset
|
545 |
class DeterministicVariable : public RandomVariable |
28ce210b91bb
bug 133: automate RandomVariable memory management.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2217
diff
changeset
|
546 |
{ |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
547 |
public: |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
548 |
/** |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
549 |
* \brief Constructor |
360
7bffd987426c
Fixed major memory bug and docs in RandomVariable
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
346
diff
changeset
|
550 |
* |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
551 |
* Creates a generator that returns successive elements of the d array |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
552 |
* on successive calls to ::Value(). Note that the d pointer is copied |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
553 |
* for use by the generator (shallow-copy), not its contents, so the |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
554 |
* contents of the array d points to have to remain unchanged for the use |
2762
f56860663c54
Cleanup of RandomVariable doxygen (bug 110)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
2451
diff
changeset
|
555 |
* of DeterministicVariable to be meaningful. |
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
556 |
* \param d Pointer to array of random values to return in sequence |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
557 |
* \param c Number of values in the array |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
558 |
*/ |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
559 |
explicit DeterministicVariable(double* d, uint32_t c); |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
560 |
}; |
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
561 |
|
438
515bb5663cf3
Randomvariable Lognormal added
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
423
diff
changeset
|
562 |
/** |
515bb5663cf3
Randomvariable Lognormal added
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
423
diff
changeset
|
563 |
* \brief Log-normal Distributed random var |
515bb5663cf3
Randomvariable Lognormal added
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
423
diff
changeset
|
564 |
* \ingroup randomvariable |
1872
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
565 |
* |
2762
f56860663c54
Cleanup of RandomVariable doxygen (bug 110)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
2451
diff
changeset
|
566 |
* LogNormalVariable defines a random variable with log-normal |
438
515bb5663cf3
Randomvariable Lognormal added
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
423
diff
changeset
|
567 |
* distribution. If one takes the natural logarithm of random |
515bb5663cf3
Randomvariable Lognormal added
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
423
diff
changeset
|
568 |
* variable following the log-normal distribution, the obtained values |
515bb5663cf3
Randomvariable Lognormal added
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
423
diff
changeset
|
569 |
* follow a normal distribution. |
442
96d3e7dc8bb2
Added static RNGs, like ExponentialVariable::GetSingleValue(mean)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
438
diff
changeset
|
570 |
* This class supports the creation of objects that return random numbers |
96d3e7dc8bb2
Added static RNGs, like ExponentialVariable::GetSingleValue(mean)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
438
diff
changeset
|
571 |
* from a fixed lognormal distribution. It also supports the generation of |
96d3e7dc8bb2
Added static RNGs, like ExponentialVariable::GetSingleValue(mean)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
438
diff
changeset
|
572 |
* single random numbers from various lognormal distributions. |
1872
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
573 |
* |
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
574 |
* The probability density function is defined over the interval [0,+inf) as: |
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
575 |
* \f$ \frac{1}{x\sigma\sqrt{2\pi}} e^{-\frac{(ln(x) - \mu)^2}{2\sigma^2}}\f$ |
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
576 |
* where \f$ mean = e^{\mu+\frac{\sigma^2}{2}} \f$ and |
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
577 |
* \f$ variance = (e^{\sigma^2}-1)e^{2\mu+\sigma^2}\f$ |
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
578 |
* |
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
579 |
* The \f$ \mu \f$ and \f$ \sigma \f$ parameters can be calculated from the mean |
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
580 |
* and standard deviation with the following equations: |
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
581 |
* \f$ \mu = ln(mean) - \frac{1}{2}ln\left(1+\frac{stddev}{mean^2}\right)\f$, and, |
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
582 |
* \f$ \sigma = \sqrt{ln\left(1+\frac{stddev}{mean^2}\right)}\f$ |
438
515bb5663cf3
Randomvariable Lognormal added
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
423
diff
changeset
|
583 |
*/ |
2336
28ce210b91bb
bug 133: automate RandomVariable memory management.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2217
diff
changeset
|
584 |
class LogNormalVariable : public RandomVariable |
28ce210b91bb
bug 133: automate RandomVariable memory management.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2217
diff
changeset
|
585 |
{ |
438
515bb5663cf3
Randomvariable Lognormal added
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
423
diff
changeset
|
586 |
public: |
515bb5663cf3
Randomvariable Lognormal added
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
423
diff
changeset
|
587 |
/** |
1872
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
588 |
* \param mu mu parameter of the lognormal distribution |
4dfb2a623722
bug 109: improve the doxygen documentation for RandomVariable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1806
diff
changeset
|
589 |
* \param sigma sigma parameter of the lognormal distribution |
438
515bb5663cf3
Randomvariable Lognormal added
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
423
diff
changeset
|
590 |
*/ |
515bb5663cf3
Randomvariable Lognormal added
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
423
diff
changeset
|
591 |
LogNormalVariable (double mu, double sigma); |
515bb5663cf3
Randomvariable Lognormal added
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
423
diff
changeset
|
592 |
}; |
515bb5663cf3
Randomvariable Lognormal added
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
423
diff
changeset
|
593 |
|
942
b65368bf40f9
Added Triangularly distributed random variables
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
676
diff
changeset
|
594 |
/** |
4317
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
595 |
* \brief Gamma Distributed Random Variable |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
596 |
* \ingroup randomvariable |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
597 |
* |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
598 |
* GammaVariable defines a random variable with gamma distribution. |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
599 |
* |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
600 |
* This class supports the creation of objects that return random numbers |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
601 |
* from a fixed gamma distribution. It also supports the generation of |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
602 |
* single random numbers from various gamma distributions. |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
603 |
* |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
604 |
* The probability density function is defined over the interval [0,+inf) as: |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
605 |
* \f$ x^{\alpha-1} \frac{e^{-\frac{x}{\beta}}}{\beta^\alpha \Gamma(\alpha)}\f$ |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
606 |
* where \f$ mean = \alpha\beta \f$ and |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
607 |
* \f$ variance = \alpha \beta^2\f$ |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
608 |
*/ |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
609 |
class GammaVariable : public RandomVariable |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
610 |
{ |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
611 |
public: |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
612 |
/** |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
613 |
* Constructs a gamma random variable with alpha = 1.0 and beta = 1.0 |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
614 |
*/ |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
615 |
GammaVariable (); |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
616 |
|
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
617 |
/** |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
618 |
* \param alpha alpha parameter of the gamma distribution |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
619 |
* \param beta beta parameter of the gamma distribution |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
620 |
*/ |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
621 |
GammaVariable (double alpha, double beta); |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
622 |
|
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
623 |
/** |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
624 |
* \brief call RandomVariable::GetValue |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
625 |
* \return A floating point random value |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
626 |
* |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
627 |
* Note: we have to re-implement this method here because the method is |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
628 |
* overloaded below for the two-argument variant and the c++ name resolution |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
629 |
* rules don't work well with overloads split between parent and child |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
630 |
* classes. |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
631 |
*/ |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
632 |
double GetValue (void) const; |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
633 |
|
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
634 |
/** |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
635 |
* \brief Returns a gamma random distributed double with parameters alpha and beta. |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
636 |
* \param alpha alpha parameter of the gamma distribution |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
637 |
* \param beta beta parameter of the gamma distribution |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
638 |
* \return A floating point random value |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
639 |
*/ |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
640 |
double GetValue(double alpha, double beta) const; |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
641 |
}; |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
642 |
|
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
643 |
/** |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
644 |
* \brief Erlang Distributed Random Variable |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
645 |
* \ingroup randomvariable |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
646 |
* |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
647 |
* ErlangVariable defines a random variable with Erlang distribution. |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
648 |
* |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
649 |
* The Erlang distribution is a special case of the Gamma distribution where k |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
650 |
* (= alpha) is a non-negative integer. Erlang distributed variables can be |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
651 |
* generated using a much faster algorithm than gamma variables. |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
652 |
* |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
653 |
* This class supports the creation of objects that return random numbers from |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
654 |
* a fixed Erlang distribution. It also supports the generation of single |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
655 |
* random numbers from various Erlang distributions. |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
656 |
* |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
657 |
* The probability density function is defined over the interval [0,+inf) as: |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
658 |
* \f$ \frac{x^{k-1} e^{-\frac{x}{\lambda}}}{\lambda^k (k-1)!}\f$ |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
659 |
* where \f$ mean = k \lambda \f$ and |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
660 |
* \f$ variance = k \lambda^2\f$ |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
661 |
*/ |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
662 |
class ErlangVariable : public RandomVariable |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
663 |
{ |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
664 |
public: |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
665 |
/** |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
666 |
* Constructs an Erlang random variable with k = 1 and lambda = 1.0 |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
667 |
*/ |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
668 |
ErlangVariable (); |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
669 |
|
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
670 |
/** |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
671 |
* \param k k parameter of the Erlang distribution. Must be a non-negative integer. |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
672 |
* \param lambda lambda parameter of the Erlang distribution |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
673 |
*/ |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
674 |
ErlangVariable (unsigned int k, double lambda); |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
675 |
|
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
676 |
/** |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
677 |
* \brief call RandomVariable::GetValue |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
678 |
* \return A floating point random value |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
679 |
* |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
680 |
* Note: we have to re-implement this method here because the method is |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
681 |
* overloaded below for the two-argument variant and the c++ name resolution |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
682 |
* rules don't work well with overloads split between parent and child |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
683 |
* classes. |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
684 |
*/ |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
685 |
double GetValue (void) const; |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
686 |
|
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
687 |
/** |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
688 |
* \brief Returns an Erlang random distributed double with parameters k and lambda. |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
689 |
* \param k k parameter of the Erlang distribution. Must be a non-negative integer. |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
690 |
* \param lambda lambda parameter of the Erlang distribution |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
691 |
* \return A floating point random value |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
692 |
*/ |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
693 |
double GetValue(unsigned int k, double lambda) const; |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
694 |
}; |
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
695 |
|
0a250f44e0ed
bug 475: GammaVariable and ErlangVariable
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4256
diff
changeset
|
696 |
/** |
4579
c86681050541
New Zipf random variable
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4317
diff
changeset
|
697 |
* \brief Zipf Distributed random var (between 1 and n included) |
c86681050541
New Zipf random variable
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4317
diff
changeset
|
698 |
* \ingroup randomvariable |
c86681050541
New Zipf random variable
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4317
diff
changeset
|
699 |
* |
c86681050541
New Zipf random variable
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4317
diff
changeset
|
700 |
*/ |
c86681050541
New Zipf random variable
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4317
diff
changeset
|
701 |
class ZipfVariable : public RandomVariable |
c86681050541
New Zipf random variable
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4317
diff
changeset
|
702 |
{ |
c86681050541
New Zipf random variable
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4317
diff
changeset
|
703 |
public: |
c86681050541
New Zipf random variable
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4317
diff
changeset
|
704 |
/** |
c86681050541
New Zipf random variable
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4317
diff
changeset
|
705 |
* \param n the number of possible items |
c86681050541
New Zipf random variable
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4317
diff
changeset
|
706 |
* \param alpha the alpha parameter |
c86681050541
New Zipf random variable
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4317
diff
changeset
|
707 |
*/ |
c86681050541
New Zipf random variable
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4317
diff
changeset
|
708 |
ZipfVariable (long n, double alpha); |
c86681050541
New Zipf random variable
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4317
diff
changeset
|
709 |
/** |
c86681050541
New Zipf random variable
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4317
diff
changeset
|
710 |
* A zipf variable with N=1 and alpha=0 |
c86681050541
New Zipf random variable
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4317
diff
changeset
|
711 |
*/ |
c86681050541
New Zipf random variable
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4317
diff
changeset
|
712 |
ZipfVariable (); |
c86681050541
New Zipf random variable
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4317
diff
changeset
|
713 |
}; |
c86681050541
New Zipf random variable
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4317
diff
changeset
|
714 |
|
c86681050541
New Zipf random variable
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4317
diff
changeset
|
715 |
/** |
942
b65368bf40f9
Added Triangularly distributed random variables
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
676
diff
changeset
|
716 |
* \brief Triangularly Distributed random var |
b65368bf40f9
Added Triangularly distributed random variables
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
676
diff
changeset
|
717 |
* \ingroup randomvariable |
b65368bf40f9
Added Triangularly distributed random variables
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
676
diff
changeset
|
718 |
* |
b65368bf40f9
Added Triangularly distributed random variables
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
676
diff
changeset
|
719 |
* This distribution is a triangular distribution. The probablility density |
b65368bf40f9
Added Triangularly distributed random variables
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
676
diff
changeset
|
720 |
* is in the shape of a triangle. |
b65368bf40f9
Added Triangularly distributed random variables
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
676
diff
changeset
|
721 |
*/ |
2336
28ce210b91bb
bug 133: automate RandomVariable memory management.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2217
diff
changeset
|
722 |
class TriangularVariable : public RandomVariable |
28ce210b91bb
bug 133: automate RandomVariable memory management.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2217
diff
changeset
|
723 |
{ |
942
b65368bf40f9
Added Triangularly distributed random variables
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
676
diff
changeset
|
724 |
public: |
b65368bf40f9
Added Triangularly distributed random variables
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
676
diff
changeset
|
725 |
/** |
b65368bf40f9
Added Triangularly distributed random variables
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
676
diff
changeset
|
726 |
* Creates a triangle distribution random number generator in the |
b65368bf40f9
Added Triangularly distributed random variables
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
676
diff
changeset
|
727 |
* range [0.0 .. 1.0), with mean of 0.5 |
b65368bf40f9
Added Triangularly distributed random variables
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
676
diff
changeset
|
728 |
*/ |
b65368bf40f9
Added Triangularly distributed random variables
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
676
diff
changeset
|
729 |
TriangularVariable(); |
b65368bf40f9
Added Triangularly distributed random variables
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
676
diff
changeset
|
730 |
|
b65368bf40f9
Added Triangularly distributed random variables
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
676
diff
changeset
|
731 |
/** |
b65368bf40f9
Added Triangularly distributed random variables
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
676
diff
changeset
|
732 |
* Creates a triangle distribution random number generator with the specified |
b65368bf40f9
Added Triangularly distributed random variables
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
676
diff
changeset
|
733 |
* range |
b65368bf40f9
Added Triangularly distributed random variables
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
676
diff
changeset
|
734 |
* \param s Low end of the range |
b65368bf40f9
Added Triangularly distributed random variables
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
676
diff
changeset
|
735 |
* \param l High end of the range |
b65368bf40f9
Added Triangularly distributed random variables
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
676
diff
changeset
|
736 |
* \param mean mean of the distribution |
b65368bf40f9
Added Triangularly distributed random variables
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
676
diff
changeset
|
737 |
*/ |
b65368bf40f9
Added Triangularly distributed random variables
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
676
diff
changeset
|
738 |
TriangularVariable(double s, double l, double mean); |
4218
debf1a8a96d3
Proposed RNG API changes
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
3267
diff
changeset
|
739 |
|
942
b65368bf40f9
Added Triangularly distributed random variables
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
676
diff
changeset
|
740 |
}; |
438
515bb5663cf3
Randomvariable Lognormal added
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
423
diff
changeset
|
741 |
|
2409
8744ec60e8e6
convert RandomVariable, Rectangle, Vector, and Time to the new Class Helper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2408
diff
changeset
|
742 |
std::ostream &operator << (std::ostream &os, const RandomVariable &var); |
8744ec60e8e6
convert RandomVariable, Rectangle, Vector, and Time to the new Class Helper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2408
diff
changeset
|
743 |
std::istream &operator >> (std::istream &os, RandomVariable &var); |
2384
500ada6a4874
add Value support to RandomVariable.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2336
diff
changeset
|
744 |
|
2969
9d05d2a95dfa
improve the auto-generated doxygen output.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
745 |
/** |
9d05d2a95dfa
improve the auto-generated doxygen output.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
746 |
* \class ns3::RandomVariableValue |
9d05d2a95dfa
improve the auto-generated doxygen output.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
747 |
* \brief hold objects of type ns3::RandomVariable |
9d05d2a95dfa
improve the auto-generated doxygen output.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
748 |
*/ |
9d05d2a95dfa
improve the auto-generated doxygen output.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
749 |
|
2445
e1b65471f159
convert RandomVariable to new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2439
diff
changeset
|
750 |
ATTRIBUTE_VALUE_DEFINE (RandomVariable); |
e1b65471f159
convert RandomVariable to new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2439
diff
changeset
|
751 |
ATTRIBUTE_CHECKER_DEFINE (RandomVariable); |
e1b65471f159
convert RandomVariable to new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2439
diff
changeset
|
752 |
ATTRIBUTE_ACCESSOR_DEFINE (RandomVariable); |
2384
500ada6a4874
add Value support to RandomVariable.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2336
diff
changeset
|
753 |
|
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
754 |
}//namespace ns3 |
2384
500ada6a4874
add Value support to RandomVariable.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2336
diff
changeset
|
755 |
|
500ada6a4874
add Value support to RandomVariable.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2336
diff
changeset
|
756 |
|
346
4a76f247e7dc
Add random number files, base class Application
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
757 |
#endif |