|
|
| 576 |
/** |
576 |
/** |
| 577 |
* \brief Get the next random value, as an unsigned integer from |
577 |
* \brief Get the next random value, as an unsigned integer from |
| 578 |
* the exponential distribution with the specified mean and upper bound. |
578 |
* the exponential distribution with the specified mean and upper bound. |
| 579 |
* \param [in] mean Mean value of the unbounded exponential distributuion. |
579 |
* \param [in] mean Mean value of the unbounded exponential distribution. |
| 580 |
* \param [in] bound Upper bound on values returned. |
580 |
* \param [in] bound Upper bound on values returned. |
| 581 |
* \return A random unsigned integer value. |
581 |
* \return A random unsigned integer value. |
| 582 |
*/ |
582 |
*/ |
|
|
| 607 |
* The probability density function of a Pareto variable is defined |
607 |
* The probability density function of a Pareto variable is defined |
| 608 |
* over the range [\f$x_m\f$,\f$+\infty\f$) as: \f$ k \frac{x_m^k}{x^{k+1}}\f$ |
608 |
* over the range [\f$x_m\f$,\f$+\infty\f$) as: \f$ k \frac{x_m^k}{x^{k+1}}\f$ |
| 609 |
* where \f$x_m > 0\f$ is called the scale parameter and \f$ k > 0\f$ |
609 |
* where \f$x_m > 0\f$ is called the scale parameter and \f$ k > 0\f$ |
| 610 |
* is called the pareto index or shape. |
610 |
* is called the Pareto index or shape. |
| 611 |
* |
611 |
* |
| 612 |
* The parameter \f$ x_m \f$ can be infered from the mean and the parameter \f$ k \f$ |
612 |
* The parameter \f$ x_m \f$ can be inferred from the mean and the parameter \f$ k \f$ |
| 613 |
* with the equation \f$ x_m = mean \frac{k-1}{k}, k > 1\f$. |
613 |
* with the equation \f$ x_m = mean \frac{k-1}{k}, k > 1\f$. |
| 614 |
* |
614 |
* |
| 615 |
* Since Pareto distributions can theoretically return unbounded values, |
615 |
* Since Pareto distributions can theoretically return unbounded values, |
|
|
| 619 |
* |
619 |
* |
| 620 |
* Here is an example of how to use this class: |
620 |
* Here is an example of how to use this class: |
| 621 |
* \code |
621 |
* \code |
| 622 |
* double mean = 5.0; |
622 |
* double scale = 5.0; |
| 623 |
* double shape = 2.0; |
623 |
* double shape = 2.0; |
| 624 |
* |
624 |
* |
| 625 |
* Ptr<ParetoRandomVariable> x = CreateObject<ParetoRandomVariable> (); |
625 |
* Ptr<ParetoRandomVariable> x = CreateObject<ParetoRandomVariable> (); |
| 626 |
* x->SetAttribute ("Mean", DoubleValue (mean)); |
626 |
* x->SetAttribute ("Scale", DoubleValue (scale)); |
| 627 |
* x->SetAttribute ("Shape", DoubleValue (shape)); |
627 |
* x->SetAttribute ("Shape", DoubleValue (shape)); |
| 628 |
* |
628 |
* |
| 629 |
* // The expected value for the mean of the values returned by a |
629 |
* // The expected value for the mean of the values returned by a |
|
|
| 632 |
* // shape * scale |
632 |
* // shape * scale |
| 633 |
* // E[value] = --------------- , |
633 |
* // E[value] = --------------- , |
| 634 |
* // shape - 1 |
634 |
* // shape - 1 |
| 635 |
* // |
635 |
* |
| 636 |
* // where |
|
|
| 637 |
* // |
| 638 |
* // scale = mean * (shape - 1.0) / shape . |
| 639 |
* // |
| 640 |
* double value = x->GetValue (); |
636 |
* double value = x->GetValue (); |
| 641 |
* \endcode |
637 |
* \endcode |
| 642 |
*/ |
638 |
*/ |
|
|
| 659 |
* \brief Returns the mean parameter for the Pareto distribution returned by this RNG stream. |
655 |
* \brief Returns the mean parameter for the Pareto distribution returned by this RNG stream. |
| 660 |
* \return The mean parameter for the Pareto distribution returned by this RNG stream. |
656 |
* \return The mean parameter for the Pareto distribution returned by this RNG stream. |
| 661 |
*/ |
657 |
*/ |
|
|
658 |
NS_DEPRECATED |
| 662 |
double GetMean (void) const; |
659 |
double GetMean (void) const; |
| 663 |
|
660 |
|
| 664 |
/** |
661 |
/** |
|
|
662 |
* \brief Returns the scale parameter for the Pareto distribution returned by this RNG stream. |
| 663 |
* \return The scale parameter for the Pareto distribution returned by this RNG stream. |
| 664 |
*/ |
| 665 |
double GetScale (void) const; |
| 666 |
|
| 667 |
/** |
| 665 |
* \brief Returns the shape parameter for the Pareto distribution returned by this RNG stream. |
668 |
* \brief Returns the shape parameter for the Pareto distribution returned by this RNG stream. |
| 666 |
* \return The shape parameter for the Pareto distribution returned by this RNG stream. |
669 |
* \return The shape parameter for the Pareto distribution returned by this RNG stream. |
| 667 |
*/ |
670 |
*/ |
|
|
| 674 |
double GetBound (void) const; |
677 |
double GetBound (void) const; |
| 675 |
|
678 |
|
| 676 |
/** |
679 |
/** |
| 677 |
* \brief Returns a random double from a Pareto distribution with the specified mean, shape, and upper bound. |
680 |
* \brief Returns a random double from a Pareto distribution with the specified scale, shape, and upper bound. |
| 678 |
* \param [in] mean Mean parameter for the Pareto distribution. |
681 |
* \param [in] scale Mean parameter for the Pareto distribution. |
| 679 |
* \param [in] shape Shape parameter for the Pareto distribution. |
682 |
* \param [in] shape Shape parameter for the Pareto distribution. |
| 680 |
* \param [in] bound Upper bound on values returned. |
683 |
* \param [in] bound Upper bound on values returned. |
| 681 |
* \return A floating point random value. |
684 |
* \return A floating point random value. |
|
|
| 688 |
* x = \frac{scale}{u^{\frac{1}{shape}}} |
691 |
* x = \frac{scale}{u^{\frac{1}{shape}}} |
| 689 |
* \f] |
692 |
* \f] |
| 690 |
* |
693 |
* |
| 691 |
* is a value that would be returned normally, where |
694 |
* is a value that would be returned normally. |
| 692 |
* |
|
|
| 693 |
* \f[ |
| 694 |
* scale = mean * (shape - 1.0) / shape . |
| 695 |
* \f] |
| 696 |
* |
695 |
* |
| 697 |
* Then \f$(1 - u\f$) is the distance that \f$u\f$ would be from |
696 |
* The value returned in the antithetic case, \f$x'\f$, is |
| 698 |
* \f$1\f$. The value returned in the antithetic case, \f$x'\f$, is |
|
|
| 699 |
* calculated as |
697 |
* calculated as |
| 700 |
* |
698 |
* |
| 701 |
* \f[ |
699 |
* \f[ |
| 702 |
* x' = \frac{scale}{{(1 - u)}^{\frac{1}{shape}}} , |
700 |
* x' = \frac{scale}{{(1 - u)}^{\frac{1}{shape}}} , |
| 703 |
* \f] |
701 |
* \f] |
| 704 |
* |
702 |
* |
| 705 |
* which now involves the distance \f$u\f$ is from 1 in the denonator. |
703 |
* which now involves the distance \f$u\f$ is from 1 in the denominator. |
| 706 |
*/ |
704 |
*/ |
| 707 |
double GetValue (double mean, double shape, double bound); |
705 |
double GetValue (double scale, double shape, double bound); |
| 708 |
|
706 |
|
| 709 |
/** |
707 |
/** |
| 710 |
* \brief Returns a random unsigned integer from a Pareto distribution with the specified mean, shape, and upper bound. |
708 |
* \brief Returns a random unsigned integer from a Pareto distribution with the specified mean, shape, and upper bound. |
| 711 |
* \param [in] mean Mean parameter for the Pareto distribution. |
709 |
* \param [in] scale Scale parameter for the Pareto distribution. |
| 712 |
* \param [in] shape Shape parameter for the Pareto distribution. |
710 |
* \param [in] shape Shape parameter for the Pareto distribution. |
| 713 |
* \param [in] bound Upper bound on values returned. |
711 |
* \param [in] bound Upper bound on values returned. |
| 714 |
* \return A random unsigned integer value. |
712 |
* \return A random unsigned integer value. |
|
|
| 721 |
* x = \frac{scale}{u^{\frac{1}{shape}}} |
719 |
* x = \frac{scale}{u^{\frac{1}{shape}}} |
| 722 |
* \f] |
720 |
* \f] |
| 723 |
* |
721 |
* |
| 724 |
* is a value that would be returned normally, where |
722 |
* is a value that would be returned normally. |
| 725 |
* |
723 |
* |
| 726 |
* \f[ |
724 |
* The value returned in the antithetic case, \f$x'\f$, is |
| 727 |
* scale = mean * (shape - 1.0) / shape . |
|
|
| 728 |
* \f] |
| 729 |
* |
| 730 |
* Then \f$(1 - u\f$) is the distance that \f$u\f$ would be from |
| 731 |
* \f$1\f$. The value returned in the antithetic case, \f$x'\f$, is |
| 732 |
* calculated as |
725 |
* calculated as |
| 733 |
* |
726 |
* |
| 734 |
* \f[ |
727 |
* \f[ |
| 735 |
* x' = \frac{scale}{{(1 - u)}^{\frac{1}{shape}}} , |
728 |
* x' = \frac{scale}{{(1 - u)}^{\frac{1}{shape}}} , |
| 736 |
* \f] |
729 |
* \f] |
| 737 |
* |
730 |
* |
| 738 |
* which now involves the distance \f$u\f$ is from 1 in the denonator. |
731 |
* which now involves the distance \f$u\f$ is from 1 in the denominator. |
| 739 |
*/ |
732 |
*/ |
| 740 |
uint32_t GetInteger (uint32_t mean, uint32_t shape, uint32_t bound); |
733 |
uint32_t GetInteger (uint32_t scale, uint32_t shape, uint32_t bound); |
| 741 |
|
734 |
|
| 742 |
/** |
735 |
/** |
| 743 |
* \brief Returns a random double from a Pareto distribution with the current mean, shape, and upper bound. |
736 |
* \brief Returns a random double from a Pareto distribution with the current mean, shape, and upper bound. |
|
|
| 757 |
* scale = mean * (shape - 1.0) / shape . |
750 |
* scale = mean * (shape - 1.0) / shape . |
| 758 |
* \f] |
751 |
* \f] |
| 759 |
* |
752 |
* |
| 760 |
* Then \f$(1 - u\f$) is the distance that \f$u\f$ would be from |
753 |
* The value returned in the antithetic case, \f$x'\f$, is |
| 761 |
* \f$1\f$. The value returned in the antithetic case, \f$x'\f$, is |
|
|
| 762 |
* calculated as |
754 |
* calculated as |
| 763 |
* |
755 |
* |
| 764 |
* \f[ |
756 |
* \f[ |
| 765 |
* x' = \frac{scale}{{(1 - u)}^{\frac{1}{shape}}} , |
757 |
* x' = \frac{scale}{{(1 - u)}^{\frac{1}{shape}}} , |
| 766 |
* \f] |
758 |
* \f] |
| 767 |
* |
759 |
* |
| 768 |
* which now involves the distance \f$u\f$ is from 1 in the denonator. |
760 |
* which now involves the distance \f$u\f$ is from 1 in the denominator. |
| 769 |
* |
761 |
* |
| 770 |
* Note that we have to re-implement this method here because the method is |
762 |
* Note that we have to re-implement this method here because the method is |
| 771 |
* overloaded above for the three-argument variant and the c++ name resolution |
763 |
* overloaded above for the three-argument variant and the c++ name resolution |
|
|
| 786 |
* x = \frac{scale}{u^{\frac{1}{shape}}} |
778 |
* x = \frac{scale}{u^{\frac{1}{shape}}} |
| 787 |
* \f] |
779 |
* \f] |
| 788 |
* |
780 |
* |
| 789 |
* is a value that would be returned normally, where |
781 |
* is a value that would be returned normally. |
| 790 |
* |
782 |
* |
| 791 |
* \f[ |
783 |
* The value returned in the antithetic case, \f$x'\f$, is |
| 792 |
* scale = mean * (shape - 1.0) / shape . |
|
|
| 793 |
* \f] |
| 794 |
* |
| 795 |
* Then \f$(1 - u\f$) is the distance that \f$u\f$ would be from |
| 796 |
* \f$1\f$. The value returned in the antithetic case, \f$x'\f$, is |
| 797 |
* calculated as |
784 |
* calculated as |
| 798 |
* |
785 |
* |
| 799 |
* \f[ |
786 |
* \f[ |
| 800 |
* x' = \frac{scale}{{(1 - u)}^{\frac{1}{shape}}} , |
787 |
* x' = \frac{scale}{{(1 - u)}^{\frac{1}{shape}}} , |
| 801 |
* \f] |
788 |
* \f] |
| 802 |
* |
789 |
* |
| 803 |
* which now involves the distance \f$u\f$ is from 1 in the denonator. |
790 |
* which now involves the distance \f$u\f$ is from 1 in the denominator. |
| 804 |
*/ |
791 |
*/ |
| 805 |
virtual uint32_t GetInteger (void); |
792 |
virtual uint32_t GetInteger (void); |
| 806 |
|
793 |
|
|
|
| 808 |
/** The mean parameter for the Pareto distribution returned by this RNG stream. */ |
795 |
/** The mean parameter for the Pareto distribution returned by this RNG stream. */ |
| 809 |
double m_mean; |
796 |
double m_mean; |
| 810 |
|
797 |
|
|
|
798 |
/** The scale parameter for the Pareto distribution returned by this RNG stream. */ |
| 799 |
double m_scale; |
| 800 |
|
| 811 |
/** The shape parameter for the Pareto distribution returned by this RNG stream. */ |
801 |
/** The shape parameter for the Pareto distribution returned by this RNG stream. */ |
| 812 |
double m_shape; |
802 |
double m_shape; |
| 813 |
|
803 |
|