00001
00002
00003
00004
00005 #ifndef CglGomory_H
00006 #define CglGomory_H
00007
00008 #include <string>
00009
00010 #include "CglCutGenerator.hpp"
00011
00012 class CoinWarmStartBasis;
00014 class CglGomory : public CglCutGenerator {
00015 friend void CglGomoryUnitTest(const OsiSolverInterface * siP,
00016 const std::string mpdDir );
00017
00018 public:
00019
00020
00034 virtual void generateCuts( const OsiSolverInterface & si, OsiCuts & cs,
00035 const CglTreeInfo info = CglTreeInfo());
00038 int generateCuts( const OsiRowCutDebugger * debugger,
00039 OsiCuts & cs,
00040 const CoinPackedMatrix & columnCopy,
00041 const CoinPackedMatrix & rowCopy,
00042 const double * colsol,
00043 const double * colLower, const double * colUpper,
00044 const double * rowLower, const double * rowUpper,
00045 const char * intVar ,
00046 const CoinWarmStartBasis* warm,
00047 const CglTreeInfo info = CglTreeInfo());
00050 int generateCuts( const OsiRowCutDebugger * debugger,
00051 OsiCuts & cs,
00052 const CoinPackedMatrix & columnCopy,
00053 const double * colsol,
00054 const double * colLower, const double * colUpper,
00055 const double * rowLower, const double * rowUpper,
00056 const char * intVar ,
00057 const CoinWarmStartBasis* warm,
00058 const CglTreeInfo info = CglTreeInfo());
00059
00061 virtual bool needsOptimalBasis() const { return true; }
00063
00066
00067 void passInOriginalSolver(OsiSolverInterface * solver);
00069 inline OsiSolverInterface * originalSolver() const
00070 { return originalSolver_;}
00072 inline void setGomoryType(int type)
00073 { gomoryType_=type;}
00075 inline int gomoryType() const
00076 { return gomoryType_;}
00078
00081
00082 void setLimit(int limit);
00084 int getLimit() const;
00086 void setLimitAtRoot(int limit);
00088 int getLimitAtRoot() const;
00090 virtual int maximumLengthOfCutInTree() const;
00092
00097
00098 void setAway(double value);
00100 double getAway() const;
00102 void setAwayAtRoot(double value);
00104 double getAwayAtRoot() const;
00106
00116
00117 void setConditionNumberMultiplier(double value);
00119 double getConditionNumberMultiplier() const;
00121 void setLargestFactorMultiplier(double value);
00123 double getLargestFactorMultiplier() const;
00125
00128
00129 inline void useAlternativeFactorization(bool yes=true)
00130 { alternateFactorization_= (yes) ? 1 : 0;}
00132 inline bool alternativeFactorization() const
00133 { return (alternateFactorization_!=0);}
00135
00138
00139 CglGomory ();
00140
00142 CglGomory (
00143 const CglGomory &);
00144
00146 virtual CglCutGenerator * clone() const;
00147
00149 CglGomory &
00150 operator=(
00151 const CglGomory& rhs);
00152
00154 virtual
00155 ~CglGomory ();
00157 virtual std::string generateCpp( FILE * fp);
00159 virtual void refreshSolver(OsiSolverInterface * solver);
00161
00162 private:
00163
00164
00165
00166
00167
00170
00171 double away_;
00173 double awayAtRoot_;
00175 double conditionNumberMultiplier_;
00177 double largestFactorMultiplier_;
00179 OsiSolverInterface * originalSolver_;
00181 int limit_;
00183 int limitAtRoot_;
00185 int dynamicLimitInTree_;
00187 int numberTimesStalled_;
00189 int alternateFactorization_;
00191 int gomoryType_;
00193 };
00194
00195
00201 void CglGomoryUnitTest(const OsiSolverInterface * siP,
00202 const std::string mpdDir );
00203
00204 #endif