1#ifndef CYCLUS_SRC_RNG_H
2#define CYCLUS_SRC_RNG_H
4#include <boost/random.hpp>
17typedef boost::random::variate_generator<Generator&, boost::random::normal_distribution<> >
NormalDist;
21 friend class ::SimInitTest;
22 friend class ::RandomTest;
60 boost::random::normal_distribution<> dist(
mean,
std_dev);
80 double high=std::numeric_limits<double>::max());
85 int high=std::numeric_limits<int>::max());
91 typedef boost::shared_ptr<DoubleDistribution>
Ptr;
94 virtual double max() = 0;
101 typedef boost::shared_ptr<FixedDoubleDist>
Ptr;
104 virtual double sample() {
return value; };
105 virtual double max() {
return value; };
110 boost::random::uniform_real_distribution<> dist;
112 typedef boost::shared_ptr<UniformDoubleDist>
Ptr;
115 virtual double sample() {
return dist(RandomNumberGenerator::gen_); }
116 virtual double max() {
return dist.max(); }
121 boost::random::normal_distribution<> dist;
125 typedef boost::shared_ptr<NormalDoubleDist>
Ptr;
129 throw ValueError(
"Min and max cannot be equal for a normal distribution. Either use FixedDoubleDist or change the min/max.");
132 Warn<VALUE_WARNING>(
"Dist is sampling from a tail of a truncated normal more than 3 standard deviations from the mean. Drawing sampling may be inefficient");
136 virtual double max() {
return max_; }
141 typedef boost::shared_ptr<IntDistribution>
Ptr;
149 typedef boost::shared_ptr<FixedIntDist>
Ptr;
157 boost::random::uniform_int_distribution<> dist;
159 typedef boost::shared_ptr<UniformIntDist>
Ptr;
162 virtual int sample() {
return dist(RandomNumberGenerator::gen_); }
163 virtual int max() {
return dist.max(); }
168 boost::random::normal_distribution<> dist;
172 typedef boost::shared_ptr<NormalIntDist>
Ptr;
176 throw ValueError(
"Min and max cannot be equal for a normal distribution. Either use FixedIntDist or change the min/max.");
179 Warn<VALUE_WARNING>(
"Dist is sampling from a tail of a truncated normal more than 3 standard deviations from the mean. Drawing sampling may be inefficient");
183 virtual int max() {
return max_; }
boost::shared_ptr< DoubleDistribution > Ptr
virtual double sample()=0
FixedDoubleDist(double value_)
boost::shared_ptr< FixedDoubleDist > Ptr
boost::shared_ptr< FixedIntDist > Ptr
boost::shared_ptr< IntDistribution > Ptr
boost::shared_ptr< NormalDoubleDist > Ptr
NormalDoubleDist(double mean, double std_dev, double min=0, double max=1)
NormalIntDist(double mean, double std_dev, int min=0, int max=1)
boost::shared_ptr< NormalIntDist > Ptr
A random number generator.
double random_01()
wrappers for boost::random distributions
int random_uniform_int(int low, int high)
generate a random integer between [low, high)
double random_uniform_real(double low, double high)
generate a random real number between [low, high)
void Initialize(SimInfo si)
Initialize from seed.
double random_normal_real(double mean, double std_dev, double low=0, double high=std::numeric_limits< double >::max())
generate a double from a normal distribution, with truncation at low and high
int random_normal_int(double mean, double std_dev, int low=0, int high=std::numeric_limits< int >::max())
generates an integer from a normal distribution, with truncation uses rounding to convert double to i...
static NormalDist makeNormalDist(double mean, double std_dev, double min, double max)
Container for a static simulation-global parameters that both describe the simulation and affect its ...
For values that are too big, too small, etc.
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or....
boost::random::mt19937 Generator
T OptionalQuery(InfileTree *tree, std::string query, T default_val)
a query method for optional parameters
boost::random::variate_generator< Generator &, boost::random::normal_distribution<> > NormalDist