45 namespace Gecode {
namespace Search {
48 CutoffConstant::CutoffConstant(
unsigned long int c0)
51 CutoffConstant::operator ()(
void)
const {
55 CutoffConstant::operator ++(
void) {
61 CutoffLinear::CutoffLinear(
unsigned long int s)
75 CutoffLuby::start[CutoffLuby::n_start] = {
76 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,
77 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
80 CutoffLuby::CutoffLuby(
unsigned long int scale0)
81 :
i(1U), scale(scale0) {}
83 CutoffLuby::log(
unsigned long int i) {
86 unsigned long int exp = 0U;
87 while ( (i >> (++exp)) > 1U ) {}
91 CutoffLuby::luby(
unsigned long int i) {
95 unsigned long int l = log(i);
96 if (i == (1U<<(l+1))-1)
105 return scale*luby(i);
109 return scale*luby(i++);
114 CutoffGeometric::CutoffGeometric(
unsigned long int scale0,
double base0)
115 :
n(1.0), scale(static_cast<double>(scale0)), base(base0) {}
129 cur = min+step*rnd(n);
133 CutoffRandom::CutoffRandom(
unsigned int seed,
134 unsigned long int min0,
135 unsigned long int max0,
136 unsigned long int n0)
137 : rnd(seed),
min(min0),
n(n0 == 0 ? (max0-
min+1U) : n0),
139 static_cast<unsigned long int>((max0-min0+1U)/
n))) {
150 : c1(d1), c2(d2),
n(n0) {}
170 delete c1;
delete c2;
189 delete c1;
delete c2;
194 CutoffRepeat::CutoffRepeat(
Cutoff* c1,
unsigned long int n0)
195 :
c(c1), i(0),
n(n0) {
235 unsigned long int min,
236 unsigned long int max,
237 unsigned long int n) {
const Gecode::FloatNum step
virtual unsigned long int operator()(void) const
Return the current cutoff value.
virtual unsigned long int operator++(void)
Increment and return the next cutoff value.
static Cutoff * merge(Cutoff *c1, Cutoff *c2)
Merge cutoff values from c1 with values from c2.
virtual unsigned long int operator()(void) const
Return the current cutoff value.
static Cutoff * geometric(unsigned long int scale=1U, double base=1.5)
Cutoff generator appending two cutoff generators.
virtual unsigned long int operator++(void)
Increment and return the next cutoff value.
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
virtual unsigned long int operator++(void)
Increment and return the next cutoff value.
virtual ~CutoffAppend(void)
Destructor.
Cutoff generator for the Luby sequence.
Base class for cutoff generators for restart-based meta engine.
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)
Cutoff generator merging two cutoff generators.
virtual unsigned long int operator++(void)
Increment and return the next cutoff value.
Gecode::IntArgs i(4, 1, 2, 3, 4)
Cutoff generator for the random sequence.
int n
Number of negative literals for node type.
virtual unsigned long int operator()(void) const
Return the current cutoff value.
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.
Cutoff generator for linear sequence.
virtual ~CutoffMerge(void)
Destructor.
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.
virtual unsigned long int operator()(void) const
Return the current cutoff value.
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) const
Return the current cutoff value.
virtual unsigned long int operator()(void) const
Return the current cutoff value.
virtual unsigned long int operator++(void)
Increment and return the next cutoff value.
virtual unsigned long int operator()(void) const
Return the current 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.
virtual unsigned long int operator++(void)
Increment and return the next cutoff value.
virtual unsigned long int operator++(void)
Increment and return the next cutoff value.