Generated on Thu Jan 16 2025 00:00:00 for Gecode by doxygen 1.14.0
kernel.hh
Go to the documentation of this file.
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"
79#endif
80
93
94namespace Gecode {
95
97 namespace Kernel { namespace Config {
99 const double rescale = 1e-50;
101 const double rescale_limit = DBL_MAX * rescale;
102
104 const double chb_alpha_init = 0.4;
106 const double chb_alpha_limit = 0.06;
108 const double chb_alpha_decrement = 1e-6;
110 const double chb_qscore_init = 0.05;
111 }}
112
113}
114
115/*
116 * General exceptions and kernel exceptions
117 *
118 */
119
121
122
123
124/*
125 * Basic kernel services and memory management
126 *
127 */
128
133
134/*
135 * Macros for checking failure
136 *
137 */
138
140
141
142/*
143 * Gecode kernel
144 *
145 */
146
148#include <gecode/kernel/gpi.hpp>
150#include <gecode/kernel/core.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
180
181
182/*
183 * Common propagator patterns
184 *
185 */
186
191
192
193/*
194 * Abstractions for branching
195 *
196 */
197
198namespace Gecode {
199
208
220
222 branch(Home home, std::function<void(Space& home)> f);
224
225}
226
243
244
245/*
246 * Automatically generated variable implementations
247 *
248 */
249
251
252
253/*
254 * Trace support
255 *
256 */
257
263
264namespace Gecode {
265
271 trace(Home home, TraceFilter tf,
272 int te = (TE_PROPAGATE | TE_COMMIT | TE_POST),
278 void
279 trace(Home home,
280 int te = (TE_PROPAGATE | TE_COMMIT | TE_POST),
282
283}
284
286
287/*
288 * Allocator support
289 *
290 */
291
293
294
295#endif
296
297// STATISTICS: kernel-other
Home class for posting propagators
Definition core.hpp:856
static StdTracer def
Default tracer (printing to std::cerr)
Definition tracer.hpp:242
Trace filters.
Definition filter.hpp:133
GECODE_FLOAT_EXPORT void trace(Home home, const FloatVarArgs &x, TraceFilter tf, int te=(TE_INIT|TE_PRUNE|TE_FIX|TE_FAIL|TE_DONE), FloatTracer &t=StdFloatTracer::def)
Create a tracer for float variables.
Definition trace.cpp:39
void branch(Home home, const FloatVarArgs &x, FloatVarBranch vars, FloatValBranch vals, FloatBranchFilter bf=nullptr, FloatVarValPrint vvp=nullptr)
Branch over x with variable selection vars and value selection vals.
Definition branch.cpp:39
@ TE_POST
Trace propagator posting.
Definition recorder.hpp:52
@ TE_COMMIT
Trace commit operations by branchers.
Definition recorder.hpp:51
@ TE_PROPAGATE
Trace propagator executions.
Definition recorder.hpp:50
#define GECODE_KERNEL_EXPORT
Definition kernel.hh:70
const double chb_alpha_decrement
Alpha decrement in CHB.
Definition kernel.hh:108
const double chb_qscore_init
Initial value for Q-score in CHB.
Definition kernel.hh:110
const double rescale_limit
Rescale action and afc values when larger than this.
Definition kernel.hh:101
const double chb_alpha_init
Initial value for alpha in CHB.
Definition kernel.hh:104
const double rescale
Rescale factor for action and afc values.
Definition kernel.hh:99
const double chb_alpha_limit
Limit for decreasing alpha in CHB.
Definition kernel.hh:106
Kernel functionality
Gecode toplevel namespace