一段宏定义的代码

 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
00002 /*                                                                           */
00003 /*                  This file is part of the program and library             */
00004 /*         SCIP --- Solving Constraint Integer Programs                      */
00005 /*                                                                           */
00006 /*    Copyright (C) 2002-2011 Konrad-Zuse-Zentrum                            */
00007 /*                            fuer Informationstechnik Berlin                */
00008 /*                                                                           */
00009 /*  SCIP is distributed under the terms of the ZIB Academic License.         */
00010 /*                                                                           */
00011 /*  You should have received a copy of the ZIB Academic License              */
00012 /*  along with SCIP; see the file COPYING. If not email to scip@zib.de.      */
00013 /*                                                                           */
00014 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
00015 
00016 /**@file   def.h
00017  * @brief  common defines and data types used in all packages of SCIP
00018  * @author Tobias Achterberg
00019  */
00020 
00021 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
00022 
00023 #ifndef __SCIP_DEF_H__
00024 #define __SCIP_DEF_H__
00025 
00026 
00027 #include <stdio.h>
00028 #include <math.h>
00029 #include <limits.h>
00030 #include <float.h>
00031 #include <assert.h>
00032 
00033 /*
00034  * Boolean values
00035  */
00036 
00037 #ifndef SCIP_Bool
00038 #define SCIP_Bool unsigned int                    /**< type used for boolean values */
00039 #ifndef TRUE
00040 #define TRUE  1                         /**< boolean value TRUE */
00041 #define FALSE 0                         /**< boolean value FALSE */
00042 #endif
00043 #endif
00044 
00045 #include "scip/type_retcode.h"
00046 #include "scip/message.h"
00047 
00048 #ifdef __cplusplus
00049 extern "C" {
00050 #endif
00051 
00052 #define SCIP_VERSION                202 /**< SCIP version number (multiplied by 100 to get integer number) */
00053 #define SCIP_SUBVERSION               0 /**< SCIP sub version number */
00054 #define SCIP_COPYRIGHT   "Copyright (c) 2002-2011 Konrad-Zuse-Zentrum fuer Informationstechnik Berlin (ZIB)"
00055 
00056 
00057 
00058 /*
00059  * Long Integer values
00060  */
00061 
00062 #ifndef LLONG_MAX
00063 #define LLONG_MAX       9223372036854775807LL
00064 #define LLONG_MIN       (-LLONG_MAX - 1LL)
00065 #endif
00066 
00067 #define SCIP_Longint long long                         /**< type used for long integer values */
00068 #define SCIP_LONGINT_MAX          LLONG_MAX
00069 #define SCIP_LONGINT_MIN          LLONG_MIN
00070 #ifndef SCIP_LONGINT_FORMAT
00071 #if defined(_WIN32) || defined(_WIN64)
00072 #define SCIP_LONGINT_FORMAT           "I64d"
00073 #else
00074 #define SCIP_LONGINT_FORMAT           "lld"
00075 #endif
00076 #endif
00077 
00078 
00079 /*
00080  * Floating point values
00081  */
00082 
00083 #define SCIP_Real double                               /**< type used for floating point values */
00084 #define SCIP_REAL_MAX         (SCIP_Real)DBL_MAX
00085 #define SCIP_REAL_MIN        -(SCIP_Real)DBL_MAX
00086 #define SCIP_REAL_FORMAT               "lf"
00087 
00088 #define SCIP_DEFAULT_INFINITY         1e+20  /**< default value considered to be infinity */
00089 #define SCIP_DEFAULT_EPSILON          1e-09  /**< default upper bound for floating points to be considered zero */
00090 #define SCIP_DEFAULT_SUMEPSILON       1e-06  /**< default upper bound for sums of floating points to be considered zero */
00091 #define SCIP_DEFAULT_FEASTOL          1e-06  /**< default feasibility tolerance for constraints */
00092 #define SCIP_DEFAULT_DUALFEASTOL      1e-09  /**< default feasibility tolerance for reduced costs */
00093 #define SCIP_DEFAULT_BARRIERCONVTOL   1e-10  /**< default convergence tolerance used in barrier algorithm */
00094 #define SCIP_DEFAULT_BOUNDSTREPS       0.05  /**< default minimal relative improve for strengthening bounds */
00095 #define SCIP_DEFAULT_PSEUDOCOSTEPS    1e-01  /**< default minimal variable distance value to use for pseudo cost updates */
00096 #define SCIP_DEFAULT_PSEUDOCOSTDELTA  1e-04  /**< default minimal objective distance value to use for pseudo cost updates */
00097 #define SCIP_MAXEPSILON               1e-03  /**< maximum value for any numerical epsilon */
00098 #define SCIP_MINEPSILON               1e-20  /**< minimum value for any numerical epsilon */
00099 #define SCIP_INVALID                  1e+99  /**< floating point value is not valid */
00100 #define SCIP_UNKNOWN                  1e+98  /**< floating point value is not known (in primal solution) */
00101 
00102 
00103 #define REALABS(x)        (fabs(x))
00104 #define EPSEQ(x,y,eps)    (REALABS((x)-(y)) <= (eps))
00105 #define EPSLT(x,y,eps)    ((x)-(y) < -(eps))
00106 #define EPSLE(x,y,eps)    ((x)-(y) <= (eps))
00107 #define EPSGT(x,y,eps)    ((x)-(y) > (eps))
00108 #define EPSGE(x,y,eps)    ((x)-(y) >= -(eps))
00109 #define EPSZ(x,eps)       (REALABS(x) <= (eps))
00110 #define EPSP(x,eps)       ((x) > (eps))
00111 #define EPSN(x,eps)       ((x) < -(eps))
00112 #define EPSFLOOR(x,eps)   (floor((x)+(eps)))
00113 #define EPSCEIL(x,eps)    (ceil((x)-(eps)))
00114 #define EPSFRAC(x,eps)    ((x)-EPSFLOOR(x,eps))
00115 #define EPSISINT(x,eps)   (EPSFRAC(x,eps) <= (eps))
00116 
00117 
00118 #ifndef SQR
00119 #define SQR(x)        ((x)*(x))
00120 #define SQRT(x)       (sqrt(x))
00121 #endif
00122 
00123 #ifndef ABS
00124 #define ABS(x)        ((x) >= 0 ? (x) : -(x))
00125 #endif
00126 
00127 #ifndef MAX
00128 #define MAX(x,y)      ((x) >= (y) ? (x) : (y))     /**< returns maximum of x and y */
00129 #define MIN(x,y)      ((x) <= (y) ? (x) : (y))     /**< returns minimum of x and y */
00130 #endif
00131 
00132 #ifndef MAX3
00133 #define MAX3(x,y,z) ((x) >= (y) ? MAX(x,z) : MAX(y,z))  /**< returns maximum of x, y, and z */
00134 #define MIN3(x,y,z) ((x) <= (y) ? MIN(x,z) : MIN(y,z))  /**< returns minimum of x, y, and z */
00135 #endif
00136 
00137 
00138 
00139 /*
00140  * Pointers
00141  */
00142 
00143 #ifndef NULL
00144 #define NULL ((void*)0)                 /**< zero pointer */
00145 #endif
00146 
00147 
00148 /*
00149  * Strings
00150  */
00151 
00152 #define SCIP_MAXSTRLEN             1024 /**< maximum string length in SCIP */
00153 #if defined(_WIN32) || defined(_WIN64)
00154 #define snprintf _snprintf
00155 #define vsnprintf _vsnprintf
00156 #define strcasecmp _stricmp
00157 #define strncasecmp _strnicmp
00158 #endif
00159 
00160 
00161 /*
00162  * Memory settings
00163  */
00164 
00165 #define SCIP_HASHSIZE_PARAMS         4099 /**< size of hash table in parameter name tables */
00166 #define SCIP_HASHSIZE_NAMES          131101 /**< size of hash table in name tables */
00167 #define SCIP_HASHSIZE_CUTPOOLS       131101 /**< size of hash table in cut pools */
00168 #define SCIP_HASHSIZE_CLIQUES        131101 /**< size of hash table in clique tables */
00169 #define SCIP_HASHSIZE_NAMES_SMALL    8011   /**< size of hash table in name tables for small problems */
00170 #define SCIP_HASHSIZE_CUTPOOLS_SMALL 8011   /**< size of hash table in cut pools for small problems */
00171 #define SCIP_HASHSIZE_CLIQUES_SMALL  8011   /**< size of hash table in clique tables for small problems */
00172 #define SCIP_HASHSIZE_VBC            131101 /**< size of hash map for node -> nodenum mapping used for VBC output */
00173 
00174 /*#define BMS_NOBLOCKMEM*/
00175 
00176 
00177 
00178 /*
00179  * Global debugging settings
00180  */
00181 
00182 /*#define DEBUG*/
00183 
00184 
00185 /*
00186  * Defines for handling SCIP return codes
00187  */
00188 
00189 #define SCIPABORT() assert(FALSE)
00190 
00191 #define SCIP_CALL_ABORT_QUIET(x)  do { if( (x) != SCIP_OKAY ) SCIPABORT(); } while( FALSE )
00192 #define SCIP_CALL_QUIET(x)        do { SCIP_RETCODE _restat_; if( (_restat_ = (x)) != SCIP_OKAY ) return _restat_; } while( FALSE )
00193 #define SCIP_ALLOC_ABORT_QUIET(x) do { if( NULL == (x) ) SCIPABORT(); } while( FALSE )
00194 #define SCIP_ALLOC_QUIET(x)       do { if( NULL == (x) ) return SCIP_NOMEMORY; } while( FALSE )
00195 
00196 #define SCIP_CALL_ABORT(x) do                                                                                 \
00197                        {                                                                                      \
00198                           SCIP_RETCODE _restat_;                                                              \
00199                           if( (_restat_ = (x)) != SCIP_OKAY )                                                 \
00200                           {                                                                                   \
00201                              SCIPerrorMessage("Error <%d> in function call\n", _restat_);                     \
00202                              SCIPABORT();                                                                     \
00203                           }                                                                                   \
00204                        }                                                                                      \
00205                        while( FALSE )
00206 
00207 #define SCIP_ALLOC_ABORT(x) do                                                                                \
00208                        {                                                                                      \
00209                           if( NULL == (x) )                                                                   \
00210                           {                                                                                   \
00211                              SCIPerrorMessage("No memory in function call\n", __FILE__, __LINE__);            \
00212                              SCIPABORT();                                                                     \
00213                           }                                                                                   \
00214                        }                                                                                      \
00215                        while( FALSE )
00216 
00217 #define SCIP_CALL(x)   do                                                                                     \
00218                        {                                                                                      \
00219                           SCIP_RETCODE _restat_;                                                              \
00220                           if( (_restat_ = (x)) != SCIP_OKAY )                                                 \
00221                           {                                                                                   \
00222                              SCIPerrorMessage("Error <%d> in function call\n", _restat_);                     \
00223                              return _restat_;                                                                 \
00224                            }                                                                                  \
00225                        }                                                                                      \
00226                        while( FALSE )
00227 
00228 #define SCIP_ALLOC(x)  do                                                                                     \
00229                        {                                                                                      \
00230                           if( NULL == (x) )                                                                   \
00231                           {                                                                                   \
00232                              SCIPerrorMessage("No memory in function call\n");                                \
00233                              return SCIP_NOMEMORY;                                                            \
00234                           }                                                                                   \
00235                        }                                                                                      \
00236                        while( FALSE )
00237 
00238 #ifdef __cplusplus
00239 }
00240 #endif
00241 
00242 #endif
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值