/home/coin/SVN-release/CoinAll-1.1.0/SYMPHONY/include/sym_lp_solver.h

Go to the documentation of this file.
00001 /*===========================================================================*/
00002 /*                                                                           */
00003 /* This file is part of the SYMPHONY MILP Solver Framework.                  */
00004 /*                                                                           */
00005 /* SYMPHONY was jointly developed by Ted Ralphs (tkralphs@lehigh.edu) and    */
00006 /* Laci Ladanyi (ladanyi@us.ibm.com).                                        */
00007 /*                                                                           */
00008 /* (c) Copyright 2000-2008 Ted Ralphs. All Rights Reserved.                  */
00009 /*                                                                           */
00010 /* This software is licensed under the Common Public License. Please see     */
00011 /* accompanying file for terms.                                              */
00012 /*                                                                           */
00013 /*===========================================================================*/
00014 
00015 #ifndef _LPSOLVER_H
00016 #define _LPSOLVER_H
00017 
00018 #include "sym_proto.h"
00019 #include "sym_types.h"
00020 #include "sym_lp_params.h"
00021 
00022 #define LP_MAX_ITER 9999999
00023 
00024 #ifdef __CPLEX__
00025 
00026 /*****************************************************************************/
00027 /*******              here are the definitions for CPLEX               *******/
00028 /*****************************************************************************/
00029 
00030 #include <cplex.h>
00031 
00032 void CPX_check_error PROTO((const char *erring_func));
00033 
00034 #elif defined(__OSL__)
00035 
00036 /*****************************************************************************/
00037 /*******              here are the definitions for OSL                 *******/
00038 /*****************************************************************************/
00039 
00040 #include <ekk_c_api.h>
00041 
00042 void OSL_check_error PROTO((const char *erring_func));
00043 
00044 #elif defined(__OSI_CPLEX__) || defined(__OSI_OSL__) || defined(__OSI_CLP__) \
00045 || defined(__OSI_XPRESS__) || defined(__OSI_SOPLEX__) || defined(__OSI_VOL__) \
00046 || defined(__OSI_DYLP__) || defined (__OSI_GLPK__)
00047 
00048 /*****************************************************************************/
00049 /*******              here are the definitions for OSI                 *******/
00050 /*****************************************************************************/
00051 
00052 #include "OsiSolverInterface.hpp"
00053 #include "CoinHelperFunctions.hpp"
00054 #include "CoinPackedVector.hpp"
00055 #include "CoinMpsIO.hpp"
00056 #include "CoinLpIO.hpp"
00057 
00058 #ifdef USE_CGL_CUTS
00059 #include "OsiCuts.hpp"
00060 #include "CglCutGenerator.hpp"
00061 #include "CglLiftAndProject.hpp"
00062 #include "CglSimpleRounding.hpp"
00063 #include "CglMixedIntegerRounding.hpp"
00064 #include "CglClique.hpp"
00065 #include "CglGomory.hpp"
00066 #include "CglOddHole.hpp"
00067 #include "CglKnapsackCover.hpp"
00068 #include "CglProbing.hpp"
00069 #include "CglFlowCover.hpp"
00070 #include "CglTwomir.hpp"
00071 #include "CglLandP.hpp"
00072 #include "CglRedSplit.hpp"
00073 #endif
00074 
00075 #ifdef __OSI_CPLEX__
00076 #include "OsiCpxSolverInterface.hpp"
00077 typedef OsiCpxSolverInterface OsiXSolverInterface;
00078 #endif
00079 
00080 #ifdef __OSI_OSL__
00081 #include "OsiOslSolverInterface.hpp"
00082 typedef OsiOslSolverInterface OsiXSolverInterface;
00083 #endif
00084 
00085 #ifdef __OSI_CLP__
00086 #include "OsiClpSolverInterface.hpp"
00087 typedef OsiClpSolverInterface OsiXSolverInterface;
00088 #endif
00089 
00090 #ifdef __OSI_XPRESS__
00091 #include "OsiXprSolverInterface.hpp"
00092 typedef OsiXprSolverInterface OsiXSolverInterface;
00093 #endif
00094 
00095 #ifdef __OSI_SOPLEX__
00096 #include "OsiSpxSolverInterface.hpp"
00097 typedef OsiSpxSolverInterface OsiXSolverInterface;
00098 #endif
00099 
00100 #ifdef __OSI_VOL__
00101 #include "OsiVolSolverInterface.hpp"
00102 typedef OsiVolSolverInterface OsiXSolverInterface;
00103 #endif
00104 
00105 #ifdef __OSI_DYLP__
00106 #include "OsiDylpSolverInterface.hpp"
00107 typedef OsiDylpSolverInterface OsiXSolverInterface;
00108 #endif
00109 
00110 #ifdef __OSI_GLPK__
00111 #include "OsiGlpkSolverInterface.hpp"
00112 typedef OsiGlpkSolverInterface OsiXSolverInterface;
00113 #endif
00114 
00115 #else
00116 
00117 #error ###################################
00118 #error # Undefined or unknown LP solver.
00119 #error # Please edit SYMPHONY/Makefile
00120 #error # and define LP_SOLVER properly.
00121 #error ###################################
00122 
00123 #endif 
00124 
00125 /*****************************************************************************/
00126 /*******                  end LP solver definitions                    *******/
00127 /*****************************************************************************/
00128 
00129 #ifdef USE_GLPMPL
00130 extern "C"
00131 {
00132    #include "glpmpl.h"
00133 }
00134 #endif
00135 
00136 /* Temporary storage */
00137 
00138 typedef struct TEMPORARY{
00139    char      *c;           /* max(2m,n) */
00140    int       *i1;          /* 3m+2n */
00141    int       *i2;          /* m */
00142    double    *d;           /* max(2m,2n) */
00143    void     **p1;          /* m */
00144    void     **p2;          /* m */
00145 
00146    char      *cv;          /* variable */
00147    int        cv_size;
00148    int       *iv;          /* variable (>= */
00149    int        iv_size;
00150    double    *dv;          /* variable */
00151    int        dv_size;
00152 }temporary;
00153 
00154 /* The LP solver data */
00155 
00156 typedef struct LPDATA{
00157    /* First, the problem pointers */
00158 #ifdef __CPLEX__
00159    CPXENVptr  cpxenv;
00160    CPXLPptr   lp;
00161 #endif
00162 #ifdef __OSL__
00163    EKKContext *env;
00164    EKKModel   *lp;
00165 #endif
00166 #if defined(__OSI_CPLEX__) || defined(__OSI_OSL__) || defined(__OSI_CLP__) \
00167 || defined(__OSI_XPRESS__) || defined(__OSI_SOPLEX__) || defined(__OSI_VOL__) \
00168 || defined(__OSI_DYLP__) || defined (__OSI_GLPK__)
00169    OsiXSolverInterface * si;
00170 #endif
00171    double     lpetol;
00172    char       lp_is_modified;
00173    char       col_set_changed;
00174    double     objval;
00175    int        termcode;
00176    MIPdesc   *mip;
00177    int        n;           /* number of columns without slacks */
00178    int        maxn;
00179    int        m;           /* number of rows */
00180    int        maxm;
00181    int        nz;          /* number of nonzeros */
00182    int        maxnz;       /* space is allocated for this many nonzeros */
00183 
00184    char       ordering;    /* COLIND_AND_USERIND_ORDERED, COLIND_ORDERED or
00185                               USERIND_ORDERED */
00186    var_desc **vars;        /* maxn */ /* BB */
00187 
00188    int        not_fixed_num;
00189    int       *not_fixed;
00190    int        nf_status;
00191 
00192    char      *status;      /* maxn */ /* BB */
00193    double    *x;           /* maxn */ /* BB */
00194    double    *dj;          /* maxn */ /* BB */
00195    double    *dualsol;     /* maxm */ /* BB */
00196    double    *slacks;      /* maxm */
00197    double    *ub;
00198    double    *lb;
00199    
00200    row_data  *rows;      /* maxm */
00201 
00202    temporary  tmp;
00203 #ifdef PSEUDO_COSTS
00204    double     *pseudo_costs_one;
00205    double     *pseudo_costs_zero;
00206 #endif
00207    int         lp_count;
00208    cgl_params  cgl;
00209 
00210 }LPdata;
00211 
00212 /*****************************************************************************/
00213 /*******                    common definitions                         *******/
00214 /*****************************************************************************/
00215 
00216 double dot_product PROTO((double *val, int *ind, int collen, double *col));
00217 void free_lp_arrays PROTO((LPdata *lp_data));
00218 void free_mip_desc PROTO((MIPdesc *mip));
00219 void size_lp_arrays PROTO((LPdata *lp_data, char do_realloc, char set_max,
00220                              int row_num, int col_num, int nzcnt));
00221 void open_lp_solver PROTO((LPdata *lp_data));
00222 void close_lp_solver PROTO((LPdata *lp_data));
00223 void load_lp_prob PROTO((LPdata *lp_data, int scaling, int fastmip));
00224 void unload_lp_prob PROTO((LPdata *lp_data));
00225 void load_basis PROTO((LPdata *lp_data, int *cstat, int *rstat));
00226 void refactorize PROTO((LPdata *lp_data));
00227 void add_rows PROTO((LPdata *lp_data, int rcnt, int nzcnt, double *rhs,
00228                      char *sense, int *rmatbeg, int *rmatind,double *rmatval));
00229 void add_cols PROTO((LPdata *lp_data, int ccnt, int nzcnt, double *obj,
00230                      int *cmatbeg, int *cmatind, double *cmatval,
00231                      double *lb, double *ub, char *where_to_move));
00232 void change_row PROTO((LPdata *lp_data, int row_ind,
00233                        char sense, double rhs, double range));
00234 void change_col PROTO((LPdata *lp_data, int col_ind,
00235                        char sense, double lb, double ub));
00236 int dual_simplex PROTO((LPdata *lp_data, int *iterd));
00237 int solve_hotstart PROTO((LPdata *lp_data, int *iterd));
00238 int mark_hotstart PROTO((LPdata *lp_data));
00239 int unmark_hotstart PROTO((LPdata *lp_data));
00240 void btran PROTO((LPdata *lp_data, double *col));
00241 void get_binvcol PROTO((LPdata *lp_data, int j, double *col));
00242 void get_binvrow PROTO((LPdata *lp_data, int i, double *row));
00243 void get_basis PROTO((LPdata *lp_data, int *cstat, int *rstat));
00244 void set_obj_upper_lim PROTO((LPdata *lp_data, double lim));
00245 void set_itlim PROTO((LPdata *lp_data, int itlim));
00246 void set_itlim_hotstart PROTO((LPdata *lp_data, int itlim));
00247 void get_column PROTO((LPdata *lp_data, int j,
00248                        double *colval, int *colind, int *collen, double *cj));
00249 void get_row PROTO((LPdata *lp_data, int i,
00250                     double *rowval, int *rowind, int *rowlen,
00251                     double *rowub, double *rowlb));
00252 int get_proof_of_infeas PROTO((LPdata *lp_data, int *infind));
00253 void get_x PROTO((LPdata *lp_data));
00254 void get_dj_pi PROTO((LPdata *lp_data));
00255 void get_slacks PROTO((LPdata *lp_data));
00256 void change_range PROTO((LPdata *lp_data, int rowind, double value));
00257 void change_rhs PROTO((LPdata *lp_data,
00258                        int rownum, int *rhsind, double *rhsval));
00259 void change_sense PROTO((LPdata *lp_data, int cnt, int *index, char *sense));
00260 void change_bounds PROTO((LPdata *lp_data,
00261                           int cnt, int *index, char *lu, double *bd));
00262 void change_lbub PROTO((LPdata *lp_data, int j, double lb, double ub));
00263 void change_ub PROTO((LPdata *lp_data, int j, double ub));
00264 void change_lb PROTO((LPdata *lp_data, int j, double lb));
00265 void get_ub PROTO((LPdata *lp_data, int j, double *ub));
00266 void get_lb PROTO((LPdata *lp_data, int j, double *lb));
00267 void get_bounds PROTO((LPdata *lp_data));
00268 void get_objcoef PROTO((LPdata *lp_data, int j, double *objcoef));
00269 void delete_rows PROTO((LPdata *lp_data, int deletable, int *free_rows));
00270 int delete_cols PROTO((LPdata *lp_data, int delnum, int *delstat));
00271 void release_var PROTO((LPdata *lp_data, int j, int where_to_move));
00272 void free_row_set PROTO((LPdata *lp_data, int length, int *index));
00273 void constrain_row_set PROTO((LPdata *lp_data, int length, int *index));
00274 int read_mps PROTO((MIPdesc *mip, char *infile, char *probname));
00275 int read_lp PROTO((MIPdesc *mip, char *infile, char *probname));
00276 void write_mps PROTO((LPdata *lp_data, char *fname));
00277 void write_mip_desc_mps PROTO((MIPdesc *mip, char *fname));
00278 void write_mip_desc_lp PROTO((MIPdesc *mip, char *fname));
00279 void write_sav PROTO((LPdata *lp_data, char *fname));
00280 #ifdef USE_CGL_CUTS
00281 void generate_cgl_cuts PROTO((LPdata * lp_data, int *num_cuts,
00282                               cut_data ***cuts, char send_to_pool,
00283                               int is_rootnode, int verbosity));
00284 #endif
00285 #ifdef USE_GLPMPL
00286 int read_gmpl PROTO((MIPdesc *mip, char *modelfile, char *datafile,
00287                      char *probname));
00288 #endif
00289 #endif

Generated on Sun Nov 14 14:06:42 2010 for Coin-All by  doxygen 1.4.7