A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
random-variable.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
//
3
// Copyright (c) 2006 Georgia Tech Research Corporation
4
//
5
// This program is free software; you can redistribute it and/or modify
6
// it under the terms of the GNU General Public License version 2 as
7
// published by the Free Software Foundation;
8
//
9
// This program is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with this program; if not, write to the Free Software
16
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
//
18
// Author: Rajib Bhattacharjea<raj.b@gatech.edu>
19
// Author: Hadi Arbabi<marbabi@cs.odu.edu>
20
//
21
22
#ifndef NS3_RANDOM_VARIABLE_H
23
#define NS3_RANDOM_VARIABLE_H
24
25
#include <vector>
26
#include <algorithm>
27
#include <stdint.h>
28
#include <istream>
29
#include <ostream>
30
#include "
attribute.h
"
31
#include "
attribute-helper.h
"
32
#include "
rng-seed-manager.h
"
33
39
namespace
ns3 {
40
44
class
RandomVariableBase;
45
60
class
RandomVariable
61
{
62
public
:
63
RandomVariable
();
64
RandomVariable
(
const
RandomVariable
&o);
65
RandomVariable
&
operator =
(
const
RandomVariable
&o);
66
~RandomVariable
();
67
72
double
GetValue
(
void
)
const
;
73
78
uint32_t
GetInteger
(
void
)
const
;
79
80
private
:
81
friend
std::ostream &
operator <<
(std::ostream &os,
const
RandomVariable
&var);
82
friend
std::istream &
operator >>
(std::istream &os,
RandomVariable
&var);
83
84
RandomVariableBase
*
m_variable
;
85
protected
:
86
RandomVariable
(
const
RandomVariableBase
&variable);
87
RandomVariableBase
*
Peek
(
void
)
const
;
88
};
89
105
class
UniformVariable
:
public
RandomVariable
106
{
107
public
:
112
UniformVariable
();
113
119
UniformVariable
(
double
s
,
double
l);
120
130
double
GetValue
(
void
)
const
;
131
138
double
GetValue
(
double
s,
double
l);
139
146
uint32_t
GetInteger
(uint32_t s, uint32_t l);
147
};
148
156
class
ConstantVariable
:
public
RandomVariable
157
{
158
159
public
:
163
ConstantVariable
();
164
170
ConstantVariable
(
double
c);
171
176
void
SetConstant
(
double
c);
177
178
};
179
189
class
SequentialVariable
:
public
RandomVariable
190
{
191
public
:
203
SequentialVariable
(
double
f,
double
l,
double
i = 1, uint32_t c = 1);
204
215
SequentialVariable
(
double
f,
double
l,
const
RandomVariable
& i, uint32_t c = 1);
216
217
};
218
242
class
ExponentialVariable
:
public
RandomVariable
243
{
244
public
:
249
ExponentialVariable
();
250
255
explicit
ExponentialVariable
(
double
m);
256
268
ExponentialVariable
(
double
m,
double
b);
269
270
};
271
292
class
ParetoVariable
:
public
RandomVariable
293
{
294
public
:
299
ParetoVariable
();
300
307
explicit
ParetoVariable
(
double
m);
308
316
ParetoVariable
(
double
m,
double
s
);
317
330
ParetoVariable
(
double
m,
double
s,
double
b);
331
338
ParetoVariable
(std::pair<double, double> params);
339
352
ParetoVariable
(std::pair<double, double> params,
double
b);
353
354
};
355
370
class
WeibullVariable
:
public
RandomVariable
371
{
372
public
:
377
WeibullVariable
();
378
379
385
WeibullVariable
(
double
m);
386
393
WeibullVariable
(
double
m,
double
s
);
394
406
WeibullVariable
(
double
m,
double
s,
double
b);
407
408
};
409
424
class
NormalVariable
:
public
RandomVariable
425
{
426
public
:
431
NormalVariable
();
432
438
NormalVariable
(
double
m,
double
v);
439
447
NormalVariable
(
double
m,
double
v,
double
b);
448
};
449
465
class
EmpiricalVariable
:
public
RandomVariable
466
{
467
public
:
471
explicit
EmpiricalVariable
();
472
478
void
CDF
(
double
v,
double
c);
// Value, prob <= Value
479
protected
:
480
EmpiricalVariable
(
const
RandomVariableBase
&variable);
481
};
482
492
class
IntEmpiricalVariable
:
public
EmpiricalVariable
493
{
494
public
:
495
IntEmpiricalVariable
();
496
};
497
507
class
DeterministicVariable
:
public
RandomVariable
508
{
509
public
:
521
explicit
DeterministicVariable
(
double
* d, uint32_t c);
522
};
523
546
class
LogNormalVariable
:
public
RandomVariable
547
{
548
public
:
553
LogNormalVariable
(
double
mu,
double
sigma);
554
};
555
571
class
GammaVariable
:
public
RandomVariable
572
{
573
public
:
577
GammaVariable
();
578
583
GammaVariable
(
double
alpha,
double
beta);
584
594
double
GetValue
(
void
)
const
;
595
602
double
GetValue
(
double
alpha,
double
beta)
const
;
603
};
604
624
class
ErlangVariable
:
public
RandomVariable
625
{
626
public
:
630
ErlangVariable
();
631
636
ErlangVariable
(
unsigned
int
k,
double
lambda);
637
647
double
GetValue
(
void
)
const
;
648
655
double
GetValue
(
unsigned
int
k,
double
lambda)
const
;
656
};
657
673
class
ZipfVariable
:
public
RandomVariable
674
{
675
public
:
681
ZipfVariable
(
long
N,
double
alpha);
685
ZipfVariable
();
686
};
687
700
class
ZetaVariable
:
public
RandomVariable
701
{
702
public
:
707
ZetaVariable
(
double
alpha);
711
ZetaVariable
();
712
};
713
721
class
TriangularVariable
:
public
RandomVariable
722
{
723
public
:
728
TriangularVariable
();
729
737
TriangularVariable
(
double
s
,
double
l,
double
mean);
738
739
};
740
741
std::ostream &
operator <<
(std::ostream &os,
const
RandomVariable
&var);
742
std::istream &
operator >>
(std::istream &os,
RandomVariable
&var);
743
749
ATTRIBUTE_VALUE_DEFINE
(
RandomVariable
);
750
ATTRIBUTE_CHECKER_DEFINE
(
RandomVariable
);
751
ATTRIBUTE_ACCESSOR_DEFINE
(
RandomVariable
);
752
753
}
// namespace ns3
754
755
#endif
/* NS3_RANDOM_VARIABLE_H */
src
core
model
random-variable.h
Generated on Fri Aug 30 2013 01:42:47 for ns-3 by
1.8.1.2