Cgl 0.60.2

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CglResidualCapacity.hpp
Go to the documentation of this file.
1 // LAST EDIT:
2 //-----------------------------------------------------------------------------
3 // Implementation of Residual Capacity Inequalities
4 // Francisco Barahona (barahon@us.ibm.com)
5 //
6 // date: May 18, 2006
7 //-----------------------------------------------------------------------------
8 // Copyright (C) 2004, International Business Machines Corporation and others.
9 // All Rights Reserved.
10 // This code is published under the Eclipse Public License.
11
12 #ifndef CglResidualCapacity_H
13 #define CglResidualCapacity_H
14
15 #include <iostream>
16 #include <fstream>
17 //#include <vector>
18
19 #include "CoinError.hpp"
20
21 #include "CglCutGenerator.hpp"
22
23 //=============================================================================
24
25 #ifndef CGL_DEBUG
26 #define CGL_DEBUG 0
27 #endif
28
29 //=============================================================================
30
31
32
33
34 //=============================================================================
35
47 class CglResidualCapacity : public CglCutGenerator {
48
49 friend void CglResidualCapacityUnitTest(const OsiSolverInterface * siP,
50 const std::string mpdDir );
51
52
53 private:
54 //---------------------------------------------------------------------------
55 // Enumeration constants that describe the various types of rows
56 enum RowType {
60 ROW_L,
64 ROW_G,
67 ROW_BOTH,
70 ROW_OTHER
71 };
72
73
74 public:
77 void setEpsilon(double value);
80 double getEpsilon() const;
82 void setTolerance(double value);
84 double getTolerance() const;
86 void setDoPreproc(int value);
88 bool getDoPreproc() const;
90
97 virtual void generateCuts(const OsiSolverInterface & si, OsiCuts & cs,
98 const CglTreeInfo info = CglTreeInfo());
100
101 //---------------------------------------------------------------------------
104 CglResidualCapacity ();
106
108 CglResidualCapacity ( const double tolerance );
109
111 CglResidualCapacity (
112 const CglResidualCapacity &);
113
115 virtual CglCutGenerator * clone() const;
116
118 CglResidualCapacity &
119 operator=(
120 const CglResidualCapacity& rhs);
121
123 virtual
124 ~CglResidualCapacity ();
126 virtual void refreshPrep();
128
129
130
131 private:
132 //--------------------------------------------------------------------------
133 // Private member methods
134
135 // Construct
136 void gutsOfConstruct ( const double tolerance);
137
138 // Delete
139 void gutsOfDelete();
140
141 // Copy
142 void gutsOfCopy (const CglResidualCapacity& rhs);
143
144 // Do preprocessing.
145 // It determines the type of each row.
146 // It may change sense and RHS for ranged rows
147 void resCapPreprocess(const OsiSolverInterface& si);
148
149 // Determine the type of a given row.
150 RowType determineRowType(const OsiSolverInterface& si,
151 const int rowLen, const int* ind,
152 const double* coef, const char sense,
153 const double rhs,
154 const double* colLowerBound,
155 const double* colUpperBound) const;
156 // helps the function above
157 bool treatAsLessThan(const OsiSolverInterface& si,
158 const int rowLen, const int* ind,
159 const double* coef,
160 const double rhs,
161 const double* colLowerBound,
162 const double* colUpperBound) const;
163
164 // Generate Residual Capacity cuts
165 void generateResCapCuts( const OsiSolverInterface& si,
166 const double* xlp,
167 const double* colUpperBound,
168 const double* colLowerBound,
169 const CoinPackedMatrix& matrixByRow,
170 const double* LHS,
171 const double* coefByRow,
172 const int* colInds,
173 const CoinBigIndex* rowStarts,
174 const int* rowLengths,
175 OsiCuts& cs ) const;
176
177
178 // Residual Capacity separation
179 bool resCapSeparation(const OsiSolverInterface& si,
180 const int rowLen, const int* ind,
181 const double* coef,
182 const double rhs,
183 const double *xlp,
184 const double* colUpperBound,
185 const double* colLowerBound,
186 OsiRowCut& resCapCut) const;
187
188
189
190 private:
191 //---------------------------------------------------------------------------
192 // Private member data
194 double EPSILON_;
197 double TOLERANCE_;
205 int doPreproc_;
206 // The number of rows of the problem.
207 int numRows_;
208 // The number columns of the problem.
209 int numCols_;
210 // Indicates whether preprocessing has been done.
211 bool doneInitPre_;
212 // Array with the row types of the rows in the model.
213 RowType* rowTypes_;
214 // The indices of the rows of the initial matrix
215 int* indRows_;
216 // Sense of rows (modified if ranges)
217 char * sense_;
218 // RHS of rows (modified if ranges)
219 double * RHS_;
220 // The number of rows of type ROW_L
221 int numRowL_;
222 // The indices of the rows of type ROW_L
223 int* indRowL_;
224 // The number of rows of type ROW_G
225 int numRowG_;
226 // The indices of the rows of type ROW_G
227 int* indRowG_;
228 };
229
230 //#############################################################################
236 void CglResidualCapacityUnitTest(const OsiSolverInterface * siP,
237 const std::string mpdDir);
238
239
240 #endif
CglResidualCapacity::setDoPreproc
void setDoPreproc(int value)
Set doPreproc.
CglResidualCapacity::determineRowType
RowType determineRowType(const OsiSolverInterface &si, const int rowLen, const int *ind, const double *coef, const char sense, const double rhs, const double *colLowerBound, const double *colUpperBound) const
CglResidualCapacity::getEpsilon
double getEpsilon() const
Get Epsilon.
CglResidualCapacity::resCapSeparation
bool resCapSeparation(const OsiSolverInterface &si, const int rowLen, const int *ind, const double *coef, const double rhs, const double *xlp, const double *colUpperBound, const double *colLowerBound, OsiRowCut &resCapCut) const
CglResidualCapacity::doPreproc_
int doPreproc_
Controls the preprocessing of the matrix to identify rows suitable for cut generation.
Definition: CglResidualCapacity.hpp:205
CglResidualCapacity::numRowG_
int numRowG_
Definition: CglResidualCapacity.hpp:225
CglResidualCapacity::resCapPreprocess
void resCapPreprocess(const OsiSolverInterface &si)
CglResidualCapacity::indRows_
int * indRows_
Definition: CglResidualCapacity.hpp:215
CglCutGenerator.hpp
CglTreeInfo
Information about where the cut generator is invoked from.
Definition: CglTreeInfo.hpp:15
OsiCuts
Collections of row cuts and column cuts.
Definition: OsiCuts.hpp:19
CglResidualCapacity::gutsOfDelete
void gutsOfDelete()
CglResidualCapacity::RHS_
double * RHS_
Definition: CglResidualCapacity.hpp:219
CglResidualCapacity::generateResCapCuts
void generateResCapCuts(const OsiSolverInterface &si, const double *xlp, const double *colUpperBound, const double *colLowerBound, const CoinPackedMatrix &matrixByRow, const double *LHS, const double *coefByRow, const int *colInds, const CoinBigIndex *rowStarts, const int *rowLengths, OsiCuts &cs) const
CglResidualCapacity
Residual Capacity Inequalities Cut Generator Class.
Definition: CglResidualCapacity.hpp:47
CglResidualCapacity::ROW_G
row of the type -a_1 c_1 - - a_k c_k + d z_1 + + d z_p &gt;= b, where c_i are continuous variables and z...
Definition: CglResidualCapacity.hpp:64
CglResidualCapacity::refreshPrep
virtual void refreshPrep()
This is to refresh preprocessing.
CglResidualCapacity::numRowL_
int numRowL_
Definition: CglResidualCapacity.hpp:221
CglResidualCapacity::getTolerance
double getTolerance() const
Get Tolerance.
OsiSolverInterface
Abstract Base Class for describing an interface to a solver.
Definition: OsiSolverInterface.hpp:61
CglResidualCapacity::CglResidualCapacityUnitTest
friend void CglResidualCapacityUnitTest(const OsiSolverInterface *siP, const std::string mpdDir)
A function that tests the methods in the CglResidualCapacity class.
CglResidualCapacity::gutsOfConstruct
void gutsOfConstruct(const double tolerance)
CoinError.hpp
CglResidualCapacity::operator=
CglResidualCapacity & operator=(const CglResidualCapacity &rhs)
Assignment operator.
CglResidualCapacity::getDoPreproc
bool getDoPreproc() const
Get doPreproc.
CglResidualCapacity::doneInitPre_
bool doneInitPre_
Definition: CglResidualCapacity.hpp:211
CglCutGenerator
Cut Generator Base Class.
Definition: CglCutGenerator.hpp:23
CglResidualCapacity::rowTypes_
RowType * rowTypes_
Definition: CglResidualCapacity.hpp:213
CglResidualCapacity::ROW_BOTH
equation that can be treated as ROW_L and ROW_G
Definition: CglResidualCapacity.hpp:67
CglResidualCapacity::treatAsLessThan
bool treatAsLessThan(const OsiSolverInterface &si, const int rowLen, const int *ind, const double *coef, const double rhs, const double *colLowerBound, const double *colUpperBound) const
CglResidualCapacity::indRowL_
int * indRowL_
Definition: CglResidualCapacity.hpp:223
CglResidualCapacity::numCols_
int numCols_
Definition: CglResidualCapacity.hpp:209
CglResidualCapacity::generateCuts
virtual void generateCuts(const OsiSolverInterface &si, OsiCuts &cs, const CglTreeInfo info=CglTreeInfo())
Generate Residual Capacity cuts for the model data contained in si.
CglResidualCapacity::clone
virtual CglCutGenerator * clone() const
Clone.
CglResidualCapacity::indRowG_
int * indRowG_
Definition: CglResidualCapacity.hpp:227
OsiRowCut
Row Cut Class.
Definition: OsiRowCut.hpp:29
CglResidualCapacity::RowType
RowType
Definition: CglResidualCapacity.hpp:56
CoinPackedMatrix
Sparse Matrix Base Class.
Definition: CoinPackedMatrix.hpp:79
CoinBigIndex
int CoinBigIndex
Definition: Coin_C_defines.h:136
CglResidualCapacity::~CglResidualCapacity
virtual ~CglResidualCapacity()
Destructor.
CglResidualCapacity::setEpsilon
void setEpsilon(double value)
Set Epsilon.
CglResidualCapacity::gutsOfCopy
void gutsOfCopy(const CglResidualCapacity &rhs)
CglResidualCapacityUnitTest
void CglResidualCapacityUnitTest(const OsiSolverInterface *siP, const std::string mpdDir)
A function that tests the methods in the CglResidualCapacity class.
CglResidualCapacity::CglResidualCapacity
CglResidualCapacity()
Default constructor.
CglResidualCapacity::setTolerance
void setTolerance(double value)
Set Tolerance.
CglResidualCapacity::EPSILON_
double EPSILON_
Tolerance used for numerical purposes, default value: 1.e-6.
Definition: CglResidualCapacity.hpp:194
CglResidualCapacity::numRows_
int numRows_
Definition: CglResidualCapacity.hpp:207
CglResidualCapacity::ROW_L
row of the type a_1 c_1 + + a_k c_k - d z_1 - - d z_p &lt;= b, where c_i are continuous variables and z_...
Definition: CglResidualCapacity.hpp:60
CglResidualCapacity::sense_
char * sense_
Definition: CglResidualCapacity.hpp:217
CglResidualCapacity::TOLERANCE_
double TOLERANCE_
If violation of a cut is greater that this number, the cut is accepted, default value: 1...
Definition: CglResidualCapacity.hpp:197
CglResidualCapacity::ROW_OTHER
Other types of rows.
Definition: CglResidualCapacity.hpp:70