📄 gaconfig.h
字号:
#endif// ----------------------------------------------------------------------------// 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. Eventually I'll get// areound to replacing this with autoconf...#else#error Unknown/untested compiler/operating system! Check these settings!#define USE_CPP_CASTS#define USE_BORLAND_INST#define USE_AUTO_INST#define USE_PID#endif// Use the right streams library based on which streams macro was defined.#if defined(USE_OLD_STREAMS)#include <iostream.h>#include <fstream.h>#elif defined(USE_ANSI_STREAMS)#include <iostream>#include <fstream>// i'm terribly sorry to do this, but it is the easiest way for me to get// things to work properly with vcpp.using namespace std;#else#ifndef NO_STREAMS#define NO_STREAMS#endif#endif// If no RNG has been selected, use the ran2 generator by default#if !defined(USE_RAND) && !defined(USE_RANDOM) && \ !defined(USE_RAND48) && !defined(USE_RAN2) && !defined(USE_RAN3)#define 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 BITS_IN_WORD#define 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 BITBASE#define 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(USE_CPP_CASTS)#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/* ----------------------------------------------------------------------------SPACE SAVERS and DEFAULT OPERATORS These directives determine which operators will be used by default for eachof the objects in GAlib. If space is limited, you may want to compile the library with only the partsthat you need (compiling in DOS comes to mind). Your compiler should do thisautomatically for you (ie only use the parts that you use). If not, then comment out the chunks in the files you're not going to use (for example, comment out the ordered initializer in the list object). To disable a certain type of genome, simply don't compile its source file.The following directives are defined so that you can trim out the parts of thegenetic algorithm objects that are not in separate files.---------------------------------------------------------------------------- */// 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 + -