70 boost::uint64_t m_numPermutationsProcessed{0};
72 size_t m_maxoffset{0};
74 boost::minstd_rand m_rng;
75 std::vector<boost::random::uniform_int_distribution<>> m_distributions;
83 for (
size_t i = 0; i < m_permutation.size(); ++i) {
84 m_distributions.emplace_back(0, m_permutation[i] - 1);
87 using EnumerationStrategyBase::initialize;
91 m_distributions.clear();
92 m_permutation.resize(m_permutationSizes.size());
95 *std::max_element(m_permutationSizes.begin(), m_permutationSizes.end());
96 for (
size_t i = 0; i < m_permutationSizes.size(); ++i) {
97 m_distributions.emplace_back(0, m_permutationSizes[i] - 1);
100 m_numPermutationsProcessed = 0;
103 const char *
type()
const override {
return "RandomSampleAllBBsStrategy"; }
107 if (m_offset >= m_maxoffset) {
108 for (
size_t i = 0; i < m_permutation.size(); ++i) {
109 m_permutation[i] = m_distributions[i](m_rng);
113 for (
size_t i = 0; i < m_permutation.size(); ++i) {
114 m_permutation[i] = (m_permutation[i] + 1) % m_permutationSizes[i];
118 ++m_numPermutationsProcessed;
120 return m_permutation;
124 return m_numPermutationsProcessed;
127 operator bool()
const override {
return true; }
134#ifdef RDK_USE_BOOST_SERIALIZATION
135 friend class boost::serialization::access;
137 template <
class Archive>
138 void save(Archive &ar,
const unsigned int )
const {
140 ar << boost::serialization::base_object<const EnumerationStrategyBase>(
142 ar << m_numPermutationsProcessed;
144 std::stringstream random;
146 std::string s = random.str();
153 template <
class Archive>
154 void load(Archive &ar,
const unsigned int ) {
156 ar >> boost::serialization::base_object<EnumerationStrategyBase>(*
this);
157 ar >> m_numPermutationsProcessed;
160 std::stringstream random(s);
166 m_distributions.clear();
167 for (
size_t i = 0; i < m_permutationSizes.size(); ++i) {
168 m_distributions.emplace_back(0, m_permutationSizes[i] - 1);
172 template <
class Archive>
173 void serialize(Archive &ar,
const unsigned int file_version) {
174 boost::serialization::split_member(ar, *
this, file_version);