00001
00002
00003 #ifndef CglProbing_H
00004 #define CglProbing_H
00005
00006 #include <string>
00007
00008 #include "CglCutGenerator.hpp"
00009
00011 class CglProbing : public CglCutGenerator {
00012 friend void CglProbingUnitTest(const OsiSolverInterface * siP,
00013 const std::string mpdDir );
00014
00015 public:
00016
00017
00085 virtual void generateCuts( const OsiSolverInterface & si, OsiCuts & cs,
00086 const CglTreeInfo info = CglTreeInfo()) const;
00087 int generateCutsAndModify( const OsiSolverInterface & si, OsiCuts & cs,
00088 CglTreeInfo * info);
00090
00101 int snapshot ( const OsiSolverInterface & si,
00102 char * possible=NULL,
00103 bool withObjective=true);
00105 void deleteSnapshot ( );
00111 int createCliques( OsiSolverInterface & si,
00112 int minimumSize=2, int maximumSize=100, bool extendCliques=false);
00114 void deleteCliques();
00116
00119
00120 const double * tightLower() const;
00122 const double * tightUpper() const;
00124 const char * tightenBounds() const
00125 { return tightenBounds_;}
00127
00130
00131 const double * relaxedRowLower() const;
00133 const double * relaxedRowUpper() const;
00135
00138
00139 void setMode(int mode);
00141 int getMode() const;
00143
00146
00147 void setMaxPass(int value);
00149 int getMaxPass() const;
00151 void setLogLevel(int value);
00153 int getLogLevel() const;
00155 void setMaxProbe(int value);
00157 int getMaxProbe() const;
00159 void setMaxLook(int value);
00161 int getMaxLook() const;
00163 void setMaxElements(int value);
00165 int getMaxElements() const;
00167 void setMaxPassRoot(int value);
00169 int getMaxPassRoot() const;
00171 void setMaxProbeRoot(int value);
00173 int getMaxProbeRoot() const;
00175 void setMaxLookRoot(int value);
00177 int getMaxLookRoot() const;
00179 void setMaxElementsRoot(int value);
00181 int getMaxElementsRoot() const;
00189 virtual bool mayGenerateRowCutsInTree() const;
00191
00194
00195 inline int numberThisTime() const
00196 { return numberThisTime_;}
00198 inline const int * lookedAt() const
00199 { return lookedAt_;}
00201
00204
00205
00206 void setRowCuts(int type);
00208 int rowCuts() const;
00210
00218 void setUsingObjective(int yesNo);
00220 int getUsingObjective() const;
00222
00225
00226 void tightenThese(const OsiSolverInterface & solver, int number, const int * which);
00228
00231
00232 CglProbing ();
00233
00235 CglProbing (
00236 const CglProbing &);
00237
00239 virtual CglCutGenerator * clone() const;
00240
00242 CglProbing &
00243 operator=(
00244 const CglProbing& rhs);
00245
00247 virtual
00248 ~CglProbing ();
00249
00251 virtual void refreshSolver(OsiSolverInterface * solver);
00253 virtual std::string generateCpp( FILE * fp);
00255
00256 private:
00257
00258
00261
00262 int probe( const OsiSolverInterface & si,
00263 const OsiRowCutDebugger * debugger,
00264 OsiCuts & cs,
00265 double * colLower, double * colUpper, CoinPackedMatrix *rowCopy,
00266 CoinPackedMatrix *columnCopy,
00267 double * rowLower, double * rowUpper,
00268 char * intVar, double * minR, double * maxR, int * markR,
00269 CglTreeInfo * info) const;
00271 int probeCliques( const OsiSolverInterface & si,
00272 const OsiRowCutDebugger * debugger,
00273 OsiCuts & cs,
00274 double * colLower, double * colUpper, CoinPackedMatrix *rowCopy,
00275 CoinPackedMatrix *columnCopy,
00276 double * rowLower, double * rowUpper,
00277 char * intVar, double * minR, double * maxR, int * markR,
00278 CglTreeInfo * info) const;
00280 int probeSlacks( const OsiSolverInterface & si,
00281 const OsiRowCutDebugger * debugger,
00282 OsiCuts & cs,
00283 double * colLower, double * colUpper, CoinPackedMatrix *rowCopy,
00284 CoinPackedMatrix *columnCopy,
00285 double * rowLower, double * rowUpper,
00286 char * intVar, double * minR, double * maxR,int * markR,
00287 CglTreeInfo * info) const;
00290 int gutsOfGenerateCuts( const OsiSolverInterface & si,
00291 OsiCuts & cs,
00292 double * rowLower, double * rowUpper,
00293 double * colLower, double * colUpper,
00294 CglTreeInfo * info) const;
00296 void setupRowCliqueInformation(const OsiSolverInterface & si);
00299 int tighten(double *colLower, double * colUpper,
00300 const int *column, const double *rowElements,
00301 const CoinBigIndex *rowStart, const int * rowLength,
00302 double *rowLower, double *rowUpper,
00303 int nRows,int nCols,char * intVar,int maxpass,
00304 double tolerance) const;
00306 void tighten2(double *colLower, double * colUpper,
00307 const int *column, const double *rowElements,
00308 const CoinBigIndex *rowStart, const int * rowLength,
00309 double *rowLower, double *rowUpper,
00310 double * minR, double * maxR, int * markR,
00311 int nRows,int nCols) const;
00313
00314
00315
00316 struct disaggregation_struct_tag ;
00317 friend struct CglProbing::disaggregation_struct_tag ;
00318
00321
00322 CoinPackedMatrix * rowCopy_;
00324 CoinPackedMatrix * columnCopy_;
00326 double * rowLower_;
00328 double * rowUpper_;
00330 double * colLower_;
00332 double * colUpper_;
00334 mutable int numberRows_;
00336 mutable int numberColumns_;
00338 double primalTolerance_;
00342 int mode_;
00347 mutable int rowCuts_;
00349 int maxPass_;
00351 int logLevel_;
00353 int maxProbe_;
00355 int maxStack_;
00357 int maxElements_;
00359 int maxPassRoot_;
00361 int maxProbeRoot_;
00363 int maxStackRoot_;
00365 int maxElementsRoot_;
00367 int usingObjective_;
00369 int numberIntegers_;
00371 int number01Integers_;
00373 mutable int numberThisTime_;
00375 mutable int * lookedAt_;
00380 typedef struct {
00381 unsigned int zeroOne:1;
00382 unsigned int whenAtUB:1;
00383 unsigned int affectedToUB:1;
00384 unsigned int affected:29;
00385 } disaggregationAction;
00387 typedef struct disaggregation_struct_tag {
00388 int sequence;
00389
00390 int length;
00391 disaggregationAction * index;
00392 } disaggregation;
00393 disaggregation * cutVector_;
00396 int numberCliques_;
00398 typedef struct {
00399 unsigned int equality:1;
00400 } cliqueType;
00401 cliqueType * cliqueType_;
00403 int * cliqueStart_;
00405 typedef struct {
00406 unsigned int oneFixes:1;
00407 unsigned int sequence:31;
00408 } cliqueEntry;
00409 cliqueEntry * cliqueEntry_;
00412 int * oneFixStart_;
00415 int * zeroFixStart_;
00417 int * endFixStart_;
00419 int * whichClique_;
00424 cliqueEntry * cliqueRow_;
00426 int * cliqueRowStart_;
00428 char * tightenBounds_;
00430 };
00431
00432
00438 void CglProbingUnitTest(const OsiSolverInterface * siP,
00439 const std::string mpdDir );
00440
00441 #endif