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());
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
00127
00128 const double * relaxedRowLower() const;
00130 const double * relaxedRowUpper() const;
00132
00135
00136 void setMode(int mode);
00138 int getMode() const;
00140
00143
00144 void setMaxPass(int value);
00146 int getMaxPass() const;
00148 void setLogLevel(int value);
00150 int getLogLevel() const;
00152 void setMaxProbe(int value);
00154 int getMaxProbe() const;
00156 void setMaxLook(int value);
00158 int getMaxLook() const;
00160 void setMaxElements(int value);
00162 int getMaxElements() const;
00164 void setMaxPassRoot(int value);
00166 int getMaxPassRoot() const;
00168 void setMaxProbeRoot(int value);
00170 int getMaxProbeRoot() const;
00172 void setMaxLookRoot(int value);
00174 int getMaxLookRoot() const;
00176 void setMaxElementsRoot(int value);
00178 int getMaxElementsRoot() const;
00186 virtual bool mayGenerateRowCutsInTree() const;
00188
00191
00192
00193 void setRowCuts(int type);
00195 int rowCuts() const;
00197
00200
00201 void setUsingObjective(bool yesNo);
00203 int getUsingObjective() const;
00205
00208
00209 CglProbing ();
00210
00212 CglProbing (
00213 const CglProbing &);
00214
00216 virtual CglCutGenerator * clone() const;
00217
00219 CglProbing &
00220 operator=(
00221 const CglProbing& rhs);
00222
00224 virtual
00225 ~CglProbing ();
00226
00228 virtual void refreshSolver(OsiSolverInterface * solver);
00230 virtual std::string generateCpp( FILE * fp);
00232
00233 private:
00234
00235
00238
00239 int probe( const OsiSolverInterface & si,
00240 const OsiRowCutDebugger * debugger,
00241 OsiCuts & cs,
00242 double * colLower, double * colUpper, CoinPackedMatrix *rowCopy,
00243 double * rowLower, double * rowUpper,
00244 char * intVar, double * minR, double * maxR, int * markR,
00245 int * look, int nlook,
00246 const CglTreeInfo info) const;
00248 int probeCliques( const OsiSolverInterface & si,
00249 const OsiRowCutDebugger * debugger,
00250 OsiCuts & cs,
00251 double * colLower, double * colUpper, CoinPackedMatrix *rowCopy,
00252 double * rowLower, double * rowUpper,
00253 char * intVar, double * minR, double * maxR, int * markR,
00254 int * look, int nlook,
00255 const CglTreeInfo info) const;
00257 int probeSlacks( const OsiSolverInterface & si,
00258 const OsiRowCutDebugger * debugger,
00259 OsiCuts & cs,
00260 double * colLower, double * colUpper, CoinPackedMatrix *rowCopy,
00261 double * rowLower, double * rowUpper,
00262 char * intVar, double * minR, double * maxR,int * markR,
00263 const CglTreeInfo info) const;
00266 int gutsOfGenerateCuts( const OsiSolverInterface & si,
00267 OsiCuts & cs,
00268 double * rowLower, double * rowUpper,
00269 double * colLower, double * colUpper,
00270 const CglTreeInfo info) const;
00272 void setupRowCliqueInformation(const OsiSolverInterface & si);
00275 int tighten(double *colLower, double * colUpper,
00276 const int *column, const double *rowElements,
00277 const CoinBigIndex *rowStart, const int * rowLength,
00278 double *rowLower, double *rowUpper,
00279 int nRows,int nCols,char * intVar,int maxpass,
00280 double tolerance) const;
00282 void tighten2(double *colLower, double * colUpper,
00283 const int *column, const double *rowElements,
00284 const CoinBigIndex *rowStart, const int * rowLength,
00285 double *rowLower, double *rowUpper,
00286 double * minR, double * maxR, int * markR,
00287 int nRows,int nCols) const;
00289
00290
00291
00292 struct disaggregation_struct_tag ;
00293 friend struct CglProbing::disaggregation_struct_tag ;
00294
00297
00298 CoinPackedMatrix * rowCopy_;
00300 CoinPackedMatrix * columnCopy_;
00302 double * rowLower_;
00304 double * rowUpper_;
00306 double * colLower_;
00308 double * colUpper_;
00310 mutable int numberRows_;
00312 mutable int numberColumns_;
00314 double primalTolerance_;
00318 int mode_;
00323 mutable int rowCuts_;
00325 int maxPass_;
00327 int logLevel_;
00329 int maxProbe_;
00331 int maxStack_;
00333 int maxElements_;
00335 int maxPassRoot_;
00337 int maxProbeRoot_;
00339 int maxStackRoot_;
00341 int maxElementsRoot_;
00343 bool usingObjective_;
00345 int numberIntegers_;
00347 int number01Integers_;
00352 typedef struct {
00353 unsigned int zeroOne:1;
00354 unsigned int whenAtUB:1;
00355 unsigned int affectedToUB:1;
00356 unsigned int affected:29;
00357 } disaggregationAction;
00359 typedef struct disaggregation_struct_tag {
00360 int sequence;
00361
00362 int length;
00363 disaggregationAction * index;
00364 } disaggregation;
00365 disaggregation * cutVector_;
00368 int numberCliques_;
00370 typedef struct {
00371 unsigned int equality:1;
00372 } cliqueType;
00373 cliqueType * cliqueType_;
00375 int * cliqueStart_;
00377 typedef struct {
00378 unsigned int oneFixes:1;
00379 unsigned int sequence:31;
00380 } cliqueEntry;
00381 cliqueEntry * cliqueEntry_;
00384 int * oneFixStart_;
00387 int * zeroFixStart_;
00389 int * endFixStart_;
00391 int * whichClique_;
00396 cliqueEntry * cliqueRow_;
00398 int * cliqueRowStart_;
00400 };
00401
00402
00408 void CglProbingUnitTest(const OsiSolverInterface * siP,
00409 const std::string mpdDir );
00410
00411 #endif