⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gaconfig.h

📁 遗传算法工具箱C++
💻 H
📖 第 1 页 / 共 2 页
字号:
// $Header$/* ----------------------------------------------------------------------------  config.h  mbwall 27jun95  Copyright (c) 1995-1996 Massachusetts Institute of Technology                          all rights reserved  Copyright (c) 1998-2005 Matthew Wall                          all rights reserved---------------------------------------------------------------------------- */#ifndef _ga_config_h_#define _ga_config_h_/* ----------------------------------------------------------------------------PREPROCESSOR DIRECTIVES  Here are the preprocessor directives that the library understands.  Some of these are already set up for the OSes with which I am familiar.  Seebelow for the pre-defined sets.  If you come up with a compiler/platform configuration that is not listed here, please send it to me so that i can incorporate it into the code base.  GALIB_USE_ANSI_HEADERS                      Some operating systems/compilers have old-style headers                      (e.g. <iostream.h>) while others have new-school		      headers (e.g. <iostream>).  The default is to use		      ANSI headers.  If you are using an older compiler,		      make sure this variable is not defined.  GALIB_USE_NAMED_TEMPLATES  GALIB_USE_EMPTY_TEMPLATES  GALIB_USE_COMP_OPERATOR_TEMPLATES                      Some older compilers do not require strict, ansi template		      definitions.  And some compilers require slightly 		      different ways of specifying templates.  And to make it		      even more complicated, some depend very much on the type		      of instantiation method that is defined.  Sigh.  GALIB_USE_STD_NAMESPACE                      Some platforms need to explicitly use the std namespace		      when referring to streams and other std components, but		      others do not.  GALIB_USE_STREAMS                      For systems/environments in which streams are not desired                      and/or required.  If this is not defined, it turns off                       errors and all of the read/write routines for the                       classes.  GALIB_USE_RTTI                      If your compiler supports RTTI, or if you turn on                      the RTTI abilities of your compiler, then define this                      macro.  Without RTTI, if improper casts are made,		      things will die horribly rather than dropping out in an		      RTTI-induced exception.  GALIB_USE_PID                     Define this if the system has a getpid function that                     returns something sane and useful.  GALIB_USE_NO_TEMPLATES                      For compilers that do not do templates.  The only type                      of genome available when this is defined is binary                       string and any derived classes.  list, tree, and array 		      all use templates.  You can still use the template code,		      but you will have to hack it yourself to make it work.  GALIB_USE_BORLAND_INST                      For compilers that use the Borland instantiation model.                      These compilers expect all of the template code to be		      in the header file.  The Cfront model, on the other                      hand, expects source files with names similar to the		      header files, but all of the template code does not		      need to be in the header files.		    		      When you define this flag, the source file that 		      corresponds to the header file is explicitly included		      at the end of the header file for all headers that		      contain templates.  GALIB_USE_AUTO_INST                      For compilers that do not do automatic instantiation                      (such as g++ version 2.6.8) you will have to force                      instantiations.  When this flag is not defined, GAlib		      forces an instantiation of all of the template classes		      that it uses (such as real genome and string genome).  GALIB_HAVE_NOT_ASSERT                      Some platforms do not have assert.  So for those		      platforms we define our own simple version of it.  USE_GALIB_AS_LIB       For windows shared libraries, one must define whether  USE_GALIB_AS_DLL       static member data are imported or exported.  You                          define one or the other of these, but not both.  The		  	 default is USE_GALIB_AS_LIB (if you define neither).			  COMPILE_GALIB_AS_LIB   If you are compiling the dome library, define one of  COMPILE_GLAIB_AS_DLL   these to indicate the windows exports.  The default                         is USE_GALIB_AS_LIB (if you define neither).                      GALIB_USE_RAN1      These specify which random number function to use.  Only  GALIB_USE_RAN2      one of these may be specified.  You may have to tweak   GALIB_USE_RAN3      random.h a bit as well (these functions are not defined   GALIB_USE_RAND      the same way on each platform).  For best results, use  GALIB_USE_RANDOM    ran2 or ran3 (performance is slightly slower than most  GALIB_USE_RAND48    system RNGs, but you'll get better results).                      If you want to use another random number generator you                      must hack random.h directly (see the comments in that                      file).  GALIB_BITBASE       The built-in type to use for bit conversions.  This                       should be set to the type of the largest integer that                      your system supports.  If you have long long int then                      use it.  If you don't plan to use more than 16 or 32                      bits to represent your binary-to-decimal mappings then                      you can use something smaller (long int for example).                      If you do not set this, GAlib will automatically use                      the size of a long int.  The bitbase determines the		      maximum number of bits you can use to represent a		      decimal number in the binary-to-decimal genomes.  GALIB_BITS_IN_WORD  How many bits are in a word?  For many systems, a word is                      a char and is 8 bits long.---------------------------------------------------------------------------- */// This is a bare-bones os-cpu-compiler detection with no dependencies on any// other header files or macros.  We try to detect everything based on what we// will get by default from the compilers.  The result of this is three macros//   GALIB_OS//   GALIB_CPU//   GALIB_COMPILER// determine the operating system#if defined(__linux__)#define GALIB_OS "linux"#elif defined(__sgi)#define GALIB_OS "irix"#elif defined(WIN32)#define GALIB_OS "win32"#elif defined(sun)#define GALIB_OS "solaris"#elif defined(__APPLE__) && defined(__MACH__) && defined(__ppc__)#define GALIB_OS "macosx"#elif defined(macintosh)#define GALIB_OS "macos"#elif defined(HPUX10)#define GALIB_OS "hpux10"#elif defined(HPUX11)#define GALIB_OS "hpux11"#elif defined(_AIX) || defined(AIX)#define GALIB_OS "aix"#else#define GALIB_OS "unknown"#endif// determine the cpu#if defined(__INTEL__) || defined(__i386__) || \    defined(__x86__) || defined(_M_IX86)#define GALIB_CPU "i386"#elif defined(__POWERPC__) || defined(__PPC__) || \      defined(__powerpc__) || defined(__ppc__) || \      defined(_POWER)#define GALIB_CPU "ppc"#elif defined(__m68k__)#define GALIB_CPU "68k"#elif defined(__sgi)#define GALIB_CPU "mips"#elif defined(sparc) || defined(__sparc__)#define GALIB_CPU "sparc"#elif defined(__HP_aCC)#define GALIB_CPU "hppa"#else#define GALIB_CPU "unknown"#endif// determine the compiler#if defined(__GNUG__) || defined(__GNUC__)#if __GNUC__ == 4#define GALIB_COMPILER "gcc4"#elif __GNUC__ == 3#define GALIB_COMPILER "gcc3"#elif __GNUC__ == 2#define GALIB_COMPILER "gcc2"#else#define GALIB_COMPILER "gcc"#endif#elif defined(__BORLANDC__)#if __BORLANDC__ < 0x500#define GALIB_COMPILER "bcc4"#elif __BORLANDC__ < 0x530#define GALIB_COMPILER "bcc52"#elif __BORLANDC__ < 0x540#define GALIB_COMPILER "bcc53"#elif __BORLANDC__ < 0x550#define GALIB_COMPILER "bcc54"#elif __BORLANDC__ < 0x560#define GALIB_COMPILER "bcc55"#else#define GALIB_COMPILER "bcc"#endif#elif defined(__WATCOMC__)#define GALIB_COMPILER "watcom"#elif defined(_MIPS_SIM)#define GALIB_COMPILER "mipscc"#elif defined(__MWERKS__)#define GALIB_COMPILER "mwerks"#elif defined(_MSC_VER)#if _MSC_VER == 1300#define GALIB_COMPILER "vcpp7"#elif _MSC_VER == 1200#define GALIB_COMPILER "vcpp6"#else#define GALIB_COMPILER "vcpp"#endif#elif defined(__HP_aCC)#define GALIB_COMPILER "acc"#elif defined(__IBMCPP__)#define GALIB_COMPILER "xlc"#else#define GALIB_COMPILER "unknown"#endif// ----------------------------------------------------------------------------// Here are the defines needed for some of the compilers/OSes on which I have// been able to test the GA library.  You may have to remove and/or modify// these to get things to work on your system.// ----------------------------------------------------------------------------// ----------------------------------------------------------------------------// Metrowerks' Codewarrior for MacOS, PalmOS, or Win32 (I have not tested CW// on other platforms yet).#if defined(__MWERKS__)#define GALIB_USE_STREAMS#define GALIB_USE_BORLAND_INST#define GALIB_USE_AUTO_INST#if __option(RTTI)#define GALIB_USE_RTTI#endif// ----------------------------------------------------------------------------// Symantec C++ for mac.  This compiler does not handle templates very well, // so if you want to use any of the template components of GAlib then you will// probably have to do some hacking to get things to work.#elif defined(__SC__)#define GALIB_USE_STREAMS#define GALIB_USE_BORLAND_INST// ----------------------------------------------------------------------------// THINK for mac#elif defined(THINK_C)#define GALIB_USE_STREAMS#define GALIB_USE_BORLAND_INST#define GALIB_USE_COMP_OPERATOR_TEMPLATES// ----------------------------------------------------------------------------// borland c++ compiler//// You may or may not need the BORLAND_INST flag defined when you use a borland// compiler.  I did not need it when I compiled using version 4.0, but I did// need it when I compiled with an earlier version (I think it was 3.x but I// do not remember for certain).//   Note that the default random number generator when using a borland (or// any PC compiler, for that matter) is the basic system's RNG.// I did this because of the hassles of 16- vs 32-bit DOS/Windows rubbish.  If// you want a better RNG, you can use the others in GAlib, but you'll have to// do a bit of checking to make sure it works with your DOS/Windows config.// All of the RNGs work fine under all of the 32-bit OSes I've tried, but they// don't do so well in a 16-bit OS.//  Use the randtest example to check GAlib's RNG after you compile everything.#elif defined(__BORLANDC__)//#define GALIB_USE_RAND	// comment this if you're using a 32-bit OS#define GALIB_USE_RTTI#define GALIB_USE_BORLAND_INST#define GALIB_USE_STREAMS//#define GALIB_USE_PID#define GALIB_USE_EMPTY_TEMPLATES//#define GALIB_USE_ANSI_HEADERS//#define GALIB_USE_STD_NAMESPACE//#define GALIB_USE_COMP_OPERATOR_TEMPLATES//#pragma warning (disable : 8027)    // switch statements are not inlined//#pragma warning (disable : 8004)    // unused variable warnings are lame// ----------------------------------------------------------------------------// MicroSoft's Visual C++ programming environment.//// this has been test with://   vcpp6 (12.00.8804)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -