Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

HyperExponentialRandomVariable Class Reference

#include <ranvar.h>

Inheritance diagram for HyperExponentialRandomVariable:

Inheritance graph
[legend]
Collaboration diagram for HyperExponentialRandomVariable:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual double value ()
 HyperExponentialRandomVariable ()
 HyperExponentialRandomVariable (double, double)
double * avgp ()
double * covp ()
virtual double avg ()
double cov ()
void setavg (double d)
void setcov (double d)
int command (int argc, const char *const *argv)
int seed (char *)

Protected Attributes

RNGrng_

Private Attributes

double avg_
double cov_
double alpha_

Constructor & Destructor Documentation

HyperExponentialRandomVariable::HyperExponentialRandomVariable  ) 
 

Definition at line 257 of file ranvar.cc.

References alpha_, avg_, and cov_.

00258 {
00259         bind("avg_", &avg_);
00260         bind("cov_", &cov_);
00261         alpha_ = .95;
00262 }

HyperExponentialRandomVariable::HyperExponentialRandomVariable double  ,
double 
 

Definition at line 264 of file ranvar.cc.

References alpha_, avg_, and cov_.

00265 {
00266         alpha_ = .95;
00267         avg_ = avg;
00268         cov_ = cov;
00269 }


Member Function Documentation

virtual double HyperExponentialRandomVariable::avg  )  [inline, virtual]
 

Implements RandomVariable.

Definition at line 157 of file ranvar.h.

References avg_.

00157 { return avg_; };

double* HyperExponentialRandomVariable::avgp  )  [inline]
 

Definition at line 155 of file ranvar.h.

References avg_.

00155 { return &avg_; };

int RandomVariable::command int  argc,
const char *const *  argv
[inherited]
 

Reimplemented in EmpiricalRandomVariable.

Definition at line 32 of file ranvar.cc.

References RandomVariable::rng_, and RandomVariable::value().

Referenced by EmpiricalRandomVariable::command().

00033 {
00034         Tcl& tcl = Tcl::instance();
00035 
00036         if (argc == 2) {
00037                 if (strcmp(argv[1], "value") == 0) {
00038                         tcl.resultf("%6e", value());
00039                         return(TCL_OK);
00040                 }
00041         }
00042         if (argc == 3) {
00043                 if (strcmp(argv[1], "use-rng") == 0) {
00044                         rng_ = (RNG*)TclObject::lookup(argv[2]);
00045                         if (rng_ == 0) {
00046                                 tcl.resultf("no such RNG %s", argv[2]);
00047                                 return(TCL_ERROR);
00048                         }
00049                         return(TCL_OK);
00050                 }
00051         }
00052         return(TclObject::command(argc, argv));
00053 }

Here is the call graph for this function:

double HyperExponentialRandomVariable::cov  )  [inline]
 

Definition at line 158 of file ranvar.h.

References cov_.

00158 { return cov_; };

double* HyperExponentialRandomVariable::covp  )  [inline]
 

Definition at line 156 of file ranvar.h.

References cov_.

00156 { return &cov_; };

int RandomVariable::seed char *   )  [inherited]
 

Definition at line 60 of file ranvar.cc.

References RandomVariable::rng_.

Referenced by EXPOO_Traffic::command().

00060                                 {
00061         
00062         Tcl& tcl = Tcl::instance();
00063 
00064                 rng_ = (RNG*)TclObject::lookup(x);
00065                 if (rng_ == 0) {
00066                         tcl.resultf("no such RNG %s", x);
00067                         return(TCL_ERROR);
00068                 }
00069                 return(TCL_OK);
00070  
00071 }

void HyperExponentialRandomVariable::setavg double  d  )  [inline]
 

Definition at line 159 of file ranvar.h.

References avg_.

00159 { avg_ = d; };

void HyperExponentialRandomVariable::setcov double  d  )  [inline]
 

Definition at line 160 of file ranvar.h.

References cov_.

00160 { cov_ = d; };

double HyperExponentialRandomVariable::value  )  [virtual]
 

Implements RandomVariable.

Definition at line 271 of file ranvar.cc.

References alpha_, avg_, cov_, Random::exponential(), and Random::uniform().

00272 {
00273         double temp, res;
00274         double u = Random::uniform();
00275 
00276         temp = sqrt((cov_ * cov_ - 1.0)/(2.0 * alpha_ * (1.0 - alpha_)));
00277         if (u < alpha_)
00278                 res = Random::exponential(avg_ - temp * (1.0 - alpha_) * avg_);
00279         else
00280                 res = Random::exponential(avg_ + temp * (alpha_) * avg_);
00281         return(res);
00282 }

Here is the call graph for this function:


Member Data Documentation

double HyperExponentialRandomVariable::alpha_ [private]
 

Definition at line 164 of file ranvar.h.

Referenced by HyperExponentialRandomVariable(), and value().

double HyperExponentialRandomVariable::avg_ [private]
 

Definition at line 162 of file ranvar.h.

Referenced by avg(), avgp(), HyperExponentialRandomVariable(), setavg(), and value().

double HyperExponentialRandomVariable::cov_ [private]
 

Definition at line 163 of file ranvar.h.

Referenced by cov(), covp(), HyperExponentialRandomVariable(), setcov(), and value().

RNG* RandomVariable::rng_ [protected, inherited]
 

Definition at line 41 of file ranvar.h.

Referenced by RandomVariable::command(), RandomVariable::RandomVariable(), RandomVariable::seed(), EmpiricalRandomVariable::value(), LogNormalRandomVariable::value(), NormalRandomVariable::value(), ParetoIIRandomVariable::value(), ParetoRandomVariable::value(), ExponentialRandomVariable::value(), and UniformRandomVariable::value().


The documentation for this class was generated from the following files:
Generated on Tue Apr 20 12:52:14 2004 for NS2.26SourcesOriginal by doxygen 1.3.3