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 const CglTreeInfo info = CglTreeInfo());
00089 int generateCutsAndModify(const OsiSolverInterface & si,
00090 OsiCuts & cs,
00091 CglTreeInfo * info2);
00093
00104 int snapshot ( const OsiSolverInterface & si,
00105 char * possible=NULL,
00106 bool withObjective=true);
00108 void deleteSnapshot ( );
00114 int createCliques( OsiSolverInterface & si,
00115 int minimumSize=2, int maximumSize=100, bool extendCliques=false);
00117 void deleteCliques();
00119
00122
00123 const double * tightLower() const;
00125 const double * tightUpper() const;
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
00196 void setRowCuts(int type);
00198 int rowCuts() const;
00200
00203
00204 void setUsingObjective(bool yesNo);
00206 int getUsingObjective() const;
00208
00211
00212 CglProbing ();
00213
00215 CglProbing (
00216 const CglProbing &);
00217
00219 virtual CglCutGenerator * clone() const;
00220
00222 CglProbing &
00223 operator=(
00224 const CglProbing& rhs);
00225
00227 virtual
00228 ~CglProbing ();
00229
00231 virtual void refreshSolver(OsiSolverInterface * solver);
00233 virtual std::string generateCpp( FILE * fp);
00235
00236 private:
00237
00238
00241
00242 int probe( const OsiSolverInterface & si,
00243 const OsiRowCutDebugger * debugger,
00244 OsiCuts & cs,
00245 double * colLower, double * colUpper, CoinPackedMatrix *rowCopy,
00246 double * rowLower, double * rowUpper,
00247 char * intVar, double * minR, double * maxR, int * markR,
00248 int * look, int nlook,
00249 const CglTreeInfo info) const;
00251 int probeCliques( const OsiSolverInterface & si,
00252 const OsiRowCutDebugger * debugger,
00253 OsiCuts & cs,
00254 double * colLower, double * colUpper, CoinPackedMatrix *rowCopy,
00255 double * rowLower, double * rowUpper,
00256 char * intVar, double * minR, double * maxR, int * markR,
00257 int * look, int nlook,
00258 const CglTreeInfo info) const;
00260 int probeSlacks( const OsiSolverInterface & si,
00261 const OsiRowCutDebugger * debugger,
00262 OsiCuts & cs,
00263 double * colLower, double * colUpper, CoinPackedMatrix *rowCopy,
00264 double * rowLower, double * rowUpper,
00265 char * intVar, double * minR, double * maxR,int * markR,
00266 const CglTreeInfo info) const;
00269 int gutsOfGenerateCuts( const OsiSolverInterface & si,
00270 OsiCuts & cs,
00271 double * rowLower, double * rowUpper,
00272 double * colLower, double * colUpper,
00273 const CglTreeInfo info) const;
00275 void setupRowCliqueInformation(const OsiSolverInterface & si);
00278 int tighten(double *colLower, double * colUpper,
00279 const int *column, const double *rowElements,
00280 const CoinBigIndex *rowStart, const int * rowLength,
00281 double *rowLower, double *rowUpper,
00282 int nRows,int nCols,char * intVar,int maxpass,
00283 double tolerance) const;
00285 void tighten2(double *colLower, double * colUpper,
00286 const int *column, const double *rowElements,
00287 const CoinBigIndex *rowStart, const int * rowLength,
00288 double *rowLower, double *rowUpper,
00289 double * minR, double * maxR, int * markR,
00290 int nRows,int nCols) const;
00292
00293
00294
00295 struct disaggregation_struct_tag ;
00296 friend struct CglProbing::disaggregation_struct_tag ;
00297
00300
00301 CoinPackedMatrix * rowCopy_;
00303 CoinPackedMatrix * columnCopy_;
00305 double * rowLower_;
00307 double * rowUpper_;
00309 double * colLower_;
00311 double * colUpper_;
00313 mutable int numberRows_;
00315 mutable int numberColumns_;
00317 double primalTolerance_;
00321 int mode_;
00326 mutable int rowCuts_;
00328 int maxPass_;
00330 int logLevel_;
00332 int maxProbe_;
00334 int maxStack_;
00336 int maxElements_;
00338 int maxPassRoot_;
00340 int maxProbeRoot_;
00342 int maxStackRoot_;
00344 int maxElementsRoot_;
00346 bool usingObjective_;
00348 int numberIntegers_;
00350 int number01Integers_;
00355 typedef struct {
00356 unsigned int zeroOne:1;
00357 unsigned int whenAtUB:1;
00358 unsigned int affectedToUB:1;
00359 unsigned int affected:29;
00360 } disaggregationAction;
00362 typedef struct disaggregation_struct_tag {
00363 int sequence;
00364
00365 int length;
00366 disaggregationAction * index;
00367 } disaggregation;
00368 disaggregation * cutVector_;
00371 int numberCliques_;
00373 typedef struct {
00374 unsigned int equality:1;
00375 } cliqueType;
00376 cliqueType * cliqueType_;
00378 int * cliqueStart_;
00380 typedef struct {
00381 unsigned int oneFixes:1;
00382 unsigned int sequence:31;
00383 } cliqueEntry;
00384 cliqueEntry * cliqueEntry_;
00387 int * oneFixStart_;
00390 int * zeroFixStart_;
00392 int * endFixStart_;
00394 int * whichClique_;
00399 cliqueEntry * cliqueRow_;
00401 int * cliqueRowStart_;
00403 };
00404
00405
00411 void CglProbingUnitTest(const OsiSolverInterface * siP,
00412 const std::string mpdDir );
00413
00414 #endif