- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

# /home/coin/svn-release/Alps-1.4.8/Cgl/src/CglResidualCapacity/CglResidualCapacity.hpp

Go to the documentation of this file.

    00001 // LAST EDIT:
    00002 //-----------------------------------------------------------------------------
    00003 // Implementation of Residual Capacity Inequalities
    00004 // Francisco Barahona (barahon@us.ibm.com)
    00005 //
    00006 // date: May 18, 2006
    00007 //-----------------------------------------------------------------------------
    00008 // Copyright (C) 2004, International Business Machines Corporation and others.
    00009 // All Rights Reserved.
    00010 // This code is published under the Eclipse Public License.
    00011
    00012 #ifndef CglResidualCapacity_H
    00013 #define CglResidualCapacity_H
    00014
    00015 #include <iostream>
    00016 #include <fstream>
    00017 //#include <vector>
    00018
    00019 #include "CoinError.hpp"
    00020
    00021 #include "CglCutGenerator.hpp"
    00022
    00023 //=============================================================================
    00024
    00025 #ifndef CGL_DEBUG
    00026 #define CGL_DEBUG 0
    00027 #endif
    00028
    00029 //=============================================================================
    00030
    00031
    00032
    00033
    00034 //=============================================================================
    00035
    00047 class CglResidualCapacity : public CglCutGenerator {
    00048
    00049     friend void CglResidualCapacityUnitTest(const OsiSolverInterface * siP,
    00050                                             const std::string mpdDir );
    00051
    00052
    00053 private:
    00054     //---------------------------------------------------------------------------
    00055     // Enumeration constants that describe the various types of rows
    00056     enum RowType {
    00060         ROW_L,
    00064         ROW_G,
    00067         ROW_BOTH,
    00070         ROW_OTHER
    00071     };
    00072
    00073
    00074 public:
    00077
    00078     void setEpsilon(double value);
    00080     double getEpsilon() const;
    00082     void setTolerance(double value);
    00084     double getTolerance() const;
    00086     void setDoPreproc(int value);
    00088     bool getDoPreproc() const;
    00090
    00097     virtual void generateCuts(const OsiSolverInterface & si, OsiCuts & cs,
    00098                               const CglTreeInfo info = CglTreeInfo());
    00100
    00101     //---------------------------------------------------------------------------
    00104
    00105     CglResidualCapacity ();
    00106
    00108     CglResidualCapacity ( const double tolerance );
    00109
    00111     CglResidualCapacity (
    00112                          const CglResidualCapacity &);
    00113
    00115     virtual CglCutGenerator * clone() const;
    00116
    00118     CglResidualCapacity &
    00119     operator=(
    00120               const CglResidualCapacity& rhs);
    00121
    00123     virtual
    00124     ~CglResidualCapacity ();
    00126     virtual void refreshPrep();
    00128
    00129
    00130
    00131 private:
    00132     //--------------------------------------------------------------------------
    00133     // Private member methods
    00134
    00135     // Construct
    00136     void gutsOfConstruct ( const double tolerance);
    00137
    00138     // Delete
    00139     void gutsOfDelete();
    00140
    00141     // Copy
    00142     void gutsOfCopy (const CglResidualCapacity& rhs);
    00143
    00144     // Do preprocessing.
    00145     // It determines the type of each row.
    00146     // It may change sense and RHS for ranged rows
    00147     void resCapPreprocess(const OsiSolverInterface& si);
    00148
    00149     // Determine the type of a given row.
    00150     RowType determineRowType(const OsiSolverInterface& si,
    00151                              const int rowLen, const int* ind,
    00152                              const double* coef, const char sense,
    00153                              const double rhs,
    00154                              const double* colLowerBound,
    00155                              const double* colUpperBound) const;
    00156     // helps the function above
    00157     bool treatAsLessThan(const OsiSolverInterface& si,
    00158                          const int rowLen, const int* ind,
    00159                          const double* coef,
    00160                          const double rhs,
    00161                          const double* colLowerBound,
    00162                          const double* colUpperBound) const;
    00163
    00164     // Generate Residual Capacity cuts
    00165     void generateResCapCuts( const OsiSolverInterface& si,
    00166                              const double* xlp,
    00167                              const double* colUpperBound,
    00168                              const double* colLowerBound,
    00169                              const CoinPackedMatrix& matrixByRow,
    00170                              const double* LHS,
    00171                              const double* coefByRow,
    00172                              const int* colInds,
    00173                              const int* rowStarts,
    00174                              const int* rowLengths,
    00175                              OsiCuts& cs ) const;
    00176
    00177
    00178     // Residual Capacity separation
    00179     bool resCapSeparation(const OsiSolverInterface& si,
    00180                           const int rowLen, const int* ind,
    00181                           const double* coef,
    00182                           const double rhs,
    00183                           const double *xlp,
    00184                           const double* colUpperBound,
    00185                           const double* colLowerBound,
    00186                           OsiRowCut& resCapCut) const;
    00187
    00188
    00189
    00190 private:
    00191     //---------------------------------------------------------------------------
    00192     // Private member data
    00194     double EPSILON_;
    00197     double TOLERANCE_;
    00205     int doPreproc_;
    00206     // The number of rows of the problem.
    00207     int numRows_;
    00208     // The number columns of the problem.
    00209     int numCols_;
    00210     // Indicates whether preprocessing has been done.
    00211     bool doneInitPre_;
    00212     // Array with the row types of the rows in the model.
    00213     RowType* rowTypes_;
    00214     // The indices of the rows of the initial matrix
    00215     int* indRows_;
    00216     // Sense of rows (modified if ranges)
    00217     char * sense_;
    00218     // RHS of rows (modified if ranges)
    00219     double * RHS_;
    00220     // The number of rows of type ROW_L
    00221     int numRowL_;
    00222     // The indices of the rows of type ROW_L
    00223     int* indRowL_;
    00224     // The number of rows of type ROW_G
    00225     int numRowG_;
    00226     // The indices of the rows of type ROW_G
    00227     int* indRowG_;
    00228 };
    00229
    00230 //#############################################################################
    00236 void CglResidualCapacityUnitTest(const OsiSolverInterface * siP,
    00237                                  const std::string mpdDir);
    00238
    00239
    00240 #endif