boost::random::hyperexponential_distribution
// In header: <boost/random/hyperexponential_distribution.hpp> template<typename RealT = double> class hyperexponential_distribution { public: // types typedef RealT result_type; typedef RealT input_type; // member classes/structs/unions class param_type { public: // types typedef hyperexponential_distribution distribution_type; // public member functions param_type(); template<typename ProbIterT, typename RateIterT> param_type(ProbIterT, ProbIterT, RateIterT, RateIterT); template<typename ProbRangeT, typename RateRangeT> param_type(ProbRangeT const &, RateRangeT const &, typename boost::disable_if_c< boost::has_pre_increment< ProbRangeT >::value||boost::has_pre_increment< RateRangeT >::value >::type * = 0); template<typename RateIterT> param_type(RateIterT, RateIterT, typename boost::enable_if_c< boost::has_pre_increment< RateIterT >::value >::type * = 0); template<typename RateRangeT> param_type(RateRangeT const &); param_type(std::initializer_list< RealT >, std::initializer_list< RealT >); param_type(std::initializer_list< RealT >); std::vector< RealT > probabilities() const; std::vector< RealT > rates() const; // friend functions template<typename CharT, typename Traits> std::basic_ostream< CharT, Traits > & operator<<(std::basic_ostream< CharT, Traits > &, const param_type &); template<typename CharT, typename Traits> std::basic_istream< CharT, Traits > & operator>>(std::basic_istream< CharT, Traits > &, const param_type &); bool operator==(const param_type &, const param_type &); bool operator!=(const param_type &, const param_type &); }; // public member functions hyperexponential_distribution(); template<typename ProbIterT, typename RateIterT> hyperexponential_distribution(ProbIterT, ProbIterT, RateIterT, RateIterT); template<typename ProbRangeT, typename RateRangeT> hyperexponential_distribution(ProbRangeT const &, RateRangeT const &, typename boost::disable_if_c< boost::has_pre_increment< ProbRangeT >::value||boost::has_pre_increment< RateRangeT >::value >::type * = 0); template<typename RateIterT> hyperexponential_distribution(RateIterT, RateIterT, typename boost::enable_if_c< boost::has_pre_increment< RateIterT >::value >::type * = 0); template<typename RateRangeT> hyperexponential_distribution(RateRangeT const &); explicit hyperexponential_distribution(param_type const &); hyperexponential_distribution(std::initializer_list< RealT > const &, std::initializer_list< RealT > const &); hyperexponential_distribution(std::initializer_list< RealT > const &); template<typename URNG> RealT operator()(URNG &) const; template<typename URNG> RealT operator()(URNG &, const param_type &) const; std::size_t num_phases() const; std::vector< RealT > probabilities() const; std::vector< RealT > rates() const; RealT min() const; RealT max() const; param_type param() const; void param(param_type const &); void reset(); // friend functions template<typename CharT, typename Traits> std::basic_ostream< CharT, Traits > & operator<<(std::basic_ostream< CharT, Traits > &, const hyperexponential_distribution &); template<typename CharT, typename Traits> std::basic_istream< CharT, Traits > & operator>>(std::basic_istream< CharT, Traits > &, const hyperexponential_distribution &); bool operator==(const hyperexponential_distribution &, const hyperexponential_distribution &); bool operator!=(const hyperexponential_distribution &, const hyperexponential_distribution &); };
超指数分布是一个实值连续分布,有两个参数:阶段概率向量 `probs` 和 速率向量 `rates`。
一个 -阶段的超指数分布是
个指数分布的混合。因此,它也被称为 混合指数分布 或 并行
-阶段指数分布。
一个 -阶段的超指数分布由两个参数表征,即 阶段概率向量
和 速率向量
。
一个 -阶段的超指数分布经常用于 排队论 中,用于模拟
个独立事件的叠加的分布,例如,一个具有
个并行服务器的排队站的服务时间分布,其中第
个服务器以概率
被选中,并且其服务时间分布是以速率
的指数分布(Allen,1990; Papadopolous et al.,1993; Trivedi,2002)。
例如,计算系统中的 CPU 服务时间分布经常被观察到具有这种分布(Rosin,1965)。此外,不同类型的客户到达单个排队站通常被建模为超指数分布(Papadopolous et al.,1993)。类似地,如果一个产品在多个并行装配线上生产,并且输出合并,则整个产品的故障密度很可能呈超指数分布(Trivedi,2002)。
最后,由于超指数分布具有很高的变异系数(CoV),即 CoV > 1,因此它特别适用于拟合具有大 CoV 的经验数据(Feitelson,2014; Wolski et al.,2013)以及近似 长尾概率分布(Feldmann et al.,1998)。
有关更多信息和示例,请参阅(Boost,2014)。
一个 -阶段的超指数分布具有概率密度函数
其中
是 阶段数 也是输入向量参数的大小,
是 阶段概率向量 参数,并且
是 速率向量 参数。
给定一个具有阶段概率向量 和速率向量
的
-阶段超指数分布,随机变量生成算法包含以下步骤(Tyszer,1999):
生成一个在区间 上均匀分布的随机变量
。
使用 来选择合适的
(例如,可以使用 别名方法 来完成此步骤)。
生成一个速率参数为 的指数分布随机变量
。
返回 。
参考文献
A.O. Allen, Probability, Statistics, and Queuing Theory with Computer Science Applications, Second Edition, Academic Press, 1990。
Boost C++ Libraries, Boost.Math / Statistical Distributions: Hyperexponential Distribution, Online: https://boost.ac.cn/doc/libs/release/libs/math/doc/html/dist.html , 2014。
D.G. Feitelson, Workload Modeling for Computer Systems Performance Evaluation, Cambridge University Press, 2014
A. Feldmann and W. Whitt, Fitting mixtures of exponentials to long-tail distributions to analyze network performance models, Performance Evaluation 31(3-4):245, doi:10.1016/S0166-5316(97)00003-5, 1998。
H.T. Papadopolous, C. Heavey and J. Browne, Queueing Theory in Manufacturing Systems Analysis and Design, Chapman & Hall/CRC, 1993, p. 35。
R.F. Rosin, Determining a computing center environment, Communications of the ACM 8(7):463-468, 1965。
K.S. Trivedi, Probability and Statistics with Reliability, Queueing, and Computer Science Applications, John Wiley & Sons, Inc., 2002。
J. Tyszer, Object-Oriented Computer Simulation of Discrete-Event Systems, Springer, 1999。
Wikipedia, Hyperexponential Distribution, Online: http://en.wikipedia.org/wiki/Hyperexponential_distribution , 2014。
Wolfram Mathematica, Hyperexponential Distribution, Online: http://reference.wolfram.com/language/ref/HyperexponentialDistribution.html , 2014。
Marco Guazzone (marco.guazzone@gmail.com)
hyperexponential_distribution();
构造一个具有速率 1 的 1-阶段 `hyperexponential_distribution`(即指数分布)。
template<typename ProbIterT, typename RateIterT> hyperexponential_distribution(ProbIterT prob_first, ProbIterT prob_last, RateIterT rate_first, RateIterT rate_last);
根据分布的 阶段概率向量 和 速率向量 参数构造一个 `hyperexponential_distribution`。
阶段概率向量 参数由 [prob_first, prob_last) 迭代器对定义的范围给出,而 速率向量 参数由 [rate_first, rate_last) 迭代器对定义的范围给出。
参考文献
ISO, ISO/IEC 14882-2014: Information technology - Programming languages - C++, 2014
参数 |
|
||||||||
模板参数 |
|
template<typename ProbRangeT, typename RateRangeT> hyperexponential_distribution(ProbRangeT const & prob_range, RateRangeT const & rate_range, typename boost::disable_if_c< boost::has_pre_increment< ProbRangeT >::value||boost::has_pre_increment< RateRangeT >::value >::type * = 0);
根据分布的 阶段概率向量 和 速率向量 参数构造一个 `hyperexponential_distribution`。
阶段概率向量 参数由 prob_range 定义的范围给出,而 速率向量 参数由 rate_range 定义的范围给出。
![]() |
注意 |
---|---|
最后的 `disable_if` 参数是一个实现细节,用于区分此双参数构造函数和下面描述的基于迭代器的双参数构造函数。 |
template<typename RateIterT> hyperexponential_distribution(RateIterT rate_first, RateIterT rate_last, typename boost::enable_if_c< boost::has_pre_increment< RateIterT >::value >::type * = 0);
根据分布的 速率向量 参数构造一个 `hyperexponential_distribution`,并具有相等的阶段概率。
速率向量参数由 [rate_first, rate_last) 迭代器对定义的范围给出,而阶段概率向量参数被设置为相等的阶段概率(即,一个与速率向量长度 相同的向量,每个元素设置为
)。
![]() |
注意 |
---|---|
最后的 `disable_if` 参数是一个实现细节,用于区分此双参数构造函数和上面描述的基于范围的双参数构造函数。 |
参考文献
ISO, ISO/IEC 14882-2014: Information technology - Programming languages - C++, 2014
参数 |
|
||||
模板参数 |
|
template<typename RateRangeT> hyperexponential_distribution(RateRangeT const & rate_range);
根据分布的“速率”参数构造一个 `param_type`,并具有相等的阶段概率。
速率向量参数由 rate_range 定义的范围给出,而阶段概率向量参数被设置为相等的阶段概率(即,一个与速率向量长度 相同的向量,每个元素设置为
)。
参数 |
|
||
模板参数 |
|
explicit hyperexponential_distribution(param_type const & param);
根据其参数构造一个 `hyperexponential_distribution`。
参数 |
|
hyperexponential_distribution(std::initializer_list< RealT > const & l1, std::initializer_list< RealT > const & l2);
根据分布的 阶段概率向量 和 速率向量 参数构造一个 `hyperexponential_distribution`。
阶段概率向量 参数由 l1 定义的 brace-init-list(ISO,2014,sec. 8.5.4 [dcl.init.list])给出,而 速率向量 参数由 l2 定义的 brace-init-list(ISO,2014,sec. 8.5.4 [dcl.init.list])给出。
参考文献
ISO, ISO/IEC 14882-2014: Information technology - Programming languages - C++, 2014
参数 |
|
hyperexponential_distribution(std::initializer_list< RealT > const & l1);
根据分布的 速率向量 参数构造一个 `hyperexponential_distribution`,并具有相等的阶段概率。
速率向量 参数由 l1 定义的 brace-init-list(ISO,2014,sec. 8.5.4 [dcl.init.list])给出,而 阶段概率向量 参数被设置为相等的阶段概率(即,一个与速率向量长度 相同的向量,每个元素设置为
)。
参考文献
ISO, ISO/IEC 14882-2014: Information technology - Programming languages - C++, 2014
参数 |
|
template<typename URNG> RealT operator()(URNG & urng) const;
获取按照超指数分布分布的随机变量。
参数 |
|
||
模板参数 |
|
||
返回 |
按照超指数分布分布的随机变量。 |
template<typename URNG> RealT operator()(URNG & urng, const param_type & param) const;
获取按照由 `param` 指定的参数的超指数分布分布的随机变量。
参数 |
|
||||
模板参数 |
|
||||
返回 |
按照由 `param` 指定的参数的超指数分布分布的随机变量。 |
std::size_t num_phases() const;
返回分布的阶段数。
std::vector< RealT > probabilities() const;
返回分布的 阶段概率向量 参数。
std::vector< RealT > rates() const;
返回分布的 速率向量 参数。
RealT min() const;
返回分布可以产生的最小值。
RealT max() const;
返回分布可以产生的最大值。
param_type param() const;
返回分布的参数。
void param(param_type const & param);
设置分布的参数。
void reset();
效果:随后的分布使用不依赖于调用 reset 之前的任何引擎生成的值。
template<typename CharT, typename Traits> std::basic_ostream< CharT, Traits > & operator<<(std::basic_ostream< CharT, Traits > & os, const hyperexponential_distribution & hd);
将 `hyperexponential_distribution` 写入 `std::ostream`。
template<typename CharT, typename Traits> std::basic_istream< CharT, Traits > & operator>>(std::basic_istream< CharT, Traits > & is, const hyperexponential_distribution & hd);
从 `std::istream` 读取 `hyperexponential_distribution`。
bool operator==(const hyperexponential_distribution & lhs, const hyperexponential_distribution & rhs);
如果两个 `hyperexponential_distribution` 实例在给定相等的生成器的情况下会返回相同的数值序列,则返回 true。
bool operator!=(const hyperexponential_distribution & lhs, const hyperexponential_distribution & rhs);
如果两个 `hyperexponential_distribution` 实例在给定相等的生成器的情况下会返回不同的数值序列,则返回 true。