basicdefs.h

Go to the documentation of this file.
00001 /****************************************************************************/
00002 /*                                                                          */
00003 /*  This file is part of QSopt_ex.                                          */
00004 /*                                                                          */
00005 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
00006 /*  and Daniel Espinoza                                                     */
00007 /*                                                                          */
00008 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
00009 /*  copyright in QSopt.                                                     */
00010 /*                                                                          */
00011 /*  This code may be used under the terms of the GNU General Public License */
00012 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
00013 /*                                                                          */
00014 /*  Alternatively, use is granted for research purposes only.               */
00015 /*                                                                          */
00016 /*  It is your choice of which of these two licenses you are operating      */
00017 /*  under.                                                                  */
00018 /*                                                                          */
00019 /*  We make no guarantees about the correctness or usefulness of this code. */
00020 /*                                                                          */
00021 /****************************************************************************/
00022 #ifndef __BASICDEFS__
00023 #define __BASICDEFS__
00024 
00025 /* storage type */
00026 #define DENSE          0
00027 #define SPARSE         1
00028 
00029 /* type of vector */
00030 #define ROW_SOLVE      1
00031 #define COLUMN_SOLVE   2
00032 
00033 /* direction of change in non-basic var */
00034 #define VINCREASE      1
00035 #define VDECREASE      2
00036 
00037 /* status of variables */
00038 #define STAT_BASIC     1
00039 #define STAT_UPPER     2
00040 #define STAT_LOWER     3
00041 #define STAT_ZERO      4
00042 
00043 #define BOUND_LOWER    1
00044 #define BOUND_UPPER    2
00045 
00046 /* type of variables */
00047 #define VARTIFICIAL    1
00048 #define VFIXED         2
00049 #define VFREE          4
00050 #define VUPPER         8
00051 #define VLOWER         16
00052 #define VBOUNDED       32
00053 
00054 /* class of variables */
00055 #define CLASS_STRUCT   0
00056 #define CLASS_LOGICAL  1
00057 
00058 /* algo */
00059 #define PRIMAL_SIMPLEX 1
00060 #define DUAL_SIMPLEX   2
00061 #define PRIMAL_OR_DUAL 3
00062 
00063 /* phase */
00064 #define PRIMAL_PHASEI  1
00065 #define PRIMAL_PHASEII 2
00066 #define DUAL_PHASEI    3
00067 #define DUAL_PHASEII   4
00068 
00069 /* number of phases */
00070 #define PHASEI         1
00071 #define PHASEII        2
00072 
00073 /* type of pricing (all vars or some) */
00074 #define COMPLETE_PRICING   1
00075 #define PARTIAL_PRICING    2
00076 #define MULTI_PART_PRICING 3
00077 
00078 /* default pricing */
00079 
00080 #define QS_DEFAULT_PRICE_PI  QS_PRICE_PSTEEP
00081 #define QS_DEFAULT_PRICE_PII QS_PRICE_PSTEEP
00082 #define QS_DEFAULT_PRICE_DI  QS_PRICE_DSTEEP
00083 #define QS_DEFAULT_PRICE_DII QS_PRICE_DSTEEP
00084 
00085 /* lp sol status */
00086 #define ILL_LP_SOLVED            1
00087 #define ILL_LP_UNSOLVED          2
00088 #define ILL_MAX_ITER             3
00089 #define ILL_MAX_TIME             4
00090 #define ILL_BND_REACHED          5
00091 #define ILL_PPHASEI_ERROR        6
00092 #define ILL_PPHASEII_ERROR       7
00093 #define ILL_DPHASEI_ERROR        8
00094 #define ILL_DPHASEII_ERROR       9
00095 #define ILL_LP_ABORTED          10
00096 
00097 /* basis status */
00098 #define OPTIMAL                  1
00099 #define NONOPTIMAL               2
00100 #define PRIMAL_FEASIBLE          3
00101 #define PRIMAL_INFEASIBLE        4
00102 #define PRIMAL_UNBOUNDED         5
00103 #define DUAL_FEASIBLE            7
00104 #define DUAL_INFEASIBLE          8
00105 #define DUAL_UNBOUNDED           9
00106 
00107 /* type of ratio test */
00108 #define RATIOTEST_NORMAL 1
00109 #define RATIOTEST_HARRIS 2
00110 
00111 /* control parameters */
00112 #define PARAM_PRATIOTESTS        10
00113 #define PARAM_DRATIOTESTS        20
00114 #define PARAM_PRIMAL_REFACTORGAP 50
00115 #define PARAM_PRIMAL_RESOLVEGAP  25
00116 #define PARAM_DUAL_REFACTORGAP   100
00117 #define PARAM_DUAL_RESOLVEGAP    25
00118 #define PARAM_MAX_NOSOLVE        500
00119 #define PARAM_MAX_NOPROG         300
00120 #define PARAM_NOPROG_FACTOR      15
00121 
00122 /* numerical parameters */
00123 #define PARAM_BSHIFT             10
00124 #define PARAM_CSHIFT             10
00125 
00126 /* general constants */
00127 #define PARAM_HEAP_UTRIGGER      10
00128 #define PARAM_HEAP_RATIO         4.0
00129 
00130 /* errors */
00131 #define E_GENERAL_ERROR          1
00132 #define E_INV_LINSOLVE_OPTION    2
00133 #define E_NO_MEMORY              3
00134 #define E_INVALID_OPTION         4
00135 #define E_NULL_ARGUMENT          5
00136 #define E_SIMPLEX_ERROR          6
00137 #define E_BASIS_SINGULAR         7
00138 
00139 #ifndef __QS_BASIS__
00140 #define __QS_BASIS__
00141 typedef struct qsbasis
00142 {
00143   int nstruct;
00144   int nrows;
00145   char *cstat;
00146   char *rstat;
00147 }
00148 QSbasis;
00149 #endif
00150 
00151 typedef struct itcnt_t
00152 {
00153   int pI_iter;
00154   int pII_iter;
00155   int dI_iter;
00156   int dII_iter;
00157   int tot_iter;
00158 } itcnt_t;
00159 
00160 #ifndef QS_DEFINITIONS
00161 #define QS_DEFINITIONS
00162 #define QS_MIN       (1)
00163 #define QS_MAX       (-1)
00164 
00165 /****************************************************************************/
00166 /*                                                                          */
00167 /*                 PARAMETERS THAT CAN BE SET BY setparam                   */
00168 /*                                                                          */
00169 /****************************************************************************/
00170 
00171 
00172 #define QS_PARAM_PRIMAL_PRICING    0
00173 #define QS_PARAM_DUAL_PRICING      2
00174 #define QS_PARAM_SIMPLEX_DISPLAY   4
00175 #define QS_PARAM_SIMPLEX_MAX_ITERATIONS 5
00176 #define QS_PARAM_SIMPLEX_MAX_TIME  6
00177 #define QS_PARAM_SIMPLEX_SCALING   7
00178 #define QS_PARAM_OBJULIM           8
00179 #define QS_PARAM_OBJLLIM           9
00180 
00181 
00182 /****************************************************************************/
00183 /*                                                                          */
00184 /*                     VALUES FOR PRICING PARAMETERS                        */
00185 /*                                                                          */
00186 /****************************************************************************/
00187 
00188 #define QS_PRICE_PDANTZIG 1
00189 #define QS_PRICE_PDEVEX 2
00190 #define QS_PRICE_PSTEEP 3
00191 #define QS_PRICE_PMULTPARTIAL 4
00192 
00193 #define QS_PRICE_DDANTZIG 6
00194 #define QS_PRICE_DSTEEP 7
00195 #define QS_PRICE_DMULTPARTIAL 8
00196 #define QS_PRICE_DDEVEX 9
00197 
00198 
00199 /****************************************************************************/
00200 /*                                                                          */
00201 /*                         VALUES FOR BASIS STATUS                          */
00202 /*                                                                          */
00203 /****************************************************************************/
00204 
00205 
00206 #define QS_COL_BSTAT_LOWER     '0'
00207 #define QS_COL_BSTAT_BASIC     '1'
00208 #define QS_COL_BSTAT_UPPER     '2'
00209 #define QS_COL_BSTAT_FREE      '3'
00210 
00211 #define QS_ROW_BSTAT_LOWER     '0'
00212 #define QS_ROW_BSTAT_BASIC     '1'
00213 #define QS_ROW_BSTAT_UPPER     '2'
00214 
00215 
00216 /****************************************************************************/
00217 /*                                                                          */
00218 /*         Return Status for dbl_QSopt_primal, dbl_QSopt_dual, dbl_QSget_status         */
00219 /*                                                                          */
00220 /****************************************************************************/
00221 
00222 #define QS_LP_OPTIMAL           1
00223 #define QS_LP_INFEASIBLE        2
00224 #define QS_LP_UNBOUNDED         3
00225 #define QS_LP_ITER_LIMIT        4
00226 #define QS_LP_TIME_LIMIT        5
00227 #define QS_LP_UNSOLVED          6
00228 #define QS_LP_ABORTED   7
00229 #define QS_LP_NUMERR            8
00230 #define QS_LP_OBJ_LIMIT         9
00231 #define QS_LP_MODIFIED        100
00232 #define QS_LP_CHANGE_PREC     1024
00233 #endif
00234 
00235 
00236 
00237 /** @brief If set to one, them we allow to re-start the simplex algorithm due to
00238  * numerical issues */
00239 #define DO_NUMER 0
00240 /** @brief If set to one, then we allow to re-start simplex due to singular
00241  * basis */
00242 #define DO_SINGULAR 0
00243 
00244 /** @brief Factor for wich we change tolerances each time we have to resume
00245  * simplex */
00246 #define SIMPLEX_FACTOR 5U
00247 #define DENSE_PI 0
00248 #define DENSE_PIIPI 0
00249 #define DENSE_NORM 0
00250 #define SIMPLEX_DEBUG 0
00251 
00252 
00253 /* possible values of nextstep */
00254 #define SIMPLEX_CONTINUE   1
00255 #define SIMPLEX_TERMINATE  2
00256 #define SIMPLEX_RESUME     3
00257 
00258 /* reason for resuming simplex */
00259 #define SIMPLEX_RESUME_SING     1
00260 #define SIMPLEX_RESUME_UNSHIFT  2
00261 #define SIMPLEX_RESUME_NUMER    3
00262 
00263 /* values for newphase */
00264 #define SIMPLEX_PHASE_RECOMP  1
00265 #define SIMPLEX_PHASE_NEW     2
00266 
00267 #define SIMPLEX_PIVOTINROW 1
00268 #define SIMPLEX_PIVOTINCOL 2
00269 #define SIMPLEX_MAX_RESTART 4
00270 #define SIMPLEX_MAX_PIVOT_FAIL 300
00271 
00272 
00273 #define FALSE 0
00274 #define TRUE  1
00275 #define QS_FACTOR_MAX_K        1
00276 #define QS_FACTOR_P            2
00277 #define QS_FACTOR_ETAMAX       3
00278 #define QS_FACTOR_FZERO_TOL    4
00279 #define QS_FACTOR_SZERO_TOL    5
00280 #define QS_FACTOR_PARTIAL_TOL  6
00281 #define QS_FACTOR_UR_SPACE_MUL 7
00282 #define QS_FACTOR_UC_SPACE_MUL 8
00283 #define QS_FACTOR_LC_SPACE_MUL 9
00284 #define QS_FACTOR_LR_SPACE_MUL 10
00285 #define QS_FACTOR_ER_SPACE_MUL 11
00286 #define QS_FACTOR_GROW_MUL     12
00287 #define QS_FACTOR_MAXMULT      13
00288 #define QS_FACTOR_MINMULT      14
00289 #define QS_FACTOR_UPDMAXMULT   15
00290 #define QS_FACTOR_DENSE_FRACT  16
00291 #define QS_FACTOR_DENSE_MIN    17
00292 #define E_CHECK_FAILED 6
00293 #define E_NO_PIVOT 7
00294 #define E_FACTOR_BLOWUP 8
00295 #define E_UPDATE_NOSPACE 9
00296 #define E_UPDATE_SINGULAR_ROW 10
00297 #define E_UPDATE_SINGULAR_COL 11
00298 #define E_SING_NO_DATA 12
00299 #define E_SINGULAR_INTERNAL 13
00300 #define SPARSE_FACTOR 0.05
00301 #define CNT_YNZ           1     /* nz in entering columns */
00302 #define CNT_ZNZ           2     /* nz in ith row of B^{-1}, ie z_i */
00303 #define CNT_ZANZ          3     /* nz in ith row of B^{-1}, ie z_i */
00304 #define CNT_PINZ          4     /* nz in phase II pi (solve) */
00305 #define CNT_P1PINZ        5     /* nz in phase I pi (solve) */
00306 #define CNT_UPNZ          6     /* nz in ftran_updates */
00307 #define CNT_PPHASE1ITER   7     /* primal phase I iterations */
00308 #define CNT_PPHASE2ITER   8
00309 #define CNT_DPHASE1ITER   9     /* dual phase I iterations */
00310 #define CNT_DPHASE2ITER   10
00311 #define CNT_PIPIV         11
00312 #define CNT_PIIPIV        12
00313 #define CNT_DIPIV         13
00314 #define CNT_DIIPIV        14
00315 #define CNT_YRAVG         15
00316 #define CNT_ZARAVG        16
00317 
00318 #define ROW_PIVOT         0
00319 #define COL_PIVOT         1
00320 
00321 #define ILL_LP_OPTIMAL           1
00322 #define ILL_LP_NONOPTIMAL        2
00323 #define ILL_LP_PRIMAL_FEASIBLE   3
00324 #define ILL_LP_PRIMAL_INFEASIBLE 4
00325 #define ILL_LP_PRIMAL_UNBOUNDED  5
00326 #define ILL_LP_DUAL_FEASIBLE     6
00327 #define ILL_LP_DUAL_INFEASIBLE   7
00328 #define ILL_LP_DUAL_UNBOUNDED    8
00329 
00330 typedef enum
00331 { ILL_MPS_NAME, ILL_MPS_OBJSENSE, ILL_MPS_OBJNAME,
00332   ILL_MPS_ROWS, ILL_MPS_COLS, ILL_MPS_RHS, ILL_MPS_RANGES,
00333   ILL_MPS_BOUNDS, ILL_MPS_REFROW, ILL_MPS_ENDATA,
00334   ILL_MPS_NONE
00335 }
00336 ILLmps_section;
00337 
00338 #define ILL_MPS_N_SECTIONS ILL_MPS_NONE
00339 
00340 /*define as > 0 if heap is to be used */
00341 #define USEHEAP 1
00342 
00343 /*result of pricing */
00344 #define PRICE_OPTIMAL 1
00345 #define PRICE_NONOPTIMAL  2
00346 
00347 /*type of pricing */
00348 #define ROW_PRICING 1
00349 #define COL_PRICING 2
00350 
00351 
00352 /****************************************************************************
00353  * error collection
00354  */
00355 #define QS_DATA_ERROR     0
00356 #define QS_DATA_WARN      1
00357 #define QS_MPS_FORMAT_ERROR   2
00358 #define QS_MPS_FORMAT_WARN    3
00359 #define QS_LP_FORMAT_ERROR    4
00360 #define QS_LP_FORMAT_WARN   5
00361 #define QS_INPUT_NERROR        8
00362 
00363 /* defs for phase I ratio test */
00364 #define BBOUND    1
00365 #define BATOLOWER 2
00366 #define BATOUPPER 3
00367 #define BBTOLOWER 4
00368 #define BBTOUPPER 5
00369 #define BSKIP     6
00370 
00371 /* result of ratio test */
00372 #define RATIO_UNBOUNDED 1
00373 #define RATIO_NOBCHANGE 2
00374 #define RATIO_BCHANGE   3
00375 #define RATIO_FAILED    4
00376 #define RATIO_NEGATIVE  5
00377 
00378 /* warning level */
00379 #define QSE_WLVL 10000
00380 
00381 
00382 
00383 
00384 
00385 
00386 #endif

Generated on Thu Mar 29 09:32:29 2012 for QSopt_ex by  doxygen 1.4.7