kernel.hh
Go to the documentation of this file.00001 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */ 00002 /* 00003 * Main authors: 00004 * Christian Schulte <schulte@gecode.org> 00005 * 00006 * Contributing authors: 00007 * Guido Tack <tack@gecode.org> 00008 * 00009 * Copyright: 00010 * Christian Schulte, 2004 00011 * Guido Tack, 2004 00012 * 00013 * This file is part of Gecode, the generic constraint 00014 * development environment: 00015 * http://www.gecode.org 00016 * 00017 * Permission is hereby granted, free of charge, to any person obtaining 00018 * a copy of this software and associated documentation files (the 00019 * "Software"), to deal in the Software without restriction, including 00020 * without limitation the rights to use, copy, modify, merge, publish, 00021 * distribute, sublicense, and/or sell copies of the Software, and to 00022 * permit persons to whom the Software is furnished to do so, subject to 00023 * the following conditions: 00024 * 00025 * The above copyright notice and this permission notice shall be 00026 * included in all copies or substantial portions of the Software. 00027 * 00028 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00029 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00030 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00031 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 00032 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 00033 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 00034 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00035 * 00036 */ 00037 00038 #ifndef __GECODE_KERNEL_HH__ 00039 #define __GECODE_KERNEL_HH__ 00040 00041 #include <cstddef> 00042 #include <cstdlib> 00043 #include <cstring> 00044 #include <cassert> 00045 00046 #include <cfloat> 00047 00048 #include <functional> 00049 00050 #include <gecode/support.hh> 00051 00052 /* 00053 * Configure linking 00054 * 00055 */ 00056 #if !defined(GECODE_STATIC_LIBS) && \ 00057 (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER)) 00058 00059 #ifdef GECODE_BUILD_KERNEL 00060 #define GECODE_KERNEL_EXPORT __declspec( dllexport ) 00061 #else 00062 #define GECODE_KERNEL_EXPORT __declspec( dllimport ) 00063 #endif 00064 00065 #else 00066 00067 #ifdef GECODE_GCC_HAS_CLASS_VISIBILITY 00068 #define GECODE_KERNEL_EXPORT __attribute__ ((visibility("default"))) 00069 #else 00070 #define GECODE_KERNEL_EXPORT 00071 #endif 00072 00073 #endif 00074 00075 // Configure auto-linking 00076 #ifndef GECODE_BUILD_KERNEL 00077 #define GECODE_LIBRARY_NAME "Kernel" 00078 #include <gecode/support/auto-link.hpp> 00079 #endif 00080 00094 namespace Gecode { 00095 00097 namespace Kernel { namespace Config { 00099 const double rescale = 1e-50; 00101 const double rescale_limit = DBL_MAX * rescale; 00102 00104 const double chb_alpha_init = 0.4; 00106 const double chb_alpha_limit = 0.06; 00108 const double chb_alpha_decrement = 1e-6; 00110 const double chb_qscore_init = 0.05; 00111 }} 00112 00113 } 00114 00115 /* 00116 * General exceptions and kernel exceptions 00117 * 00118 */ 00119 00120 #include <gecode/kernel/exception.hpp> 00121 00122 00123 00124 /* 00125 * Basic kernel services and memory management 00126 * 00127 */ 00128 00129 #include <gecode/kernel/shared-object.hpp> 00130 #include <gecode/kernel/memory/config.hpp> 00131 #include <gecode/kernel/memory/manager.hpp> 00132 #include <gecode/kernel/memory/region.hpp> 00133 00134 /* 00135 * Macros for checking failure 00136 * 00137 */ 00138 00139 #include <gecode/kernel/macros.hpp> 00140 00141 00142 /* 00143 * Gecode kernel 00144 * 00145 */ 00146 00147 #include <gecode/kernel/archive.hpp> 00148 #include <gecode/kernel/gpi.hpp> 00149 #include <gecode/kernel/shared-space-data.hpp> 00150 #include <gecode/kernel/core.hpp> 00151 #include <gecode/kernel/modevent.hpp> 00152 #include <gecode/kernel/range-list.hpp> 00153 00154 00155 /* 00156 * Variables and testing for shared variables 00157 * 00158 */ 00159 00160 #include <gecode/kernel/var.hpp> 00161 00162 00163 /* 00164 * Views 00165 * 00166 */ 00167 00168 #include <gecode/kernel/view.hpp> 00169 00170 00171 /* 00172 * Arrays and other data 00173 * 00174 */ 00175 00176 #include <gecode/kernel/data/array.hpp> 00177 #include <gecode/kernel/data/shared-array.hpp> 00178 #include <gecode/kernel/data/shared-data.hpp> 00179 #include <gecode/kernel/data/rnd.hpp> 00180 00181 00182 /* 00183 * Common propagator patterns 00184 * 00185 */ 00186 00187 #include <gecode/kernel/propagator/pattern.hpp> 00188 #include <gecode/kernel/propagator/subscribed.hpp> 00189 #include <gecode/kernel/propagator/advisor.hpp> 00190 #include <gecode/kernel/propagator/wait.hpp> 00191 00192 00193 /* 00194 * Abstractions for branching 00195 * 00196 */ 00197 00198 namespace Gecode { 00199 00220 00221 GECODE_KERNEL_EXPORT void 00222 branch(Home home, std::function<void(Space& home)> f); 00224 00225 } 00226 00227 #include <gecode/kernel/branch/traits.hpp> 00228 #include <gecode/kernel/branch/action.hpp> 00229 #include <gecode/kernel/branch/afc.hpp> 00230 #include <gecode/kernel/branch/chb.hpp> 00231 #include <gecode/kernel/branch/var.hpp> 00232 #include <gecode/kernel/branch/val.hpp> 00233 #include <gecode/kernel/branch/tiebreak.hpp> 00234 #include <gecode/kernel/branch/merit.hpp> 00235 #include <gecode/kernel/branch/filter.hpp> 00236 #include <gecode/kernel/branch/view-sel.hpp> 00237 #include <gecode/kernel/branch/print.hpp> 00238 #include <gecode/kernel/branch/view.hpp> 00239 #include <gecode/kernel/branch/val-sel.hpp> 00240 #include <gecode/kernel/branch/val-commit.hpp> 00241 #include <gecode/kernel/branch/val-sel-commit.hpp> 00242 #include <gecode/kernel/branch/view-val.hpp> 00243 00244 00245 /* 00246 * Automatically generated variable implementations 00247 * 00248 */ 00249 00250 #include <gecode/kernel/var-imp.hpp> 00251 00252 00253 /* 00254 * Trace support 00255 * 00256 */ 00257 00258 #include <gecode/kernel/trace/traits.hpp> 00259 #include <gecode/kernel/trace/filter.hpp> 00260 #include <gecode/kernel/trace/tracer.hpp> 00261 #include <gecode/kernel/trace/recorder.hpp> 00262 #include <gecode/kernel/trace/print.hpp> 00263 00264 namespace Gecode { 00265 00270 GECODE_KERNEL_EXPORT void 00271 trace(Home home, TraceFilter tf, 00272 int te = (TE_PROPAGATE | TE_COMMIT), 00273 Tracer& t = StdTracer::def); 00278 void 00279 trace(Home home, 00280 int te = (TE_PROPAGATE | TE_COMMIT), 00281 Tracer& t = StdTracer::def); 00282 00283 } 00284 00285 #include <gecode/kernel/trace/general.hpp> 00286 00287 /* 00288 * Allocator support 00289 * 00290 */ 00291 00292 #include <gecode/kernel/memory/allocators.hpp> 00293 00294 00295 #endif 00296 00297 // STATISTICS: kernel-other