mpq_lpdata.h

Go to the documentation of this file.
00001 #include "qs_config.h"
00002 #ifdef HAVE_LIBGMP
00003 #if HAVE_LIBGMP
00004 /****************************************************************************/
00005 /*                                                                          */
00006 /*  This file is part of QSopt_ex.                                          */
00007 /*                                                                          */
00008 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
00009 /*  and Daniel Espinoza                                                     */
00010 /*                                                                          */
00011 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
00012 /*  copyright in QSopt.                                                     */
00013 /*                                                                          */
00014 /*  This code may be used under the terms of the GNU General Public License */
00015 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
00016 /*                                                                          */
00017 /*  Alternatively, use is granted for research purposes only.               */
00018 /*                                                                          */
00019 /*  It is your choice of which of these two licenses you are operating      */
00020 /*  under.                                                                  */
00021 /*                                                                          */
00022 /*  We make no guarantees about the correctness or usefulness of this code. */
00023 /*                                                                          */
00024 /****************************************************************************/
00025 
00026 /* RCSINFO $Id: mpq_lpdata.h,v 1.4 2003/11/05 17:00:56 meven Exp $ */
00027 #ifndef mpq_ILL_LPDATA_H
00028 #define mpq_ILL_LPDATA_H
00029 
00030 #include "config.h"
00031 #include "mpq_qstruct.h"
00032 #include "mpq_iqsutil.h"
00033 #include "mpq_readline.h"
00034 #include "reporter.h"
00035 #include "mpq_format.h"
00036 #include "mpq_dstruct.h"
00037 
00038 extern mpq_t mpq_ILL_MAXDOUBLE; /*  1e150 */
00039 extern mpq_t mpq_ILL_MINDOUBLE; /* -1e150 */
00040 
00041 #define mpq_ILL_MAXINT    (2147483647)  /* this is equal to 2^31-1 */
00042 #define mpq_ILL_MIN       (1)       /* Must be same as QS_MIN */
00043 #define mpq_ILL_MAX       (-1)      /* Must be same as QS_MAX */
00044 
00045 /*  Setting Alg in Presolve  */
00046 
00047 #define mpq_ILL_PRE_SCALE           1
00048 #define mpq_ILL_PRE_FIXED           2
00049 #define mpq_ILL_PRE_SINGLE_ROW      4
00050 #define mpq_ILL_PRE_FORCING         8
00051 #define mpq_ILL_PRE_SINGLE_COL     16
00052 #define mpq_ILL_PRE_DUPLICATE_ROW  32
00053 #define mpq_ILL_PRE_DUPLICATE_COL  64
00054 #define mpq_ILL_PRE_EMPTY_COL     128
00055 #define mpq_ILL_PRE_ALL (mpq_ILL_PRE_SCALE | mpq_ILL_PRE_FIXED | mpq_ILL_PRE_SINGLE_ROW           \
00056                     mpq_ILL_PRE_FORCING | mpq_ILL_PRE_SINGLE_COL | mpq_ILL_PRE_DUPLICATE_ROW \
00057                    mpq_ILL_PRE_DUPLICATE_COL | mpq_ILL_PRE_EMPTY_COL)
00058 #define mpq_ILL_PRE_SIMPLE (mpq_ILL_PRE_FIXED | mpq_ILL_PRE_EMPTY_COL)
00059 
00060 typedef struct mpq_ILLlpdata
00061 {                               /* Complete LP data filled in by mpsread.  */
00062   int nrows;
00063   int ncols;
00064   int nstruct;                  /* Not including logicals.                 */
00065   int nzcount;
00066   int rowsize;                  /* Length of row arrays.                   */
00067   int colsize;                  /* Length of col arrays.                   */
00068   int structsize;               /* Length of intmarker, structmap,         */
00069   /* colnames                                */
00070   int objsense;
00071   char *sense;                  /* Original sense, not after logicals.     */
00072   mpq_t *obj;
00073   mpq_t *rhs;
00074   mpq_t *rangeval;
00075   mpq_t *lower;
00076   mpq_t *upper;
00077   mpq_ILLmatrix A;                  /* The coef matrix.                        */
00078   struct mpq_ILLlp_rows *rA;        /* Coef matrix in row form.                */
00079 
00080   char **rownames;
00081   ILLsymboltab rowtab;          /* contains rownames in no particular order */
00082   char *objname;                /* if colname is not NULL it is entered into 
00083                                  * the rowtab, see reader fcts in mpq_lp.c, mpq_mps.c*/
00084 
00085   char **colnames;              /* columns of struct variables */
00086   ILLsymboltab coltab;          /* contains colnames in no particular order */
00087 
00088   char *probname;
00089   char *intmarker;
00090   int *structmap;               /* Indices of structural variables         */
00091   int *rowmap;                  /* Indices of logical and range variables  */
00092   struct mpq_ILLlp_basis *basis;
00093   struct mpq_ILLlp_predata *presolve;
00094   struct mpq_ILLlp_sinfo *sinfo;
00095 
00096    /**************************************************************************/
00097   /* these fields are currently only set by mpq_mps.c reader fcts               */
00098    /**************************************************************************/
00099   mpq_ILLmatrix sos;                /* columns are the sets, rows are the  
00100                                  * problem's structural variables
00101                                  * coefficients are the weights */
00102 
00103   char *sos_type;               /* type of each set */
00104   int *is_sos_mem;              /* for each structural variable contains 
00105                                  *    -1 == not a set member
00106                                  *     i == member of sos set i 
00107                                  *          where 0 <= i < sos.matcols */
00108   char *refrowname;             /* name of reference row */
00109   int refind;                   /* index of reference row 
00110                                  *     -1 if refrow was a free row 
00111                                  *          and weights are found only in the 
00112                                  *          sos matrix 
00113                                  *     index >=0 if refrow is also a lp-row */
00114 
00115    /**************************************************************************
00116     * mpq_QSset_reporter initializes reporter 
00117     **************************************************************************/
00118   qsstring_reporter reporter;   /* used from within ILL fcts 
00119                                  * to report mpq_feedback */
00120 }
00121 mpq_ILLlpdata;
00122 
00123 typedef struct mpq_ILLlp_basis
00124 {
00125   int nstruct;
00126   int nrows;
00127   int rownorms_size;
00128   int colnorms_size;
00129   char *cstat;
00130   char *rstat;
00131   mpq_t *rownorms;
00132   mpq_t *colnorms;
00133 }
00134 mpq_ILLlp_basis;
00135 
00136 typedef struct mpq_ILLlp_cache
00137 {
00138   int nstruct;
00139   int nrows;
00140   int status;
00141   mpq_t val;
00142   mpq_t *x;
00143   mpq_t *pi;
00144   mpq_t *rc;
00145   mpq_t *slack;
00146 }
00147 mpq_ILLlp_cache;
00148 
00149 typedef struct mpq_ILLlp_sinfo
00150 {                               /* LP info returned by presolve            */
00151   int ncols;
00152   int nrows;
00153   int nzcount;
00154   int rowsize;
00155   int colsize;
00156   int objsense;
00157 
00158   mpq_t *obj;
00159   mpq_t *rhs;
00160   mpq_t *lower;
00161   mpq_t *upper;
00162 
00163   mpq_ILLmatrix A;
00164 
00165   char **colnames;              /* Just for debugging - not updated */
00166 }
00167 mpq_ILLlp_sinfo;
00168 
00169 typedef struct mpq_ILLlp_preline
00170 {
00171   mpq_t rhs;
00172   mpq_t obj;
00173   mpq_t lower;
00174   mpq_t upper;
00175   int count;
00176   int *ind;
00177   int row_or_col;               /* 0 is row, 1 is col */
00178   mpq_t *val;
00179 }
00180 mpq_ILLlp_preline;
00181 
00182 typedef struct mpq_ILLlp_preop
00183 {
00184   int ptype;
00185   int rowindex;
00186   int colindex;
00187   mpq_ILLlp_preline line;
00188 }
00189 mpq_ILLlp_preop;
00190 
00191 typedef struct mpq_ILLlp_predata
00192 {                               /* Data needed in un-presolve.            */
00193   int opcount;
00194   int opsize;
00195   mpq_ILLlp_preop *oplist;
00196   int r_nrows;
00197   int r_ncols;
00198   int *colmap;
00199   int *rowmap;
00200   mpq_t *rowscale;
00201   mpq_t *colscale;
00202   mpq_t *colfixval;
00203   mpq_t *rowfixval;
00204 }
00205 mpq_ILLlp_predata;
00206 
00207 typedef struct mpq_ILLlp_rows
00208 {
00209   int *rowbeg;
00210   int *rowcnt;
00211   int *rowind;
00212   mpq_t *rowval;
00213 }
00214 mpq_ILLlp_rows;
00215 
00216 
00217 /****************************************************************************/
00218 /*                                                                          */
00219 /*                             mpq_lpdata.c                                     */
00220 /*                                                                          */
00221 /****************************************************************************/
00222 
00223 struct mpq_qsdata *mpq_ILLread (
00224   mpq_qsline_reader * file,
00225   const char *mpq_fname,
00226   int isMps);
00227 void mpq_ILLstart (
00228   void);              /**< initialize mpq_ILL_MAXDOUBLE and other 
00229 
00230                            constants, this funtion should be callef AFTER 
00231                            EGlpNumStart() */
00232 void mpq_ILLend (
00233   void);            /**< free any internal data asociated with variable 
00234 
00235                          mpq_precision numbers */
00236 void mpq_ILLchange_precision (
00237   void);                        /**< This function re-compute the internal 
00238 
00239                                      variables mpq_precision to the (previously 
00240                                      set) EGLPNUM_PRECISION value (done with 
00241                                      EGlpNumSetPrecision) */
00242 void mpq_ILLlpdata_init (
00243   mpq_ILLlpdata * lp);
00244 void mpq_ILLlpdata_free (
00245   mpq_ILLlpdata * lp);
00246 void mpq_ILLlp_basis_init (
00247   mpq_ILLlp_basis * B);
00248 void mpq_ILLlp_basis_free (
00249   mpq_ILLlp_basis * B);
00250 void mpq_ILLlp_cache_init (
00251   mpq_ILLlp_cache * C);
00252 void mpq_ILLlp_cache_free (
00253   mpq_ILLlp_cache * C);
00254 int mpq_ILLlp_basis_alloc (
00255   mpq_ILLlp_basis * B,
00256   int ncols,
00257   int nrows);
00258 int mpq_ILLlp_cache_alloc (
00259   mpq_ILLlp_cache * C,
00260   int ncols,
00261   int nrows);
00262 
00263 int mpq_ILLlp_rows_init (
00264   mpq_ILLlp_rows * lp_rows,
00265   mpq_ILLlpdata * lp,
00266   int include_logicals);
00267 void mpq_ILLlp_rows_clear (
00268   mpq_ILLlp_rows * lp_rows);
00269 int mpq_ILLprint_report (
00270   mpq_ILLlpdata * lp,
00271   const char *format,
00272   ...);
00273 
00274               /* print to lp->reporter */
00275 
00276 /****************************************************************************/
00277 /*                                                                          */
00278 /*                             mpq_presolve.c                                   */
00279 /*                                                                          */
00280 /****************************************************************************/
00281 
00282 void mpq_ILLlp_sinfo_init (
00283   mpq_ILLlp_sinfo * sinfo),
00284   mpq_ILLlp_sinfo_free (
00285   mpq_ILLlp_sinfo * sinfo),
00286   mpq_ILLlp_predata_init (
00287   mpq_ILLlp_predata * pre),
00288   mpq_ILLlp_predata_free (
00289   mpq_ILLlp_predata * pre);
00290 
00291 int mpq_ILLlp_add_logicals (
00292   mpq_ILLlpdata * lp),
00293   mpq_ILLlp_scale (
00294   mpq_ILLlpdata * lp),
00295   mpq_ILLlp_presolve (
00296   mpq_ILLlpdata * lp,
00297   int pre_types);
00298 
00299 /* ========================================================================= */
00300 /* if non-zero, then internal data has been initialized, and there is some
00301  * memory allocated, if zero, no internal memory has been allocated
00302  * (or it has been freed) */
00303 extern int mpq___QSEX_SETUP;
00304 
00305 #endif /* __ILL_LPDATA_H */
00306 #endif
00307 #endif

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