ldbl_lpdata.h

Go to the documentation of this file.
00001 #include "qs_config.h"
00002 #ifdef HAVE_LONG_DOUBLE
00003 #if HAVE_LONG_DOUBLE
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: ldbl_lpdata.h,v 1.4 2003/11/05 17:00:56 meven Exp $ */
00027 #ifndef ldbl_ILL_LPDATA_H
00028 #define ldbl_ILL_LPDATA_H
00029 
00030 #include "config.h"
00031 #include "ldbl_qstruct.h"
00032 #include "ldbl_iqsutil.h"
00033 #include "ldbl_readline.h"
00034 #include "reporter.h"
00035 #include "ldbl_format.h"
00036 #include "ldbl_dstruct.h"
00037 
00038 extern long double ldbl_ILL_MAXDOUBLE;  /*  1e150 */
00039 extern long double ldbl_ILL_MINDOUBLE;  /* -1e150 */
00040 
00041 #define ldbl_ILL_MAXINT    (2147483647) /* this is equal to 2^31-1 */
00042 #define ldbl_ILL_MIN       (1)        /* Must be same as QS_MIN */
00043 #define ldbl_ILL_MAX       (-1)     /* Must be same as QS_MAX */
00044 
00045 /*  Setting Alg in Presolve  */
00046 
00047 #define ldbl_ILL_PRE_SCALE           1
00048 #define ldbl_ILL_PRE_FIXED           2
00049 #define ldbl_ILL_PRE_SINGLE_ROW      4
00050 #define ldbl_ILL_PRE_FORCING         8
00051 #define ldbl_ILL_PRE_SINGLE_COL     16
00052 #define ldbl_ILL_PRE_DUPLICATE_ROW  32
00053 #define ldbl_ILL_PRE_DUPLICATE_COL  64
00054 #define ldbl_ILL_PRE_EMPTY_COL     128
00055 #define ldbl_ILL_PRE_ALL (ldbl_ILL_PRE_SCALE | ldbl_ILL_PRE_FIXED | ldbl_ILL_PRE_SINGLE_ROW           \
00056                     ldbl_ILL_PRE_FORCING | ldbl_ILL_PRE_SINGLE_COL | ldbl_ILL_PRE_DUPLICATE_ROW \
00057                    ldbl_ILL_PRE_DUPLICATE_COL | ldbl_ILL_PRE_EMPTY_COL)
00058 #define ldbl_ILL_PRE_SIMPLE (ldbl_ILL_PRE_FIXED | ldbl_ILL_PRE_EMPTY_COL)
00059 
00060 typedef struct ldbl_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   long double *obj;
00073   long double *rhs;
00074   long double *rangeval;
00075   long double *lower;
00076   long double *upper;
00077   ldbl_ILLmatrix A;                 /* The coef matrix.                        */
00078   struct ldbl_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 ldbl_lp.c, ldbl_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 ldbl_ILLlp_basis *basis;
00093   struct ldbl_ILLlp_predata *presolve;
00094   struct ldbl_ILLlp_sinfo *sinfo;
00095 
00096    /**************************************************************************/
00097   /* these fields are currently only set by ldbl_mps.c reader fcts               */
00098    /**************************************************************************/
00099   ldbl_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     * ldbl_QSset_reporter initializes reporter 
00117     **************************************************************************/
00118   qsstring_reporter reporter;   /* used from within ILL fcts 
00119                                  * to report ldbl_feedback */
00120 }
00121 ldbl_ILLlpdata;
00122 
00123 typedef struct ldbl_ILLlp_basis
00124 {
00125   int nstruct;
00126   int nrows;
00127   int rownorms_size;
00128   int colnorms_size;
00129   char *cstat;
00130   char *rstat;
00131   long double *rownorms;
00132   long double *colnorms;
00133 }
00134 ldbl_ILLlp_basis;
00135 
00136 typedef struct ldbl_ILLlp_cache
00137 {
00138   int nstruct;
00139   int nrows;
00140   int status;
00141   long double val;
00142   long double *x;
00143   long double *pi;
00144   long double *rc;
00145   long double *slack;
00146 }
00147 ldbl_ILLlp_cache;
00148 
00149 typedef struct ldbl_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   long double *obj;
00159   long double *rhs;
00160   long double *lower;
00161   long double *upper;
00162 
00163   ldbl_ILLmatrix A;
00164 
00165   char **colnames;              /* Just for debugging - not updated */
00166 }
00167 ldbl_ILLlp_sinfo;
00168 
00169 typedef struct ldbl_ILLlp_preline
00170 {
00171   long double rhs;
00172   long double obj;
00173   long double lower;
00174   long double upper;
00175   int count;
00176   int *ind;
00177   int row_or_col;               /* 0 is row, 1 is col */
00178   long double *val;
00179 }
00180 ldbl_ILLlp_preline;
00181 
00182 typedef struct ldbl_ILLlp_preop
00183 {
00184   int ptype;
00185   int rowindex;
00186   int colindex;
00187   ldbl_ILLlp_preline line;
00188 }
00189 ldbl_ILLlp_preop;
00190 
00191 typedef struct ldbl_ILLlp_predata
00192 {                               /* Data needed in un-presolve.            */
00193   int opcount;
00194   int opsize;
00195   ldbl_ILLlp_preop *oplist;
00196   int r_nrows;
00197   int r_ncols;
00198   int *colmap;
00199   int *rowmap;
00200   long double *rowscale;
00201   long double *colscale;
00202   long double *colfixval;
00203   long double *rowfixval;
00204 }
00205 ldbl_ILLlp_predata;
00206 
00207 typedef struct ldbl_ILLlp_rows
00208 {
00209   int *rowbeg;
00210   int *rowcnt;
00211   int *rowind;
00212   long double *rowval;
00213 }
00214 ldbl_ILLlp_rows;
00215 
00216 
00217 /****************************************************************************/
00218 /*                                                                          */
00219 /*                             ldbl_lpdata.c                                     */
00220 /*                                                                          */
00221 /****************************************************************************/
00222 
00223 struct ldbl_qsdata *ldbl_ILLread (
00224   ldbl_qsline_reader * file,
00225   const char *ldbl_fname,
00226   int isMps);
00227 void ldbl_ILLstart (
00228   void);              /**< initialize ldbl_ILL_MAXDOUBLE and other 
00229 
00230                            constants, this funtion should be callef AFTER 
00231                            EGlpNumStart() */
00232 void ldbl_ILLend (
00233   void);            /**< free any internal data asociated with variable 
00234 
00235                          ldbl_precision numbers */
00236 void ldbl_ILLchange_precision (
00237   void);                        /**< This function re-compute the internal 
00238 
00239                                      variables ldbl_precision to the (previously 
00240                                      set) EGLPNUM_PRECISION value (done with 
00241                                      EGlpNumSetPrecision) */
00242 void ldbl_ILLlpdata_init (
00243   ldbl_ILLlpdata * lp);
00244 void ldbl_ILLlpdata_free (
00245   ldbl_ILLlpdata * lp);
00246 void ldbl_ILLlp_basis_init (
00247   ldbl_ILLlp_basis * B);
00248 void ldbl_ILLlp_basis_free (
00249   ldbl_ILLlp_basis * B);
00250 void ldbl_ILLlp_cache_init (
00251   ldbl_ILLlp_cache * C);
00252 void ldbl_ILLlp_cache_free (
00253   ldbl_ILLlp_cache * C);
00254 int ldbl_ILLlp_basis_alloc (
00255   ldbl_ILLlp_basis * B,
00256   int ncols,
00257   int nrows);
00258 int ldbl_ILLlp_cache_alloc (
00259   ldbl_ILLlp_cache * C,
00260   int ncols,
00261   int nrows);
00262 
00263 int ldbl_ILLlp_rows_init (
00264   ldbl_ILLlp_rows * lp_rows,
00265   ldbl_ILLlpdata * lp,
00266   int include_logicals);
00267 void ldbl_ILLlp_rows_clear (
00268   ldbl_ILLlp_rows * lp_rows);
00269 int ldbl_ILLprint_report (
00270   ldbl_ILLlpdata * lp,
00271   const char *format,
00272   ...);
00273 
00274               /* print to lp->reporter */
00275 
00276 /****************************************************************************/
00277 /*                                                                          */
00278 /*                             ldbl_presolve.c                                   */
00279 /*                                                                          */
00280 /****************************************************************************/
00281 
00282 void ldbl_ILLlp_sinfo_init (
00283   ldbl_ILLlp_sinfo * sinfo),
00284   ldbl_ILLlp_sinfo_free (
00285   ldbl_ILLlp_sinfo * sinfo),
00286   ldbl_ILLlp_predata_init (
00287   ldbl_ILLlp_predata * pre),
00288   ldbl_ILLlp_predata_free (
00289   ldbl_ILLlp_predata * pre);
00290 
00291 int ldbl_ILLlp_add_logicals (
00292   ldbl_ILLlpdata * lp),
00293   ldbl_ILLlp_scale (
00294   ldbl_ILLlpdata * lp),
00295   ldbl_ILLlp_presolve (
00296   ldbl_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 ldbl___QSEX_SETUP;
00304 
00305 #endif /* __ILL_LPDATA_H */
00306 #endif
00307 #endif

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