Generated on Tue Jun 4 2019 05:23:33 for Gecode by doxygen 1.8.15
cutoff.hpp
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * Guido Tack <tack@gecode.org>
5  *
6  * Contributing authors:
7  * Christian Schulte <schulte@gecode.org>
8  *
9  * Copyright:
10  * Christian Schulte, 2013
11  * Guido Tack, 2013
12  *
13  * Last modified:
14  * $Date: 2013-10-30 13:25:29 +0100 (Wed, 30 Oct 2013) $ by $Author: schulte $
15  * $Revision: 14036 $
16  *
17  * This file is part of Gecode, the generic constraint
18  * development environment:
19  * http://www.gecode.org
20  *
21  * Permission is hereby granted, free of charge, to any person obtaining
22  * a copy of this software and associated documentation files (the
23  * "Software"), to deal in the Software without restriction, including
24  * without limitation the rights to use, copy, modify, merge, publish,
25  * distribute, sublicense, and/or sell copies of the Software, and to
26  * permit persons to whom the Software is furnished to do so, subject to
27  * the following conditions:
28  *
29  * The above copyright notice and this permission notice shall be
30  * included in all copies or substantial portions of the Software.
31  *
32  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
33  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
34  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
35  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
36  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
37  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
38  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
39  *
40  */
41 
42 namespace Gecode { namespace Search {
43 
45  class CutoffConstant : public Cutoff {
46  friend class Cutoff;
47  private:
49  unsigned long int c;
51  CutoffConstant(unsigned long int c);
52  public:
54  virtual unsigned long int operator() (void);
55  };
56 
58  class CutoffLinear : public Cutoff {
59  friend class Cutoff;
60  private:
62  unsigned long int scale;
64  unsigned long int n;
66  CutoffLinear(unsigned long int scale);
67  public:
69  virtual unsigned long int operator() (void);
70  };
71 
73  class CutoffLuby : public Cutoff {
74  friend class Cutoff;
75  private:
77  unsigned long int i;
79  unsigned long int scale;
81  static const unsigned long int n_start = 63U;
83  static unsigned long int start[n_start];
85  static unsigned long int log(unsigned long int i);
87  static unsigned long int luby(unsigned long int i);
89  CutoffLuby(unsigned long int scale);
90  public:
92  virtual unsigned long int operator() (void);
93  };
94 
96  class CutoffGeometric : public Cutoff {
97  friend class Cutoff;
98  private:
100  double n;
102  double base;
104  CutoffGeometric(unsigned long int scale, double base);
105  public:
107  virtual unsigned long int operator ()(void);
108  };
109 
111  class CutoffRandom : public Cutoff {
112  friend class Cutoff;
113  private:
117  unsigned long int min;
119  unsigned long int n;
121  unsigned long int step;
123  CutoffRandom(unsigned int seed,
124  unsigned long int min, unsigned long int max,
125  unsigned long int n);
126  public:
128  virtual unsigned long int operator ()(void);
129  };
130 
132  class CutoffAppend : public Cutoff {
133  friend class Cutoff;
134  private:
136  Cutoff* c1;
138  Cutoff* c2;
140  unsigned long int n;
142  CutoffAppend(Cutoff* c1, unsigned long int n, Cutoff* c2);
143  public:
145  virtual unsigned long int operator ()(void);
147  virtual ~CutoffAppend(void);
148  };
149 
151  class CutoffRepeat : public Cutoff {
152  friend class Cutoff;
153  private:
155  Cutoff* c;
156  // Current cutoff
157  unsigned int cutoff;
158  // Iteration
159  unsigned long int i;
160  // Number of repetitions
161  unsigned long int n;
163  CutoffRepeat(Cutoff* c, unsigned long int n);
164  public:
166  virtual unsigned long int operator ()(void);
168  virtual ~CutoffRepeat(void);
169  };
170 
172  Cutoff::Cutoff(void) {}
175  forceinline void*
176  Cutoff::operator new(size_t s) {
177  return heap.ralloc(s);
178  }
179  forceinline void
180  Cutoff::operator delete(void* p) {
181  heap.rfree(p);
182  }
183 
184 }}
185 
186 // STATISTICS: search-other
virtual unsigned long int operator()(void)
Return next cutoff value.
Definition: cutoff.cpp:95
const Gecode::FloatNum step
Definition: arithmetic.cpp:789
Cutoff(void)
Default constructor.
Definition: cutoff.hpp:172
virtual unsigned long int operator()(void)
Return next cutoff value.
Definition: cutoff.cpp:104
void log(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Definition: arithmetic.cpp:151
virtual ~Cutoff(void)
Destructor.
Definition: cutoff.hpp:174
void rfree(void *p)
Free memory block starting at p.
Definition: heap.hpp:355
Cutoff generator appending two cutoff generators.
Definition: cutoff.hpp:132
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:57
virtual ~CutoffAppend(void)
Destructor.
Definition: cutoff.cpp:138
void * ralloc(size_t s)
Allocate s bytes from heap.
Definition: heap.hpp:341
Cutoff generator for the Luby sequence.
Definition: cutoff.hpp:73
Base class for cutoff generators for restart-based meta engine.
Definition: search.hh:389
virtual unsigned long int operator()(void)
Return next cutoff value.
Definition: cutoff.cpp:120
virtual unsigned long int operator()(void)
Return next cutoff value.
Definition: cutoff.cpp:149
Heap heap
The single global heap.
Definition: heap.cpp:49
Gecode::FloatVal c(-8, 8)
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:236
const FloatNum min
Smallest allowed float value.
Definition: float.hh:833
Gecode::IntArgs i(4, 1, 2, 3, 4)
Cutoff generator for the random sequence.
Definition: cutoff.hpp:111
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:238
virtual ~CutoffRepeat(void)
Destructor.
Definition: cutoff.cpp:159
virtual unsigned long int operator()(void)
Return next cutoff value.
Definition: cutoff.cpp:59
Template for linear congruential generators.
Definition: random.hpp:50
Cutoff generator for linear sequence.
Definition: cutoff.hpp:58
Cutoff generator for the geometric sequence.
Definition: cutoff.hpp:96
virtual unsigned long int operator()(void)
Return next cutoff value.
Definition: cutoff.cpp:50
Cutoff generator for constant sequence.
Definition: cutoff.hpp:45
#define forceinline
Definition: config.hpp:167
Cutoff generator that repeats a cutoff from another cutoff generator.
Definition: cutoff.hpp:151
virtual unsigned long int operator()(void)
Return next cutoff value.
Definition: cutoff.cpp:129
Gecode toplevel namespace