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) {
virtual unsigned long int operator()(void)
Return next cutoff value.
const Gecode::FloatNum step
virtual unsigned long int operator()(void)
Return next cutoff value.
static Cutoff * geometric(unsigned long int scale=1U, double base=1.5)
Cutoff generator appending two cutoff generators.
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
virtual ~CutoffAppend(void)
Destructor.
Cutoff generator for the Luby sequence.
Base class for cutoff generators for restart-based meta engine.
virtual unsigned long int operator()(void)
Return next cutoff value.
virtual unsigned long int operator()(void)
Return next cutoff value.
static Cutoff * repeat(Cutoff *c, unsigned long int n)
Create generator that repeats n times each cutoff value from c.
Gecode::FloatVal c(-8, 8)
Gecode::IntArgs i(4, 1, 2, 3, 4)
Cutoff generator for the random sequence.
int n
Number of negative literals for node type.
virtual ~CutoffRepeat(void)
Destructor.
static Cutoff * linear(unsigned long int scale=1U)
Create generator for linear sequence scaled by scale.
static Cutoff * rnd(unsigned int seed, unsigned long int min, unsigned long int max, unsigned long int n)
static Cutoff * constant(unsigned long int scale=1U)
Create generator for constant sequence with constant s.
virtual unsigned long int operator()(void)
Return next cutoff value.
Cutoff generator for linear sequence.
Cutoff generator for the geometric sequence.
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
static Cutoff * append(Cutoff *c1, unsigned long int n, Cutoff *c2)
Append cutoff values from c2 after n values from c1.
Cutoff generator for constant sequence.
static Cutoff * luby(unsigned long int scale=1U)
Create generator for luby sequence with scale-factor scale.
Cutoff generator that repeats a cutoff from another cutoff generator.
virtual unsigned long int operator()(void)
Return next cutoff value.
Gecode toplevel namespace
void exp(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
#define GECODE_NEVER
Assert that this command is never executed.