Generated on Sat May 25 2013 18:00:40 for Gecode by doxygen 1.8.3.1
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-03-12 16:42:52 +0100 (Tue, 12 Mar 2013) $ by $Author: schulte $
15  * $Revision: 13504 $
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  Cutoff::Cutoff(void) {}
154  forceinline void*
155  Cutoff::operator new(size_t s) {
156  return heap.ralloc(s);
157  }
158  forceinline void
159  Cutoff::operator delete(void* p) {
160  heap.rfree(p);
161  }
162 
163 }}
164 
165 // STATISTICS: search-other