00001
00002
00003 #ifndef CglGomory_H
00004 #define CglGomory_H
00005
00006 #include <string>
00007
00008 #include "CglCutGenerator.hpp"
00009
00010 class CoinWarmStartBasis;
00012 class CglGomory : public CglCutGenerator {
00013 friend void CglGomoryUnitTest(const OsiSolverInterface * siP,
00014 const std::string mpdDir );
00015
00016 public:
00017
00018
00032 virtual void generateCuts( const OsiSolverInterface & si, OsiCuts & cs,
00033 const CglTreeInfo info = CglTreeInfo()) const;
00036 int generateCuts( const OsiRowCutDebugger * debugger,
00037 OsiCuts & cs,
00038 const CoinPackedMatrix & columnCopy,
00039 const CoinPackedMatrix & rowCopy,
00040 const double * colsol,
00041 const double * colLower, const double * colUpper,
00042 const double * rowLower, const double * rowUpper,
00043 const char * intVar ,
00044 const CoinWarmStartBasis* warm,
00045 const CglTreeInfo info = CglTreeInfo()) const;
00048 int generateCuts( const OsiRowCutDebugger * debugger,
00049 OsiCuts & cs,
00050 const CoinPackedMatrix & columnCopy,
00051 const double * colsol,
00052 const double * colLower, const double * colUpper,
00053 const double * rowLower, const double * rowUpper,
00054 const char * intVar ,
00055 const CoinWarmStartBasis* warm,
00056 const CglTreeInfo info = CglTreeInfo()) const;
00057
00059 virtual bool needsOptimalBasis() const;
00061
00064
00065 void passInOriginalSolver(OsiSolverInterface * solver);
00067 inline OsiSolverInterface * originalSolver() const
00068 { return originalSolver_;}
00070 inline void setGomoryType(int type)
00071 { gomoryType_=type;}
00073 inline int gomoryType() const
00074 { return gomoryType_;}
00076
00079
00080 void setLimit(int limit);
00082 int getLimit() const;
00084 void setLimitAtRoot(int limit);
00086 int getLimitAtRoot() const;
00088 virtual int maximumLengthOfCutInTree() const;
00090
00095
00096 void setAway(double value);
00098 double getAway() const;
00100 void setAwayAtRoot(double value);
00102 double getAwayAtRoot() const;
00104
00114
00115 void setConditionNumberMultiplier(double value);
00117 double getConditionNumberMultiplier() const;
00119 void setLargestFactorMultiplier(double value);
00121 double getLargestFactorMultiplier() const;
00123
00126
00127 inline void useAlternativeFactorization(bool yes=true)
00128 { alternateFactorization_= (yes) ? 1 : 0;}
00130 inline bool alternativeFactorization() const
00131 { return (alternateFactorization_!=0);}
00133
00136
00137 CglGomory ();
00138
00140 CglGomory (
00141 const CglGomory &);
00142
00144 virtual CglCutGenerator * clone() const;
00145
00147 CglGomory &
00148 operator=(
00149 const CglGomory& rhs);
00150
00152 virtual
00153 ~CglGomory ();
00155 virtual std::string generateCpp( FILE * fp);
00157
00158 private:
00159
00160
00161
00162
00163
00166
00167 double away_;
00169 double awayAtRoot_;
00171 double conditionNumberMultiplier_;
00173 double largestFactorMultiplier_;
00175 mutable OsiSolverInterface * originalSolver_;
00177 int limit_;
00179 int limitAtRoot_;
00181 mutable int dynamicLimitInTree_;
00183 mutable int numberTimesStalled_;
00185 int alternateFactorization_;
00187 int gomoryType_;
00189 };
00190
00191
00197 void CglGomoryUnitTest(const OsiSolverInterface * siP,
00198 const std::string mpdDir );
00199
00200 #endif