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
ClpPresolve.hpp
Go to the documentation of this file.
1 /* $Id: ClpPresolve.hpp 2385 2019-01-06 19:43:06Z unxusr $ */
2 // Copyright (C) 2002, International Business Machines
3 // Corporation and others. All Rights Reserved.
4 // This code is licensed under the terms of the Eclipse Public License (EPL).
5
6 #ifndef ClpPresolve_H
7 #define ClpPresolve_H
8 #include "ClpSimplex.hpp"
9
10 class CoinPresolveAction;
11 #include "CoinPresolveMatrix.hpp"
15 class ClpPresolve {
16 public:
19 ClpPresolve();
21
23 virtual ~ClpPresolve();
25
41 ClpSimplex *presolvedModel(ClpSimplex &si,
42 double feasibilityTolerance = 0.0,
43 bool keepIntegers = true,
44 int numberPasses = 5,
45 bool dropNames = false,
46 bool doRowObjective = false,
47 const char *prohibitedRows = NULL,
48 const char *prohibitedColumns = NULL);
49 #ifndef CLP_NO_STD
50
53 int presolvedModelToFile(ClpSimplex &si, std::string fileName,
54 double feasibilityTolerance = 0.0,
55 bool keepIntegers = true,
56 int numberPasses = 5,
57 bool dropNames = false,
58 bool doRowObjective = false);
59 #endif
60
62 ClpSimplex *model() const;
64 ClpSimplex *originalModel() const;
66 void setOriginalModel(ClpSimplex *model);
67
69 const int *originalColumns() const;
71 const int *originalRows() const;
76 inline void setNonLinearValue(double value)
77 {
78 nonLinearValue_ = value;
79 }
80 inline double nonLinearValue() const
81 {
82 return nonLinearValue_;
83 }
85 inline bool doDual() const
86 {
87 return (presolveActions_ & 1) == 0;
88 }
89 inline void setDoDual(bool doDual)
90 {
91 if (doDual)
92 presolveActions_ &= ~1;
93 else
94 presolveActions_ |= 1;
95 }
97 inline bool doSingleton() const
98 {
99 return (presolveActions_ & 2) == 0;
100 }
101 inline void setDoSingleton(bool doSingleton)
102 {
103 if (doSingleton)
104 presolveActions_ &= ~2;
105 else
106 presolveActions_ |= 2;
107 }
109 inline bool doDoubleton() const
110 {
111 return (presolveActions_ & 4) == 0;
112 }
113 inline void setDoDoubleton(bool doDoubleton)
114 {
115 if (doDoubleton)
116 presolveActions_ &= ~4;
117 else
118 presolveActions_ |= 4;
119 }
121 inline bool doTripleton() const
122 {
123 return (presolveActions_ & 8) == 0;
124 }
125 inline void setDoTripleton(bool doTripleton)
126 {
127 if (doTripleton)
128 presolveActions_ &= ~8;
129 else
130 presolveActions_ |= 8;
131 }
133 inline bool doTighten() const
134 {
135 return (presolveActions_ & 16) == 0;
136 }
137 inline void setDoTighten(bool doTighten)
138 {
139 if (doTighten)
140 presolveActions_ &= ~16;
141 else
142 presolveActions_ |= 16;
143 }
145 inline bool doForcing() const
146 {
147 return (presolveActions_ & 32) == 0;
148 }
149 inline void setDoForcing(bool doForcing)
150 {
151 if (doForcing)
152 presolveActions_ &= ~32;
153 else
154 presolveActions_ |= 32;
155 }
157 inline bool doImpliedFree() const
158 {
159 return (presolveActions_ & 64) == 0;
160 }
161 inline void setDoImpliedFree(bool doImpliedfree)
162 {
163 if (doImpliedfree)
164 presolveActions_ &= ~64;
165 else
166 presolveActions_ |= 64;
167 }
169 inline bool doDupcol() const
170 {
171 return (presolveActions_ & 128) == 0;
172 }
173 inline void setDoDupcol(bool doDupcol)
174 {
175 if (doDupcol)
176 presolveActions_ &= ~128;
177 else
178 presolveActions_ |= 128;
179 }
181 inline bool doDuprow() const
182 {
183 return (presolveActions_ & 256) == 0;
184 }
185 inline void setDoDuprow(bool doDuprow)
186 {
187 if (doDuprow)
188 presolveActions_ &= ~256;
189 else
190 presolveActions_ |= 256;
191 }
193 inline bool doDependency() const
194 {
195 return (presolveActions_ & 32768) != 0;
196 }
197 inline void setDoDependency(bool doDependency)
198 {
199 if (doDependency)
200 presolveActions_ |= 32768;
201 else
202 presolveActions_ &= ~32768;
203 }
205 inline bool doTransfer() const
206 {
207 return (presolveActions_ & 65536) != 0;
208 }
209 inline void setDoTransfer(bool doTransfer)
210 {
211 if (doTransfer)
212 presolveActions_ |= 65536;
213 else
214 presolveActions_ &= ~65536;
215 }
217 inline bool doSingletonColumn() const
218 {
219 return (presolveActions_ & 512) == 0;
220 }
221 inline void setDoSingletonColumn(bool doSingleton)
222 {
223 if (doSingleton)
224 presolveActions_ &= ~512;
225 else
226 presolveActions_ |= 512;
227 }
229 inline bool doGubrow() const
230 {
231 return (presolveActions_ & 1024) == 0;
232 }
233 inline void setDoGubrow(bool doGubrow)
234 {
235 if (doGubrow)
236 presolveActions_ &= ~1024;
237 else
238 presolveActions_ |= 1024;
239 }
241 inline bool doTwoxTwo() const
242 {
243 return (presolveActions_ & 2048) != 0;
244 }
245 inline void setDoTwoxtwo(bool doTwoxTwo)
246 {
247 if (!doTwoxTwo)
248 presolveActions_ &= ~2048;
249 else
250 presolveActions_ |= 2048;
251 }
253 inline bool doIntersection() const
254 {
255 return (presolveActions_ & 4096) != 0;
256 }
257 inline void setDoIntersection(bool doIntersection)
258 {
259 if (doIntersection)
260 presolveActions_ &= ~4096;
261 else
262 presolveActions_ |= 4096;
263 }
266 inline int zeroSmall() const
267 {
268 return (presolveActions_ & (8192 | 16384)) >> 13;
269 }
270 inline void setZeroSmall(int value)
271 {
272 presolveActions_ &= ~(8192 | 16384);
273 presolveActions_ |= value << 13;
274 }
276 inline int presolveActions() const
277 {
278 return presolveActions_ & 0xffffff;
279 }
280 inline void setPresolveActions(int action)
281 {
282 presolveActions_ = (presolveActions_ & 0xff000000) | (action & 0xffffff);
283 }
285 inline void setSubstitution(int value)
286 {
287 substitution_ = value;
288 }
290 inline void statistics()
291 {
292 presolveActions_ |= 0x80000000;
293 }
295 int presolveStatus() const;
296
305 virtual void postsolve(bool updateStatus = true);
306
308 void destroyPresolve();
309
311 private:
313 ClpSimplex *originalModel_;
314
316 ClpSimplex *presolvedModel_;
322 double nonLinearValue_;
324 int *originalColumn_;
326 int *originalRow_;
328 double *rowObjective_;
330 const CoinPresolveAction *paction_;
331
337 int ncols_;
338 int nrows_;
339 CoinBigIndex nelems_;
341 int numberPasses_;
343 int substitution_;
344 #ifndef CLP_NO_STD
345 std::string saveFile_;
347 #endif
348
352 int presolveActions_;
353
354 protected:
358 virtual const CoinPresolveAction *presolve(CoinPresolveMatrix *prob);
359
365 virtual void postsolve(CoinPostsolveMatrix &prob);
367 virtual ClpSimplex *gutsOfPresolvedModel(ClpSimplex *originalModel,
368 double feasibilityTolerance,
369 bool keepIntegers,
370 int numberPasses,
371 bool dropNames,
372 bool doRowObjective,
373 const char *prohibitedRows = NULL,
374 const char *prohibitedColumns = NULL);
375 };
376 #endif
377
378 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
379 */
ClpPresolve::originalModel
ClpSimplex * originalModel() const
Return pointer to original model.
ClpPresolve::nonLinearValue
double nonLinearValue() const
Definition: ClpPresolve.hpp:80
ClpPresolve::doSingletonColumn
bool doSingletonColumn() const
Whether we want to do singleton column part of presolve.
Definition: ClpPresolve.hpp:217
ClpPresolve::setDoTighten
void setDoTighten(bool doTighten)
Definition: ClpPresolve.hpp:137
ClpSimplex.hpp
ClpPresolve::numberPasses_
int numberPasses_
Number of major passes.
Definition: ClpPresolve.hpp:341
ClpPresolve::setDoIntersection
void setDoIntersection(bool doIntersection)
Definition: ClpPresolve.hpp:257
ClpPresolve::doTighten
bool doTighten() const
Whether we want to do tighten part of presolve.
Definition: ClpPresolve.hpp:133
ClpPresolve::setDoDual
void setDoDual(bool doDual)
Definition: ClpPresolve.hpp:89
ClpPresolve::presolveActions
int presolveActions() const
Set whole group.
Definition: ClpPresolve.hpp:276
ClpPresolve::nrows_
int nrows_
Definition: ClpPresolve.hpp:338
CoinPresolveAction
Abstract base class of all presolve routines.
Definition: CoinPresolveMatrix.hpp:163
ClpPresolve::setDoTripleton
void setDoTripleton(bool doTripleton)
Definition: ClpPresolve.hpp:125
ClpPresolve::setDoDuprow
void setDoDuprow(bool doDuprow)
Definition: ClpPresolve.hpp:185
ClpPresolve::doSingleton
bool doSingleton() const
Whether we want to do singleton part of presolve.
Definition: ClpPresolve.hpp:97
ClpPresolve::doDependency
bool doDependency() const
Whether we want to do dependency part of presolve.
Definition: ClpPresolve.hpp:193
ClpPresolve::doDuprow
bool doDuprow() const
Whether we want to do duprow part of presolve.
Definition: ClpPresolve.hpp:181
ClpPresolve::doDual
bool doDual() const
Whether we want to do dual part of presolve.
Definition: ClpPresolve.hpp:85
ClpPresolve::saveFile_
std::string saveFile_
Name of saved model file.
Definition: ClpPresolve.hpp:346
ClpPresolve::setDoImpliedFree
void setDoImpliedFree(bool doImpliedfree)
Definition: ClpPresolve.hpp:161
ClpPresolve::presolvedModel
ClpSimplex * presolvedModel(ClpSimplex &si, double feasibilityTolerance=0.0, bool keepIntegers=true, int numberPasses=5, bool dropNames=false, bool doRowObjective=false, const char *prohibitedRows=NULL, const char *prohibitedColumns=NULL)
ClpPresolve::doTripleton
bool doTripleton() const
Whether we want to do tripleton part of presolve.
Definition: ClpPresolve.hpp:121
ClpPresolve::ClpPresolve
ClpPresolve()
Default constructor.
ClpPresolve::setSubstitution
void setSubstitution(int value)
Substitution level.
Definition: ClpPresolve.hpp:285
ClpPresolve::setDoSingleton
void setDoSingleton(bool doSingleton)
Definition: ClpPresolve.hpp:101
ClpPresolve::doGubrow
bool doGubrow() const
Whether we want to do gubrow part of presolve.
Definition: ClpPresolve.hpp:229
ClpPresolve::originalRows
const int * originalRows() const
return pointer to original rows
CoinPresolveMatrix.hpp
Declarations for CoinPresolveMatrix and CoinPostsolveMatrix and their common base class CoinPrePostso...
ClpPresolve::doForcing
bool doForcing() const
Whether we want to do forcing part of presolve.
Definition: ClpPresolve.hpp:145
ClpPresolve::setDoDoubleton
void setDoDoubleton(bool doDoubleton)
Definition: ClpPresolve.hpp:113
ClpPresolve::setDoForcing
void setDoForcing(bool doForcing)
Definition: ClpPresolve.hpp:149
ClpPresolve::setDoTwoxtwo
void setDoTwoxtwo(bool doTwoxTwo)
Definition: ClpPresolve.hpp:245
ClpPresolve::gutsOfPresolvedModel
virtual ClpSimplex * gutsOfPresolvedModel(ClpSimplex *originalModel, double feasibilityTolerance, bool keepIntegers, int numberPasses, bool dropNames, bool doRowObjective, const char *prohibitedRows=NULL, const char *prohibitedColumns=NULL)
This is main part of Presolve.
ClpPresolve::postsolve
virtual void postsolve(bool updateStatus=true)
ClpPresolve::~ClpPresolve
virtual ~ClpPresolve()
Virtual destructor.
ClpPresolve::substitution_
int substitution_
Substitution level.
Definition: ClpPresolve.hpp:343
ClpSimplex
This solves LPs using the simplex method.
Definition: ClpSimplex.hpp:106
ClpPresolve::setPresolveActions
void setPresolveActions(int action)
Definition: ClpPresolve.hpp:280
ClpPresolve::zeroSmall
int zeroSmall() const
How much we want to zero small values from aggregation - ratio 0 - 1.0e-12, 1 1.0e-11, 2 1.0e-10, 3 1.0e-9.
Definition: ClpPresolve.hpp:266
ClpPresolve::doTwoxTwo
bool doTwoxTwo() const
Whether we want to do twoxtwo part of presolve.
Definition: ClpPresolve.hpp:241
ClpPresolve
This is the Clp interface to CoinPresolve.
Definition: ClpPresolve.hpp:15
ClpPresolve::rowObjective_
double * rowObjective_
Row objective.
Definition: ClpPresolve.hpp:328
ClpPresolve::paction_
const CoinPresolveAction * paction_
The list of transformations applied.
Definition: ClpPresolve.hpp:330
ClpPresolve::originalColumn_
int * originalColumn_
Original column numbers.
Definition: ClpPresolve.hpp:324
ClpPresolve::doTransfer
bool doTransfer() const
Whether we want to do transfer part of presolve.
Definition: ClpPresolve.hpp:205
ClpPresolve::doIntersection
bool doIntersection() const
Whether we want to allow duplicate intersections.
Definition: ClpPresolve.hpp:253
CoinPostsolveMatrix
Augments CoinPrePostsolveMatrix with information about the problem that is only needed during postsol...
Definition: CoinPresolveMatrix.hpp:1552
ClpPresolve::doDupcol
bool doDupcol() const
Whether we want to do dupcol part of presolve.
Definition: ClpPresolve.hpp:169
ClpPresolve::originalColumns
const int * originalColumns() const
return pointer to original columns
ClpPresolve::setDoDependency
void setDoDependency(bool doDependency)
Definition: ClpPresolve.hpp:197
ClpPresolve::setDoGubrow
void setDoGubrow(bool doGubrow)
Definition: ClpPresolve.hpp:233
CoinPresolveMatrix
Augments CoinPrePostsolveMatrix with information about the problem that is only needed during presolv...
Definition: CoinPresolveMatrix.hpp:905
ClpPresolve::setZeroSmall
void setZeroSmall(int value)
Definition: ClpPresolve.hpp:270
ClpPresolve::presolvedModelToFile
int presolvedModelToFile(ClpSimplex &si, std::string fileName, double feasibilityTolerance=0.0, bool keepIntegers=true, int numberPasses=5, bool dropNames=false, bool doRowObjective=false)
This version saves data in a file.
ClpPresolve::setOriginalModel
void setOriginalModel(ClpSimplex *model)
Set pointer to original model.
ClpPresolve::doImpliedFree
bool doImpliedFree() const
Whether we want to do impliedfree part of presolve.
Definition: ClpPresolve.hpp:157
ClpPresolve::presolveActions_
int presolveActions_
Whether we want to skip dual part of presolve etc.
Definition: ClpPresolve.hpp:352
CoinBigIndex
int CoinBigIndex
Definition: Coin_C_defines.h:136
ClpPresolve::ncols_
int ncols_
The postsolved problem will expand back to its former size as postsolve transformations are applied...
Definition: ClpPresolve.hpp:337
ClpPresolve::model
ClpSimplex * model() const
Return pointer to presolved model, Up to user to destroy.
ClpPresolve::setDoSingletonColumn
void setDoSingletonColumn(bool doSingleton)
Definition: ClpPresolve.hpp:221
ClpPresolve::presolvedModel_
ClpSimplex * presolvedModel_
ClpPresolved model - up to user to destroy by deleteClpPresolvedModel.
Definition: ClpPresolve.hpp:316
ClpPresolve::doDoubleton
bool doDoubleton() const
Whether we want to do doubleton part of presolve.
Definition: ClpPresolve.hpp:109
ClpPresolve::originalRow_
int * originalRow_
Original row numbers.
Definition: ClpPresolve.hpp:326
ClpPresolve::presolve
virtual const CoinPresolveAction * presolve(CoinPresolveMatrix *prob)
If you want to apply the individual presolve routines differently, or perhaps add your own to the mix...
ClpPresolve::originalModel_
ClpSimplex * originalModel_
Original model - must not be destroyed before postsolve.
Definition: ClpPresolve.hpp:313
ClpPresolve::presolveStatus
int presolveStatus() const
Return presolve status (0,1,2)
ClpPresolve::nelems_
CoinBigIndex nelems_
Definition: ClpPresolve.hpp:339
ClpPresolve::setDoTransfer
void setDoTransfer(bool doTransfer)
Definition: ClpPresolve.hpp:209
ClpPresolve::destroyPresolve
void destroyPresolve()
Gets rid of presolve actions (e.g.when infeasible)
ClpPresolve::statistics
void statistics()
Asks for statistics.
Definition: ClpPresolve.hpp:290
ClpPresolve::setNonLinearValue
void setNonLinearValue(double value)
&quot;Magic&quot; number.
Definition: ClpPresolve.hpp:76
ClpPresolve::nonLinearValue_
double nonLinearValue_
&quot;Magic&quot; number.
Definition: ClpPresolve.hpp:322
ClpPresolve::setDoDupcol
void setDoDupcol(bool doDupcol)
Definition: ClpPresolve.hpp:173