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 double * rowLower, double * rowUpper,
00267 char * intVar, double * minR, double * maxR, int * markR,
00268 CglTreeInfo * info) const;
00270 int probeCliques( const OsiSolverInterface & si,
00271 const OsiRowCutDebugger * debugger,
00272 OsiCuts & cs,
00273 double * colLower, double * colUpper, CoinPackedMatrix *rowCopy,
00274 double * rowLower, double * rowUpper,
00275 char * intVar, double * minR, double * maxR, int * markR,
00276 CglTreeInfo * info) const;
00278 int probeSlacks( const OsiSolverInterface & si,
00279 const OsiRowCutDebugger * debugger,
00280 OsiCuts & cs,
00281 double * colLower, double * colUpper, CoinPackedMatrix *rowCopy,
00282 double * rowLower, double * rowUpper,
00283 char * intVar, double * minR, double * maxR,int * markR,
00284 CglTreeInfo * info) const;
00287 int gutsOfGenerateCuts( const OsiSolverInterface & si,
00288 OsiCuts & cs,
00289 double * rowLower, double * rowUpper,
00290 double * colLower, double * colUpper,
00291 CglTreeInfo * info) const;
00293 void setupRowCliqueInformation(const OsiSolverInterface & si);
00296 int tighten(double *colLower, double * colUpper,
00297 const int *column, const double *rowElements,
00298 const CoinBigIndex *rowStart, const int * rowLength,
00299 double *rowLower, double *rowUpper,
00300 int nRows,int nCols,char * intVar,int maxpass,
00301 double tolerance) const;
00303 void tighten2(double *colLower, double * colUpper,
00304 const int *column, const double *rowElements,
00305 const CoinBigIndex *rowStart, const int * rowLength,
00306 double *rowLower, double *rowUpper,
00307 double * minR, double * maxR, int * markR,
00308 int nRows,int nCols) const;
00310
00311
00312
00313 struct disaggregation_struct_tag ;
00314 friend struct CglProbing::disaggregation_struct_tag ;
00315
00318
00319 CoinPackedMatrix * rowCopy_;
00321 CoinPackedMatrix * columnCopy_;
00323 double * rowLower_;
00325 double * rowUpper_;
00327 double * colLower_;
00329 double * colUpper_;
00331 mutable int numberRows_;
00333 mutable int numberColumns_;
00335 double primalTolerance_;
00339 int mode_;
00344 mutable int rowCuts_;
00346 int maxPass_;
00348 int logLevel_;
00350 int maxProbe_;
00352 int maxStack_;
00354 int maxElements_;
00356 int maxPassRoot_;
00358 int maxProbeRoot_;
00360 int maxStackRoot_;
00362 int maxElementsRoot_;
00364 int usingObjective_;
00366 int numberIntegers_;
00368 int number01Integers_;
00370 mutable int numberThisTime_;
00372 mutable int * lookedAt_;
00377 typedef struct {
00378 unsigned int zeroOne:1;
00379 unsigned int whenAtUB:1;
00380 unsigned int affectedToUB:1;
00381 unsigned int affected:29;
00382 } disaggregationAction;
00384 typedef struct disaggregation_struct_tag {
00385 int sequence;
00386
00387 int length;
00388 disaggregationAction * index;
00389 } disaggregation;
00390 disaggregation * cutVector_;
00393 int numberCliques_;
00395 typedef struct {
00396 unsigned int equality:1;
00397 } cliqueType;
00398 cliqueType * cliqueType_;
00400 int * cliqueStart_;
00402 typedef struct {
00403 unsigned int oneFixes:1;
00404 unsigned int sequence:31;
00405 } cliqueEntry;
00406 cliqueEntry * cliqueEntry_;
00409 int * oneFixStart_;
00412 int * zeroFixStart_;
00414 int * endFixStart_;
00416 int * whichClique_;
00421 cliqueEntry * cliqueRow_;
00423 int * cliqueRowStart_;
00425 char * tightenBounds_;
00427 };
00428
00429
00435 void CglProbingUnitTest(const OsiSolverInterface * siP,
00436 const std::string mpdDir );
00437
00438 #endif