dbl_lpdata.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 
00023 /* RCSINFO $Id: dbl_lpdata.h,v 1.4 2003/11/05 17:00:56 meven Exp $ */
00024 #ifndef dbl_ILL_LPDATA_H
00025 #define dbl_ILL_LPDATA_H
00026 
00027 #include "config.h"
00028 #include "dbl_qstruct.h"
00029 #include "dbl_iqsutil.h"
00030 #include "dbl_readline.h"
00031 #include "reporter.h"
00032 #include "dbl_format.h"
00033 #include "dbl_dstruct.h"
00034 
00035 extern double dbl_ILL_MAXDOUBLE;  /*  1e150 */
00036 extern double dbl_ILL_MINDOUBLE;  /* -1e150 */
00037 
00038 #define dbl_ILL_MAXINT    (2147483647)  /* this is equal to 2^31-1 */
00039 #define dbl_ILL_MIN       (1)       /* Must be same as QS_MIN */
00040 #define dbl_ILL_MAX       (-1)      /* Must be same as QS_MAX */
00041 
00042 /*  Setting Alg in Presolve  */
00043 
00044 #define dbl_ILL_PRE_SCALE           1
00045 #define dbl_ILL_PRE_FIXED           2
00046 #define dbl_ILL_PRE_SINGLE_ROW      4
00047 #define dbl_ILL_PRE_FORCING         8
00048 #define dbl_ILL_PRE_SINGLE_COL     16
00049 #define dbl_ILL_PRE_DUPLICATE_ROW  32
00050 #define dbl_ILL_PRE_DUPLICATE_COL  64
00051 #define dbl_ILL_PRE_EMPTY_COL     128
00052 #define dbl_ILL_PRE_ALL (dbl_ILL_PRE_SCALE | dbl_ILL_PRE_FIXED | dbl_ILL_PRE_SINGLE_ROW           \
00053                     dbl_ILL_PRE_FORCING | dbl_ILL_PRE_SINGLE_COL | dbl_ILL_PRE_DUPLICATE_ROW \
00054                    dbl_ILL_PRE_DUPLICATE_COL | dbl_ILL_PRE_EMPTY_COL)
00055 #define dbl_ILL_PRE_SIMPLE (dbl_ILL_PRE_FIXED | dbl_ILL_PRE_EMPTY_COL)
00056 
00057 typedef struct dbl_ILLlpdata
00058 {                               /* Complete LP data filled in by mpsread.  */
00059   int nrows;
00060   int ncols;
00061   int nstruct;                  /* Not including logicals.                 */
00062   int nzcount;
00063   int rowsize;                  /* Length of row arrays.                   */
00064   int colsize;                  /* Length of col arrays.                   */
00065   int structsize;               /* Length of intmarker, structmap,         */
00066   /* colnames                                */
00067   int objsense;
00068   char *sense;                  /* Original sense, not after logicals.     */
00069   double *obj;
00070   double *rhs;
00071   double *rangeval;
00072   double *lower;
00073   double *upper;
00074   dbl_ILLmatrix A;                  /* The coef matrix.                        */
00075   struct dbl_ILLlp_rows *rA;        /* Coef matrix in row form.                */
00076 
00077   char **rownames;
00078   ILLsymboltab rowtab;          /* contains rownames in no particular order */
00079   char *objname;                /* if colname is not NULL it is entered into 
00080                                  * the rowtab, see reader fcts in dbl_lp.c, dbl_mps.c*/
00081 
00082   char **colnames;              /* columns of struct variables */
00083   ILLsymboltab coltab;          /* contains colnames in no particular order */
00084 
00085   char *probname;
00086   char *intmarker;
00087   int *structmap;               /* Indices of structural variables         */
00088   int *rowmap;                  /* Indices of logical and range variables  */
00089   struct dbl_ILLlp_basis *basis;
00090   struct dbl_ILLlp_predata *presolve;
00091   struct dbl_ILLlp_sinfo *sinfo;
00092 
00093    /**************************************************************************/
00094   /* these fields are currently only set by dbl_mps.c reader fcts               */
00095    /**************************************************************************/
00096   dbl_ILLmatrix sos;                /* columns are the sets, rows are the  
00097                                  * problem's structural variables
00098                                  * coefficients are the weights */
00099 
00100   char *sos_type;               /* type of each set */
00101   int *is_sos_mem;              /* for each structural variable contains 
00102                                  *    -1 == not a set member
00103                                  *     i == member of sos set i 
00104                                  *          where 0 <= i < sos.matcols */
00105   char *refrowname;             /* name of reference row */
00106   int refind;                   /* index of reference row 
00107                                  *     -1 if refrow was a free row 
00108                                  *          and weights are found only in the 
00109                                  *          sos matrix 
00110                                  *     index >=0 if refrow is also a lp-row */
00111 
00112    /**************************************************************************
00113     * dbl_QSset_reporter initializes reporter 
00114     **************************************************************************/
00115   qsstring_reporter reporter;   /* used from within ILL fcts 
00116                                  * to report dbl_feedback */
00117 }
00118 dbl_ILLlpdata;
00119 
00120 typedef struct dbl_ILLlp_basis
00121 {
00122   int nstruct;
00123   int nrows;
00124   int rownorms_size;
00125   int colnorms_size;
00126   char *cstat;
00127   char *rstat;
00128   double *rownorms;
00129   double *colnorms;
00130 }
00131 dbl_ILLlp_basis;
00132 
00133 typedef struct dbl_ILLlp_cache
00134 {
00135   int nstruct;
00136   int nrows;
00137   int status;
00138   double val;
00139   double *x;
00140   double *pi;
00141   double *rc;
00142   double *slack;
00143 }
00144 dbl_ILLlp_cache;
00145 
00146 typedef struct dbl_ILLlp_sinfo
00147 {                               /* LP info returned by presolve            */
00148   int ncols;
00149   int nrows;
00150   int nzcount;
00151   int rowsize;
00152   int colsize;
00153   int objsense;
00154 
00155   double *obj;
00156   double *rhs;
00157   double *lower;
00158   double *upper;
00159 
00160   dbl_ILLmatrix A;
00161 
00162   char **colnames;              /* Just for debugging - not updated */
00163 }
00164 dbl_ILLlp_sinfo;
00165 
00166 typedef struct dbl_ILLlp_preline
00167 {
00168   double rhs;
00169   double obj;
00170   double lower;
00171   double upper;
00172   int count;
00173   int *ind;
00174   int row_or_col;               /* 0 is row, 1 is col */
00175   double *val;
00176 }
00177 dbl_ILLlp_preline;
00178 
00179 typedef struct dbl_ILLlp_preop
00180 {
00181   int ptype;
00182   int rowindex;
00183   int colindex;
00184   dbl_ILLlp_preline line;
00185 }
00186 dbl_ILLlp_preop;
00187 
00188 typedef struct dbl_ILLlp_predata
00189 {                               /* Data needed in un-presolve.            */
00190   int opcount;
00191   int opsize;
00192   dbl_ILLlp_preop *oplist;
00193   int r_nrows;
00194   int r_ncols;
00195   int *colmap;
00196   int *rowmap;
00197   double *rowscale;
00198   double *colscale;
00199   double *colfixval;
00200   double *rowfixval;
00201 }
00202 dbl_ILLlp_predata;
00203 
00204 typedef struct dbl_ILLlp_rows
00205 {
00206   int *rowbeg;
00207   int *rowcnt;
00208   int *rowind;
00209   double *rowval;
00210 }
00211 dbl_ILLlp_rows;
00212 
00213 
00214 /****************************************************************************/
00215 /*                                                                          */
00216 /*                             dbl_lpdata.c                                     */
00217 /*                                                                          */
00218 /****************************************************************************/
00219 
00220 struct dbl_qsdata *dbl_ILLread (
00221   dbl_qsline_reader * file,
00222   const char *dbl_fname,
00223   int isMps);
00224 void dbl_ILLstart (
00225   void);              /**< initialize dbl_ILL_MAXDOUBLE and other 
00226 
00227                            constants, this funtion should be callef AFTER 
00228                            EGlpNumStart() */
00229 void dbl_ILLend (
00230   void);            /**< free any internal data asociated with variable 
00231 
00232                          dbl_precision numbers */
00233 void dbl_ILLchange_precision (
00234   void);                        /**< This function re-compute the internal 
00235 
00236                                      variables dbl_precision to the (previously 
00237                                      set) EGLPNUM_PRECISION value (done with 
00238                                      EGlpNumSetPrecision) */
00239 void dbl_ILLlpdata_init (
00240   dbl_ILLlpdata * lp);
00241 void dbl_ILLlpdata_free (
00242   dbl_ILLlpdata * lp);
00243 void dbl_ILLlp_basis_init (
00244   dbl_ILLlp_basis * B);
00245 void dbl_ILLlp_basis_free (
00246   dbl_ILLlp_basis * B);
00247 void dbl_ILLlp_cache_init (
00248   dbl_ILLlp_cache * C);
00249 void dbl_ILLlp_cache_free (
00250   dbl_ILLlp_cache * C);
00251 int dbl_ILLlp_basis_alloc (
00252   dbl_ILLlp_basis * B,
00253   int ncols,
00254   int nrows);
00255 int dbl_ILLlp_cache_alloc (
00256   dbl_ILLlp_cache * C,
00257   int ncols,
00258   int nrows);
00259 
00260 int dbl_ILLlp_rows_init (
00261   dbl_ILLlp_rows * lp_rows,
00262   dbl_ILLlpdata * lp,
00263   int include_logicals);
00264 void dbl_ILLlp_rows_clear (
00265   dbl_ILLlp_rows * lp_rows);
00266 int dbl_ILLprint_report (
00267   dbl_ILLlpdata * lp,
00268   const char *format,
00269   ...);
00270 
00271               /* print to lp->reporter */
00272 
00273 /****************************************************************************/
00274 /*                                                                          */
00275 /*                             dbl_presolve.c                                   */
00276 /*                                                                          */
00277 /****************************************************************************/
00278 
00279 void dbl_ILLlp_sinfo_init (
00280   dbl_ILLlp_sinfo * sinfo),
00281   dbl_ILLlp_sinfo_free (
00282   dbl_ILLlp_sinfo * sinfo),
00283   dbl_ILLlp_predata_init (
00284   dbl_ILLlp_predata * pre),
00285   dbl_ILLlp_predata_free (
00286   dbl_ILLlp_predata * pre);
00287 
00288 int dbl_ILLlp_add_logicals (
00289   dbl_ILLlpdata * lp),
00290   dbl_ILLlp_scale (
00291   dbl_ILLlpdata * lp),
00292   dbl_ILLlp_presolve (
00293   dbl_ILLlpdata * lp,
00294   int pre_types);
00295 
00296 /* ========================================================================= */
00297 /* if non-zero, then internal data has been initialized, and there is some
00298  * memory allocated, if zero, no internal memory has been allocated
00299  * (or it has been freed) */
00300 extern int dbl___QSEX_SETUP;
00301 
00302 #endif /* __ILL_LPDATA_H */

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