Cgl 0.60.3
Loading...
Searching...
No Matches
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
12class CoinWarmStartBasis;
14class CglGomory : public CglCutGenerator {
15 friend void CglGomoryUnitTest(const OsiSolverInterface * siP,
16 const std::string mpdDir );
17
18public:
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
67 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
82 void setLimit(int limit);
84 int getLimit() const;
86 void setLimitAtRoot(int limit);
88 int getLimitAtRoot() const;
90 virtual int maximumLengthOfCutInTree() const;
92
98 void setAway(double value);
100 double getAway() const;
102 void setAwayAtRoot(double value);
104 double getAwayAtRoot() const;
106
121 void setLargestFactorMultiplier(double value);
125
129 inline void useAlternativeFactorization(bool yes=true)
130 { alternateFactorization_= (yes) ? 1 : 0;}
132 inline bool alternativeFactorization() const
133 { return (alternateFactorization_!=0);}
135
140
143 const CglGomory &);
144
146 virtual CglCutGenerator * clone() const;
147
149 CglGomory &
151 const CglGomory& rhs);
152
154 virtual
157 virtual std::string generateCpp( FILE * fp);
159 virtual void refreshSolver(OsiSolverInterface * solver);
161
162private:
163
164 // Private member methods
165
166 // Private member data
167
171 double away_;
179 OsiSolverInterface * originalSolver_;
191 int gomoryType_; // note could add in cutoff as constraint
193};
194
195//#############################################################################
201void CglGomoryUnitTest(const OsiSolverInterface * siP,
202 const std::string mpdDir );
203
204#endif
void CglGomoryUnitTest(const OsiSolverInterface *siP, const std::string mpdDir)
A function that tests the methods in the CglGomory class.
Cut Generator Base Class.
Gomory Cut Generator Class.
Definition CglGomory.hpp:14
double getLargestFactorMultiplier() const
Get LargestFactorMultiplier.
CglGomory(const CglGomory &)
Copy constructor.
void useAlternativeFactorization(bool yes=true)
Set/unset alternative factorization.
double awayAtRoot_
Only investigate if more than this away from integrality (at root)
void passInOriginalSolver(OsiSolverInterface *solver)
Pass in a copy of original solver (clone it)
virtual bool needsOptimalBasis() const
Return true if needs optimal basis to do cuts (will return true)
Definition CglGomory.hpp:61
CglGomory & operator=(const CglGomory &rhs)
Assignment operator.
void setLimit(int limit)
Set.
int getLimit() const
Get.
virtual void refreshSolver(OsiSolverInterface *solver)
This can be used to refresh any inforamtion.
void setAwayAtRoot(double value)
Set away at root.
double away_
Only investigate if more than this away from integrality.
friend 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.
int limitAtRoot_
Limit - only generate if fewer than this in cut (at root)
virtual int maximumLengthOfCutInTree() const
Return maximum length of cut in tree.
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.
virtual std::string generateCpp(FILE *fp)
Create C++ lines to get to current state.
OsiSolverInterface * originalSolver() const
Returns original solver.
Definition CglGomory.hpp:69
int numberTimesStalled_
Number of times stalled.
int gomoryType() const
Return type.
Definition CglGomory.hpp:75
double getConditionNumberMultiplier() const
Get ConditionNumberMultiplier.
int alternateFactorization_
nonzero to use alternative factorization
void setConditionNumberMultiplier(double value)
Set ConditionNumberMultiplier.
void setLimitAtRoot(int limit)
Set at root (if <normal then use normal)
double getAwayAtRoot() const
Get away at root.
virtual CglCutGenerator * clone() const
Clone.
double conditionNumberMultiplier_
Multiplier for conditionNumber cut relaxation.
int generateCuts(const OsiRowCutDebugger *debugger, OsiCuts &cs, const CoinPackedMatrix &columnCopy, const double *colsol, const double *colLower, const double *colUpper, const double *rowLower, const double *rowUpper, const char *intVar, const CoinWarmStartBasis *warm, const CglTreeInfo info=CglTreeInfo())
Generates cuts given matrix and solution etc, returns number of cuts generated (no row copy passed in...
int generateCuts(const OsiRowCutDebugger *debugger, OsiCuts &cs, const CoinPackedMatrix &columnCopy, const CoinPackedMatrix &rowCopy, const double *colsol, const double *colLower, const double *colUpper, const double *rowLower, const double *rowUpper, const char *intVar, const CoinWarmStartBasis *warm, const CglTreeInfo info=CglTreeInfo())
Generates cuts given matrix and solution etc, returns number of cuts generated.
bool alternativeFactorization() const
Get whether alternative factorization being used.
int getLimitAtRoot() const
Get at root.
int limit_
Limit - only generate if fewer than this in cut.
double getAway() const
Get away.
void setGomoryType(int type)
Set type - 0 normal, 1 add original matrix one, 2 replace.
Definition CglGomory.hpp:72
int gomoryType_
Type - 0 normal, 1 add original matrix one, 2 replace.
void setAway(double value)
Set away.
virtual ~CglGomory()
Destructor.
CglGomory()
Default constructor.
double largestFactorMultiplier_
Multiplier for largest factor cut relaxation.
OsiSolverInterface * originalSolver_
Original solver.
int dynamicLimitInTree_
Dynamic limit in tree.
Information about where the cut generator is invoked from.