27 #ifndef BATCHING_POMP_UTIL_BISECTPERM_HPP_ 28 #define BATCHING_POMP_UTIL_BISECTPERM_HPP_ 45 const std::vector< std::pair<int,int> > &
get(
int n)
47 std::map<int, const std::vector< std::pair<int,int> > >::iterator it;
49 if (it != cache.end())
56 std::vector< std::pair<int,int> > perm;
57 std::vector<bool> done(n,
false);
58 std::vector<int> dist(n);
65 if (done[i]) last_true = i;
66 dist[i] = (i-last_true);
69 for (i=n-1; i>=0; i--)
71 if (done[i]) last_true = i;
72 dist[i] = (last_true-i) < dist[i] ? (last_true-i) : dist[i];
76 for (i=0; i<n; i++)
if (max_val < dist[i])
83 perm.push_back(std::make_pair(max_i,max_val));
87 cache.insert(std::make_pair(n,perm));
93 std::map<int, const std::vector< std::pair<int,int> > > cache;
99 #endif // BATCHING_POMP_UTIL_BISECTPERM_HPP_ Generates a Van Der Corput sequence ordering for states to check along an edge.
Definition: BisectPerm.hpp:35
Definition: BatchingManager.hpp:36