44 namespace Gecode {
namespace Search {
47 CutoffConstant::CutoffConstant(
unsigned long int c0)
50 CutoffConstant::operator ()(
void) {
56 CutoffLinear::CutoffLinear(
unsigned long int s)
66 CutoffLuby::start[CutoffLuby::n_start] = {
67 1,1,2,1,1,2,4,1,1,2,1,1,2,4,8,1,1,2,1,1,2,4,1,1,2,1,1,2,4,8,16,
68 1,1,2,1,1,2,4,1,1,2,1,1,2,4,8,1,1,2,1,1,2,4,1,1,2,1,1,2,4,8,16,32
71 CutoffLuby::CutoffLuby(
unsigned long int scale0)
72 :
i(1U), scale(scale0) {}
74 CutoffLuby::log(
unsigned long int i) {
77 unsigned long int exp = 0U;
78 while ( (i >> (++exp)) > 1U ) {}
82 CutoffLuby::luby(
unsigned long int i) {
86 unsigned long int l = log(i);
87 if (i == (1U<<(l+1))-1)
96 return scale*luby(i++);
101 CutoffGeometric::CutoffGeometric(
unsigned long int scale,
double base0)
102 :
n(static_cast<double>(scale)), base(base0) {}
105 unsigned long int oldn =
static_cast<unsigned long int>(n);
112 CutoffRandom::CutoffRandom(
unsigned int seed,
113 unsigned long int min0,
114 unsigned long int max0,
115 unsigned long int n0)
116 : rnd(seed),
min(min0),
n(n0 == 0 ? (max0-
min+1U) : n0),
118 static_cast<unsigned long int>((max0-min0+1U)/
n))) {}
121 return min+step*rnd(n);
127 : c1(d1), c2(d2),
n(n0) {}
139 delete c1;
delete c2;
144 CutoffRepeat::CutoffRepeat(
Cutoff* c1,
unsigned long int n0)
145 :
c(c1), i(0),
n(n0) {
150 unsigned long int current = cutoff;
182 unsigned long int min,
183 unsigned long int max,
184 unsigned long int n) {