📄 gaconfig.h
字号:
// vcpp6 (12.00.8168)// vcpp7 (13.00.9466)// vcpp7 (13.10.3077)//#elif defined(_MSC_VER)// visual studio uses the borland model of template instantiation.#define GALIB_USE_BORLAND_INST// let visual studio do its own instantations, so by default do not force them.#define GALIB_USE_AUTO_INST// use ansi headers with vcpp7. it is a good idea to use them in vcpp6 as well// but some vcpp6 apps are built with non-ansi headers, in which case you // should build with the non-ansi headers so that you do not cross the streams.#define GALIB_USE_ANSI_HEADERS// beware of using streams in an MFC application. many nasties lurk therein...#define GALIB_USE_STREAMS// we default to using std things in the std namespace, but depending on the// version of vcpp you are using and depending on the libraries with which you// will use GAlib, you might have to turn this one off.#define GALIB_USE_STD_NAMESPACE// use the pid only on winnt and derivatives. win95/98/ME do not have it.// this requires unistd.h, which you may or may not have (depending on the // way that you installed the compiler).//#define GALIB_USE_PID// GAlib behaves much better in unknown conditions when rtti is enabled, but// you might have to disable it, depending on the linkage and compilation // options you need for other components you are using with GAlib.#if defined(_CPPRTTI)#define GALIB_USE_RTTI#else#undef GALIB_USE_RTTI#endif// there are many warnings from vcpp, many of which we can safely ignore.//#pragma warning (disable : 4244) // int-to-float warnings#pragma warning (disable : 4305) // double-to-float warnings#pragma warning (disable : 4355) // allow us to use this in constructors//#pragma warning (disable : 4250) // dominated multiple inherits// ----------------------------------------------------------------------------// GNU compiler//// there are some subtle differences in the way the gcc compiler handles// templates from one version to another. the latest versions are much more// strictly adherant to the c++ standards, although you can relax that with// the permissive option. we try to build this library without the use of the// permissive option.//// there are significant changes between the 3.3 and 3.4 releases of gcc. and// of course there are major differences between the 2.x and 3.x versions, but// those affect us mostly with respect to the use of the std libraries.#elif defined(__GNUG__)#define GALIB_USE_RTTI#define GALIB_USE_BORLAND_INST#define GALIB_USE_STREAMS#define GALIB_USE_PID#define GALIB_USE_EMPTY_TEMPLATES#define GALIB_NEED_INSTANTIATION_PREFIX#if __GNUC__ > 2#define GALIB_USE_ANSI_HEADERS#define GALIB_USE_STD_NAMESPACE#define GALIB_USE_COMP_OPERATOR_TEMPLATES#endif// ----------------------------------------------------------------------------// irix 5.3 and irix 6.x#elif defined(__sgi)#define GALIB_USE_STREAMS#define GALIB_USE_PID#include <sgidefs.h"#if (_MIPS_SIM == _MIPS_SIM_NABI32)#define GALIB_USE_RTTI#define GALIB_USE_AUTO_INST#define GALIB_USE_BORLAND_INST#elif (_MIPS_SIM == _MIPS_SIM_ABI64)#define GALIB_USE_RTTI#elif (_MIPS_SIM == _MIPS_SIM_ABI32)#define GALIB_USE_AUTO_INST#endif// ----------------------------------------------------------------------------// IBM visual age c++ compiler#elif defined(__IBMCPP__)// the -qrtti option turns rtti on and off, but i do not know the// corresponding preprocessor directive to sense it.#define GALIB_USE_RTTI#define GALIB_USE_BORLAND_INST#define GALIB_USE_AUTO_INST#define GALIB_USE_ANSI_HEADERS#define GALIB_USE_STREAMS#define GALIB_USE_STD_NAMESPACE#define GALIB_USE_PID#define GALIB_USE_NAMED_TEMPLATES// ----------------------------------------------------------------------------// HP aCC compiler#elif defined(__HP_aCC)#define GALIB_USE_RTTI#define GALIB_USE_BORLAND_INST#define GALIB_USE_AUTO_INST//#define GALIB_USE_ANSI_HEADERS#define GALIB_USE_STREAMS//#define GALIB_USE_STD_NAMESPACE#define GALIB_USE_PID//#pragma disable warning 829 // do not care about string literal conversions// ----------------------------------------------------------------------------// This is an unknown/untested platform and/or compiler. The defaults below // might work for you, but then again, they might not. You may have to adjust// the values of the macros until everything works properly. Comment out the// #error directive to allow things to compile properly.#else#error Unknown/untested compiler/operating system! Check these settings!#define GALIB_USE_RTTI#define GALIB_USE_BORLAND_INST#define GALIB_USE_AUTO_INST#define GALIB_USE_ANSI_HEADERS#define GALIB_USE_STREAMS#define GALIB_USE_STD_NAMESPACE#define GALIB_USE_PID#endif// deal with assertions. at some point we might want a proper definition of // assert here for platforms that do not have it.#if defined(GALIB_HAVE_NOT_ASSERT)#include <stdlib.h>#define assert(x) \ { \ if(! (x)) { \ fprintf(stderr, "assertion failed at line %d in file %s\n", \ __LINE__, __FILE__); \ exit(1); \ } \ }#else#include "assert.h"#endif// some compilers use one syntax, others use a different syntax.#if defined(GALIB_NEED_INSTANTIATION_PREFIX)#define GALIB_INSTANTIATION_PREFIX template class#else#define GALIB_INSTANTIATION_PREFIX#endif// If no RNG has been selected, use the ran2 generator by default#if !defined(GALIB_USE_RAND) && \ !defined(GALIB_USE_RANDOM) && \ !defined(GALIB_USE_RAND48) && \ !defined(GALIB_USE_RAN2) && \ !defined(GALIB_USE_RAN3)#define GALIB_USE_RAN2#endif// This defines how many bits are in a single word on your system. Most // systems have a word length of 8 bits.#ifndef GALIB_BITS_IN_WORD#define GALIB_BITS_IN_WORD 8#endif// Use this to set the maximum number of bits that can be used in binary-to-// decimal conversions. You should make this type the largest integer type // that your system supports.#ifndef GALIB_BITBASE#define GALIB_BITBASE long int#endif// If the system/compiler understands C++ casts, then we use them. Otherwise// we default to the C-style casts. The macros make explicit the fact that we// are doing casts.#if defined(GALIB_USE_RTTI)#define DYN_CAST(type,x) (dynamic_cast<type>(x))#define CON_CAST(type,x) (const_cast<type>(x))#define STA_CAST(type,x) (static_cast<type>(x))#define REI_CAST(type,x) (reinterpret_cast<type>(x))#else#define DYN_CAST(type,x) ((type)(x))#define CON_CAST(type,x) ((type)(x))#define STA_CAST(type,x) ((type)(x))#define REI_CAST(type,x) ((type)(x))#endif// Windows is brain-dead about how to export things, so we do this to keep the// code (somewhat) cleaner but still accomodate windows' stupidity.#if defined(COMPILE_GALIB_AS_DLL)#define GA_DLLDECL __declspec(dllexport)#elif defined(USE_GALIB_AS_DLL)#define GA_DLLDECL __declspec(dllimport)#else#define GA_DLLDECL#endif/* ----------------------------------------------------------------------------DEFAULT OPERATORS These directives determine which operators will be used by default for eachof the objects in GAlib.---------------------------------------------------------------------------- */// scaling schemes#define USE_LINEAR_SCALING 1#define USE_SIGMA_TRUNC_SCALING 1#define USE_POWER_LAW_SCALING 1#define USE_SHARING 1// selection schemes#define USE_RANK_SELECTOR 1#define USE_ROULETTE_SELECTOR 1#define USE_TOURNAMENT_SELECTOR 1#define USE_DS_SELECTOR 1#define USE_SRS_SELECTOR 1#define USE_UNIFORM_SELECTOR 1// These are the compiled-in defaults for various genomes and GA objects#define DEFAULT_SCALING GALinearScaling#define DEFAULT_SELECTOR GARouletteWheelSelector#define DEFAULT_TERMINATOR TerminateUponGeneration#define DEFAULT_1DBINSTR_INITIALIZER UniformInitializer#define DEFAULT_1DBINSTR_MUTATOR FlipMutator#define DEFAULT_1DBINSTR_COMPARATOR BitComparator#define DEFAULT_1DBINSTR_CROSSOVER OnePointCrossover#define DEFAULT_2DBINSTR_INITIALIZER UniformInitializer#define DEFAULT_2DBINSTR_MUTATOR FlipMutator#define DEFAULT_2DBINSTR_COMPARATOR BitComparator#define DEFAULT_2DBINSTR_CROSSOVER OnePointCrossover#define DEFAULT_3DBINSTR_INITIALIZER UniformInitializer#define DEFAULT_3DBINSTR_MUTATOR FlipMutator#define DEFAULT_3DBINSTR_COMPARATOR BitComparator#define DEFAULT_3DBINSTR_CROSSOVER OnePointCrossover#define DEFAULT_BIN2DEC_ENCODER GABinaryEncode#define DEFAULT_BIN2DEC_DECODER GABinaryDecode#define DEFAULT_BIN2DEC_COMPARATOR BitComparator#define DEFAULT_1DARRAY_INITIALIZER NoInitializer#define DEFAULT_1DARRAY_MUTATOR SwapMutator#define DEFAULT_1DARRAY_COMPARATOR ElementComparator#define DEFAULT_1DARRAY_CROSSOVER OnePointCrossover#define DEFAULT_2DARRAY_INITIALIZER NoInitializer#define DEFAULT_2DARRAY_MUTATOR SwapMutator#define DEFAULT_2DARRAY_COMPARATOR ElementComparator#define DEFAULT_2DARRAY_CROSSOVER OnePointCrossover#define DEFAULT_3DARRAY_INITIALIZER NoInitializer#define DEFAULT_3DARRAY_MUTATOR SwapMutator#define DEFAULT_3DARRAY_COMPARATOR ElementComparator#define DEFAULT_3DARRAY_CROSSOVER OnePointCrossover#define DEFAULT_1DARRAY_ALLELE_INITIALIZER UniformInitializer#define DEFAULT_1DARRAY_ALLELE_MUTATOR FlipMutator#define DEFAULT_1DARRAY_ALLELE_COMPARATOR ElementComparator#define DEFAULT_1DARRAY_ALLELE_CROSSOVER OnePointCrossover#define DEFAULT_2DARRAY_ALLELE_INITIALIZER UniformInitializer#define DEFAULT_2DARRAY_ALLELE_MUTATOR FlipMutator#define DEFAULT_2DARRAY_ALLELE_COMPARATOR ElementComparator#define DEFAULT_2DARRAY_ALLELE_CROSSOVER OnePointCrossover#define DEFAULT_3DARRAY_ALLELE_INITIALIZER UniformInitializer#define DEFAULT_3DARRAY_ALLELE_MUTATOR FlipMutator#define DEFAULT_3DARRAY_ALLELE_COMPARATOR ElementComparator#define DEFAULT_3DARRAY_ALLELE_CROSSOVER OnePointCrossover#define DEFAULT_STRING_INITIALIZER UniformInitializer#define DEFAULT_STRING_MUTATOR FlipMutator#define DEFAULT_STRING_COMPARATOR ElementComparator#define DEFAULT_STRING_CROSSOVER UniformCrossover#define DEFAULT_REAL_INITIALIZER UniformInitializer#define DEFAULT_REAL_MUTATOR GARealGaussianMutator#define DEFAULT_REAL_COMPARATOR ElementComparator#define DEFAULT_REAL_CROSSOVER UniformCrossover#define DEFAULT_TREE_INITIALIZER NoInitializer#define DEFAULT_TREE_MUTATOR SwapSubtreeMutator#define DEFAULT_TREE_COMPARATOR TopologyComparator#define DEFAULT_TREE_CROSSOVER OnePointCrossover#define DEFAULT_LIST_INITIALIZER NoInitializer#define DEFAULT_LIST_MUTATOR SwapMutator#define DEFAULT_LIST_COMPARATOR NodeComparator#define DEFAULT_LIST_CROSSOVER OnePointCrossover#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -