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