Cbc  2.10.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
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_;
181  int limit_;
191  int gomoryType_; // note could add in cutoff as constraint
193 };
194 
195 //#############################################################################
201 void CglGomoryUnitTest(const OsiSolverInterface * siP,
202  const std::string mpdDir );
203 
204 #endif
double largestFactorMultiplier_
Multiplier for largest factor cut relaxation.
Definition: CglGomory.hpp:177
double getAwayAtRoot() const
Get away at root.
virtual CglCutGenerator * clone() const
Clone.
double getAway() const
Get away.
virtual bool needsOptimalBasis() const
Return true if needs optimal basis to do cuts (will return true)
Definition: CglGomory.hpp:61
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)
OsiSolverInterface * originalSolver() const
Returns original solver.
Definition: CglGomory.hpp:69
int getLimitAtRoot() const
Get at root.
int alternateFactorization_
nonzero to use alternative factorization
Definition: CglGomory.hpp:189
OsiSolverInterface * originalSolver_
Original solver.
Definition: CglGomory.hpp:179
Information about where the cut generator is invoked from.
Definition: CglTreeInfo.hpp:15
bool alternativeFactorization() const
Get whether alternative factorization being used.
Definition: CglGomory.hpp:132
friend void CglGomoryUnitTest(const OsiSolverInterface *siP, const std::string mpdDir)
A function that tests the methods in the CglGomory class.
Collections of row cuts and column cuts.
Definition: OsiCuts.hpp:19
CglGomory()
Default constructor.
The default COIN simplex (basis-oriented) warm start class.
void setAway(double value)
Set away.
void useAlternativeFactorization(bool yes=true)
Set/unset alternative factorization.
Definition: CglGomory.hpp:129
int gomoryType_
Type - 0 normal, 1 add original matrix one, 2 replace.
Definition: CglGomory.hpp:191
void setLimitAtRoot(int limit)
Set at root (if &lt;normal then use normal)
virtual int maximumLengthOfCutInTree() const
Return maximum length of cut in tree.
Abstract Base Class for describing an interface to a solver.
void setLimit(int limit)
Set.
int dynamicLimitInTree_
Dynamic limit in tree.
Definition: CglGomory.hpp:185
Gomory Cut Generator Class.
Definition: CglGomory.hpp:14
double getConditionNumberMultiplier() const
Get ConditionNumberMultiplier.
virtual ~CglGomory()
Destructor.
Cut Generator Base Class.
double conditionNumberMultiplier_
Multiplier for conditionNumber cut relaxation.
Definition: CglGomory.hpp:175
int limit_
Limit - only generate if fewer than this in cut.
Definition: CglGomory.hpp:181
virtual void refreshSolver(OsiSolverInterface *solver)
This can be used to refresh any inforamtion.
Sparse Matrix Base Class.
void CglGomoryUnitTest(const OsiSolverInterface *siP, const std::string mpdDir)
A function that tests the methods in the CglGomory class.
double getLargestFactorMultiplier() const
Get LargestFactorMultiplier.
int limitAtRoot_
Limit - only generate if fewer than this in cut (at root)
Definition: CglGomory.hpp:183
void setLargestFactorMultiplier(double value)
Set LargestFactorMultiplier.
int getLimit() const
Get.
double awayAtRoot_
Only investigate if more than this away from integrality (at root)
Definition: CglGomory.hpp:173
double away_
Only investigate if more than this away from integrality.
Definition: CglGomory.hpp:171
Validate cuts against a known solution.
CglGomory & operator=(const CglGomory &rhs)
Assignment operator.
int gomoryType() const
Return type.
Definition: CglGomory.hpp:75
int numberTimesStalled_
Number of times stalled.
Definition: CglGomory.hpp:187
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.
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.