this repo has no description
1/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2/*
3 * Main authors:
4 * Christian Schulte <schulte@gecode.org>
5 *
6 * Contributing authors:
7 * Guido Tack <tack@gecode.org>
8 *
9 * Copyright:
10 * Christian Schulte, 2004
11 * Guido Tack, 2004
12 *
13 * This file is part of Gecode, the generic constraint
14 * development environment:
15 * http://www.gecode.org
16 *
17 * Permission is hereby granted, free of charge, to any person obtaining
18 * a copy of this software and associated documentation files (the
19 * "Software"), to deal in the Software without restriction, including
20 * without limitation the rights to use, copy, modify, merge, publish,
21 * distribute, sublicense, and/or sell copies of the Software, and to
22 * permit persons to whom the Software is furnished to do so, subject to
23 * the following conditions:
24 *
25 * The above copyright notice and this permission notice shall be
26 * included in all copies or substantial portions of the Software.
27 *
28 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
32 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
33 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
34 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35 *
36 */
37
38#ifndef GECODE_KERNEL_HH
39#define GECODE_KERNEL_HH
40
41#include <cstddef>
42#include <cstdlib>
43#include <cstring>
44#include <cassert>
45
46#include <cfloat>
47
48#include <functional>
49
50#include <gecode/support.hh>
51
52/*
53 * Configure linking
54 *
55 */
56#if !defined(GECODE_STATIC_LIBS) && \
57 (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER))
58
59#ifdef GECODE_BUILD_KERNEL
60#define GECODE_KERNEL_EXPORT __declspec( dllexport )
61#else
62#define GECODE_KERNEL_EXPORT __declspec( dllimport )
63#endif
64
65#else
66
67#ifdef GECODE_GCC_HAS_CLASS_VISIBILITY
68#define GECODE_KERNEL_EXPORT __attribute__ ((visibility("default")))
69#else
70#define GECODE_KERNEL_EXPORT
71#endif
72
73#endif
74
75// Configure auto-linking
76#ifndef GECODE_BUILD_KERNEL
77#define GECODE_LIBRARY_NAME "Kernel"
78#include <gecode/support/auto-link.hpp>
79#endif
80
81/**
82 * \namespace Gecode
83 * \brief %Gecode toplevel namespace
84 *
85 * The Gecode namespace contains nested namespaces for
86 * the various submodules (for example Int for the
87 * definition of integer propagator classes). Functionality
88 * that is used for interfacing (search engines, variables,
89 * and so on) or belongs to the %Gecode %Kernel is contained
90 * directly in the Gecode namespace.
91 *
92 */
93
94namespace Gecode {
95
96 /// Kernel configuration parameters
97 namespace Kernel { namespace Config {
98 /// Rescale factor for action and afc values
99 const double rescale = 1e-50;
100 /// Rescale action and afc values when larger than this
101 const double rescale_limit = DBL_MAX * rescale;
102
103 /// Initial value for alpha in CHB
104 const double chb_alpha_init = 0.4;
105 /// Limit for decreasing alpha in CHB
106 const double chb_alpha_limit = 0.06;
107 /// Alpha decrement in CHB
108 const double chb_alpha_decrement = 1e-6;
109 /// Initial value for Q-score in CHB
110 const double chb_qscore_init = 0.05;
111 }}
112
113}
114
115/*
116 * General exceptions and kernel exceptions
117 *
118 */
119
120#include <gecode/kernel/exception.hpp>
121
122
123
124/*
125 * Basic kernel services and memory management
126 *
127 */
128
129#include <gecode/kernel/shared-object.hpp>
130#include <gecode/kernel/memory/config.hpp>
131#include <gecode/kernel/memory/manager.hpp>
132#include <gecode/kernel/memory/region.hpp>
133
134/*
135 * Macros for checking failure
136 *
137 */
138
139#include <gecode/kernel/macros.hpp>
140
141
142/*
143 * Gecode kernel
144 *
145 */
146
147#include <gecode/kernel/archive.hpp>
148#include <gecode/kernel/gpi.hpp>
149#include <gecode/kernel/shared-space-data.hpp>
150#include <gecode/kernel/core.hpp>
151#include <gecode/kernel/modevent.hpp>
152#include <gecode/kernel/range-list.hpp>
153
154
155/*
156 * Variables and testing for shared variables
157 *
158 */
159
160#include <gecode/kernel/var.hpp>
161
162
163/*
164 * Views
165 *
166 */
167
168#include <gecode/kernel/view.hpp>
169
170
171/*
172 * Arrays and other data
173 *
174 */
175
176#include <gecode/kernel/data/array.hpp>
177#include <gecode/kernel/data/shared-array.hpp>
178#include <gecode/kernel/data/shared-data.hpp>
179#include <gecode/kernel/data/rnd.hpp>
180
181
182/*
183 * Common propagator patterns
184 *
185 */
186
187#include <gecode/kernel/propagator/pattern.hpp>
188#include <gecode/kernel/propagator/subscribed.hpp>
189#include <gecode/kernel/propagator/advisor.hpp>
190#include <gecode/kernel/propagator/wait.hpp>
191
192
193/*
194 * Abstractions for branching
195 *
196 */
197
198namespace Gecode {
199
200 /**
201 * \defgroup TaskModelBranch Generic branching support
202 *
203 * Support for randomization and tie-breaking that are independent
204 * of a particular variable domain.
205 *
206 * \ingroup TaskModel
207 */
208
209 /**
210 * \defgroup TaskModelBranchExec Branch with a function
211 *
212 * This does not really branch (it just offers a single alternative) but
213 * executes a single function during branching. A typical
214 * application is to post more constraints after another brancher
215 * has finished.
216 *
217 * \ingroup TaskModelBranch
218 */
219 //@{
220 /// Call the function \a f (with the current space as argument) for branching
221 GECODE_KERNEL_EXPORT void
222 branch(Home home, std::function<void(Space& home)> f);
223 //@}
224
225}
226
227#include <gecode/kernel/branch/traits.hpp>
228#include <gecode/kernel/branch/action.hpp>
229#include <gecode/kernel/branch/afc.hpp>
230#include <gecode/kernel/branch/chb.hpp>
231#include <gecode/kernel/branch/var.hpp>
232#include <gecode/kernel/branch/val.hpp>
233#include <gecode/kernel/branch/tiebreak.hpp>
234#include <gecode/kernel/branch/merit.hpp>
235#include <gecode/kernel/branch/filter.hpp>
236#include <gecode/kernel/branch/view-sel.hpp>
237#include <gecode/kernel/branch/print.hpp>
238#include <gecode/kernel/branch/view.hpp>
239#include <gecode/kernel/branch/val-sel.hpp>
240#include <gecode/kernel/branch/val-commit.hpp>
241#include <gecode/kernel/branch/val-sel-commit.hpp>
242#include <gecode/kernel/branch/view-val.hpp>
243
244
245/*
246 * Automatically generated variable implementations
247 *
248 */
249
250#include <gecode/kernel/var-imp.hpp>
251
252
253/*
254 * Trace support
255 *
256 */
257
258#include <gecode/kernel/trace/traits.hpp>
259#include <gecode/kernel/trace/filter.hpp>
260#include <gecode/kernel/trace/tracer.hpp>
261#include <gecode/kernel/trace/recorder.hpp>
262#include <gecode/kernel/trace/print.hpp>
263
264namespace Gecode {
265
266 /**
267 * \brief Create tracer
268 * \ingroup TaskTrace
269 */
270 GECODE_KERNEL_EXPORT void
271 trace(Home home, TraceFilter tf,
272 int te = (TE_PROPAGATE | TE_COMMIT | TE_POST),
273 Tracer& t = StdTracer::def);
274 /**
275 * \brief Create tracer
276 * \ingroup TaskTrace
277 */
278 void
279 trace(Home home,
280 int te = (TE_PROPAGATE | TE_COMMIT | TE_POST),
281 Tracer& t = StdTracer::def);
282
283}
284
285#include <gecode/kernel/trace/general.hpp>
286
287/*
288 * Allocator support
289 *
290 */
291
292#include <gecode/kernel/memory/allocators.hpp>
293
294
295#endif
296
297// STATISTICS: kernel-other