21#ifndef OPAL_LATIN_HYPERCUBE_H
22#define OPAL_LATIN_HYPERCUBE_H
34 typedef typename std::uniform_real_distribution<double>
dist_t;
59 void create(boost::shared_ptr<SampleIndividual>& ind, std::size_t i) {
72 int nSamples = args->getArg<
int>(
"nsamples",
true);
73 int nMasters = args->getArg<
int>(
"num-masters",
true);
75 int nLocSamples = nSamples / nMasters;
76 int rest = nSamples - nMasters * nLocSamples;
84 startBin = nLocSamples * id;
87 startBin = nLocSamples * id;
89 startBin = (nLocSamples + 1) * rest + (
id - rest) * nLocSamples;
110 std::size_t bin =
bin_m.back();
116 void fillBins_m(std::size_t nTotal, std::size_t nLocal,
int startBin,
119 std::deque<std::size_t> tmp;
121 std::iota(tmp.begin(), tmp.end(), 0);
124 std::mt19937_64 eng(
seed);
125 std::shuffle(tmp.begin(), tmp.end(), eng);
128 std::copy(tmp.begin()+startBin,
129 tmp.begin()+startBin+nLocal,
130 std::back_inserter(
bin_m));
boost::shared_ptr< CmdArguments > CmdArguments_t
int seed
The current random seed.
void create(boost::shared_ptr< SampleIndividual > &ind, std::size_t i)
LatinHyperCube(double lower, double upper, int seed)
RNGStream * RNGInstance_m
double map2domain_m(double val)
void allocate(const CmdArguments_t &args, const Comm::Bundle_t &comm)
std::deque< std::size_t > bin_m
LatinHyperCube(double lower, double upper)
void fillBins_m(std::size_t nTotal, std::size_t nLocal, int startBin, std::size_t seed)
std::uniform_real_distribution< double > dist_t
static RNGStream * getInstance()
static void deleteInstance(RNGStream *&generator)
DISTR::result_type getNext(DISTR &RNGDist)
bundles all communicators for a specific role/pid