Cgl  0.59.9
CglGomory.hpp
Go to the documentation of this file.
1 // Copyright (C) 2002, International Business Machines
2 // Corporation and others. All Rights Reserved.
3 // This code is licensed under the terms of the Eclipse Public License (EPL).
4 
5 #ifndef CglGomory_H
6 #define CglGomory_H
7 
8 #include <string>
9 
10 #include "CglCutGenerator.hpp"
11 
12 class CoinWarmStartBasis;
14 class CglGomory : public CglCutGenerator {
15  friend void CglGomoryUnitTest(const OsiSolverInterface * siP,
16  const std::string mpdDir );
17 
18 public:
19 
20 
34  virtual void generateCuts( const OsiSolverInterface & si, OsiCuts & cs,
35  const CglTreeInfo info = CglTreeInfo());
38  int generateCuts( const OsiRowCutDebugger * debugger,
39  OsiCuts & cs,
40  const CoinPackedMatrix & columnCopy,
41  const CoinPackedMatrix & rowCopy,
42  const double * colsol,
43  const double * colLower, const double * colUpper,
44  const double * rowLower, const double * rowUpper,
45  const char * intVar ,
46  const CoinWarmStartBasis* warm,
47  const CglTreeInfo info = CglTreeInfo());
50  int generateCuts( const OsiRowCutDebugger * debugger,
51  OsiCuts & cs,
52  const CoinPackedMatrix & columnCopy,
53  const double * colsol,
54  const double * colLower, const double * colUpper,
55  const double * rowLower, const double * rowUpper,
56  const char * intVar ,
57  const CoinWarmStartBasis* warm,
58  const CglTreeInfo info = CglTreeInfo());
59 
61  virtual bool needsOptimalBasis() const { return true; }
63 
66  void passInOriginalSolver(OsiSolverInterface * solver);
69  inline OsiSolverInterface * originalSolver() const
70  { return originalSolver_;}
72  inline void setGomoryType(int type)
73  { gomoryType_=type;}
75  inline int gomoryType() const
76  { return gomoryType_;}
78 
81  void setLimit(int limit);
84  int getLimit() const;
86  void setLimitAtRoot(int limit);
88  int getLimitAtRoot() const;
90  virtual int maximumLengthOfCutInTree() const;
92 
97  void setAway(double value);
100  double getAway() const;
102  void setAwayAtRoot(double value);
104  double getAwayAtRoot() const;
106 
116  void setConditionNumberMultiplier(double value);
119  double getConditionNumberMultiplier() const;
121  void setLargestFactorMultiplier(double value);
123  double getLargestFactorMultiplier() const;
125 
128  inline void useAlternativeFactorization(bool yes=true)
130  { alternateFactorization_= (yes) ? 1 : 0;}
132  inline bool alternativeFactorization() const
133  { return (alternateFactorization_!=0);}
135 
138  CglGomory ();
140 
142  CglGomory (
143  const CglGomory &);
144 
146  virtual CglCutGenerator * clone() const;
147 
149  CglGomory &
150  operator=(
151  const CglGomory& rhs);
152 
154  virtual
155  ~CglGomory ();
157  virtual std::string generateCpp( FILE * fp);
159  virtual void refreshSolver(OsiSolverInterface * solver);
161 
162 private:
163 
164  // Private member methods
165 
166  // Private member data
167 
170  double away_;
173  double awayAtRoot_;
175  double conditionNumberMultiplier_;
177  double largestFactorMultiplier_;
179  OsiSolverInterface * originalSolver_;
181  int limit_;
183  int limitAtRoot_;
185  int dynamicLimitInTree_;
187  int numberTimesStalled_;
189  int alternateFactorization_;
191  int gomoryType_;
193 };
194 
195 //#############################################################################
201 void CglGomoryUnitTest(const OsiSolverInterface * siP,
202  const std::string mpdDir );
203 
204 #endif
double getAway() const
Get away.
virtual std::string generateCpp(FILE *fp)
Create C++ lines to get to current state.
void passInOriginalSolver(OsiSolverInterface *solver)
Pass in a copy of original solver (clone it)
int getLimitAtRoot() const
Get at root.
Information about where the cut generator is invoked from.
Definition: CglTreeInfo.hpp:15
friend void CglGomoryUnitTest(const OsiSolverInterface *siP, const std::string mpdDir)
A function that tests the methods in the CglGomory class.
int getLimit() const
Get.
CglGomory()
Default constructor.
void setAway(double value)
Set away.
OsiSolverInterface * originalSolver() const
Returns original solver.
Definition: CglGomory.hpp:69
bool alternativeFactorization() const
Get whether alternative factorization being used.
Definition: CglGomory.hpp:132
void useAlternativeFactorization(bool yes=true)
Set/unset alternative factorization.
Definition: CglGomory.hpp:129
virtual CglCutGenerator * clone() const
Clone.
double getLargestFactorMultiplier() const
Get LargestFactorMultiplier.
void setLimitAtRoot(int limit)
Set at root (if <normal then use normal)
double getConditionNumberMultiplier() const
Get ConditionNumberMultiplier.
void setLimit(int limit)
Set.
Gomory Cut Generator Class.
Definition: CglGomory.hpp:14
virtual ~CglGomory()
Destructor.
Cut Generator Base Class.
double getAwayAtRoot() const
Get away at root.
virtual void refreshSolver(OsiSolverInterface *solver)
This can be used to refresh any inforamtion.
void CglGomoryUnitTest(const OsiSolverInterface *siP, const std::string mpdDir)
A function that tests the methods in the CglGomory class.
void setLargestFactorMultiplier(double value)
Set LargestFactorMultiplier.
virtual int maximumLengthOfCutInTree() const
Return maximum length of cut in tree.
int gomoryType() const
Return type.
Definition: CglGomory.hpp:75
CglGomory & operator=(const CglGomory &rhs)
Assignment operator.
void setGomoryType(int type)
Set type - 0 normal, 1 add original matrix one, 2 replace.
Definition: CglGomory.hpp:72
void setAwayAtRoot(double value)
Set away at root.
virtual bool needsOptimalBasis() const
Return true if needs optimal basis to do cuts (will return true)
Definition: CglGomory.hpp:61
void setConditionNumberMultiplier(double value)
Set ConditionNumberMultiplier.
virtual void generateCuts(const OsiSolverInterface &si, OsiCuts &cs, const CglTreeInfo info=CglTreeInfo())
Generate Mixed Integer Gomory cuts for the model of the solver interface, si.