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

- File List
- File Members

ClpPresolve.hpp
Go to the documentation of this file.
1 /* $Id: ClpPresolve.hpp 2134 2015-03-22 16:40:43Z forrest $ */
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 nonLinearValue_ = value;
78 }
79 inline double nonLinearValue() const {
80 return nonLinearValue_;
81 }
83 inline bool doDual() const {
84 return (presolveActions_ & 1) == 0;
85 }
86 inline void setDoDual(bool doDual) {
87 if (doDual) presolveActions_ &= ~1;
88 else presolveActions_ |= 1;
89 }
91 inline bool doSingleton() const {
92 return (presolveActions_ & 2) == 0;
93 }
94 inline void setDoSingleton(bool doSingleton) {
95 if (doSingleton) presolveActions_ &= ~2;
96 else presolveActions_ |= 2;
97 }
99 inline bool doDoubleton() const {
100 return (presolveActions_ & 4) == 0;
101 }
102 inline void setDoDoubleton(bool doDoubleton) {
103 if (doDoubleton) presolveActions_ &= ~4;
104 else presolveActions_ |= 4;
105 }
107 inline bool doTripleton() const {
108 return (presolveActions_ & 8) == 0;
109 }
110 inline void setDoTripleton(bool doTripleton) {
111 if (doTripleton) presolveActions_ &= ~8;
112 else presolveActions_ |= 8;
113 }
115 inline bool doTighten() const {
116 return (presolveActions_ & 16) == 0;
117 }
118 inline void setDoTighten(bool doTighten) {
119 if (doTighten) presolveActions_ &= ~16;
120 else presolveActions_ |= 16;
121 }
123 inline bool doForcing() const {
124 return (presolveActions_ & 32) == 0;
125 }
126 inline void setDoForcing(bool doForcing) {
127 if (doForcing) presolveActions_ &= ~32;
128 else presolveActions_ |= 32;
129 }
131 inline bool doImpliedFree() const {
132 return (presolveActions_ & 64) == 0;
133 }
134 inline void setDoImpliedFree(bool doImpliedfree) {
135 if (doImpliedfree) presolveActions_ &= ~64;
136 else presolveActions_ |= 64;
137 }
139 inline bool doDupcol() const {
140 return (presolveActions_ & 128) == 0;
141 }
142 inline void setDoDupcol(bool doDupcol) {
143 if (doDupcol) presolveActions_ &= ~128;
144 else presolveActions_ |= 128;
145 }
147 inline bool doDuprow() const {
148 return (presolveActions_ & 256) == 0;
149 }
150 inline void setDoDuprow(bool doDuprow) {
151 if (doDuprow) presolveActions_ &= ~256;
152 else presolveActions_ |= 256;
153 }
155 inline bool doDependency() const {
156 return (presolveActions_ & 32768) != 0;
157 }
158 inline void setDoDependency(bool doDependency) {
159 if (doDependency) presolveActions_ |= 32768;
160 else presolveActions_ &= ~32768;
161 }
163 inline bool doSingletonColumn() const {
164 return (presolveActions_ & 512) == 0;
165 }
166 inline void setDoSingletonColumn(bool doSingleton) {
167 if (doSingleton) presolveActions_ &= ~512;
168 else presolveActions_ |= 512;
169 }
171 inline bool doGubrow() const {
172 return (presolveActions_ & 1024) == 0;
173 }
174 inline void setDoGubrow(bool doGubrow) {
175 if (doGubrow) presolveActions_ &= ~1024;
176 else presolveActions_ |= 1024;
177 }
179 inline bool doTwoxTwo() const {
180 return (presolveActions_ & 2048) != 0;
181 }
182 inline void setDoTwoxtwo(bool doTwoxTwo) {
183 if (!doTwoxTwo) presolveActions_ &= ~2048;
184 else presolveActions_ |= 2048;
185 }
187 inline bool doIntersection() const {
188 return (presolveActions_ & 4096) != 0;
189 }
190 inline void setDoIntersection(bool doIntersection) {
191 if (doIntersection) presolveActions_ &= ~4096;
192 else presolveActions_ |= 4096;
193 }
196 inline int zeroSmall() const {
197 return (presolveActions_&(8192|16384))>>13;
198 }
199 inline void setZeroSmall(int value) {
200 presolveActions_ &= ~(8192|16384);
201 presolveActions_ |= value<<13;
202 }
204 inline int presolveActions() const {
205 return presolveActions_ & 0xffff;
206 }
207 inline void setPresolveActions(int action) {
208 presolveActions_ = (presolveActions_ & 0xffff0000) | (action & 0xffff);
209 }
211 inline void setSubstitution(int value) {
212 substitution_ = value;
213 }
215 inline void statistics() {
216 presolveActions_ |= 0x80000000;
217 }
219 int presolveStatus() const;
220
229 virtual void postsolve(bool updateStatus = true);
230
232 void destroyPresolve();
233
235 private:
237 ClpSimplex * originalModel_;
238
240 ClpSimplex * presolvedModel_;
246 double nonLinearValue_;
248 int * originalColumn_;
250 int * originalRow_;
252 double * rowObjective_;
254 const CoinPresolveAction *paction_;
255
261 int ncols_;
262 int nrows_;
263 CoinBigIndex nelems_;
265 int numberPasses_;
267 int substitution_;
268 #ifndef CLP_NO_STD
269 std::string saveFile_;
271 #endif
272
276 int presolveActions_;
277 protected:
281 virtual const CoinPresolveAction *presolve(CoinPresolveMatrix *prob);
282
288 virtual void postsolve(CoinPostsolveMatrix &prob);
290 virtual ClpSimplex * gutsOfPresolvedModel(ClpSimplex * originalModel,
291 double feasibilityTolerance,
292 bool keepIntegers,
293 int numberPasses,
294 bool dropNames,
295 bool doRowObjective,
296 const char * prohibitedRows=NULL,
297 const char * prohibitedColumns=NULL);
298 };
299 #endif
CoinBigIndex
int CoinBigIndex
Definition: Coin_C_defines.h:105
ClpPresolve::setZeroSmall
void setZeroSmall(int value)
This version saves data in a file.
Definition: ClpPresolve.hpp:199
ClpPresolve::setSubstitution
void setSubstitution(int value)
Substitution level.
Definition: ClpPresolve.hpp:211
ClpPresolve::substitution_
int substitution_
Substitution level.
Definition: ClpPresolve.hpp:267
ClpPresolve::setDoGubrow
void setDoGubrow(bool doGubrow)
This version saves data in a file.
Definition: ClpPresolve.hpp:174
ClpPresolve::nelems_
CoinBigIndex nelems_
Original model - must not be destroyed before postsolve.
Definition: ClpPresolve.hpp:263
ClpPresolve::doSingletonColumn
bool doSingletonColumn() const
Whether we want to do singleton column part of presolve.
Definition: ClpPresolve.hpp:163
ClpPresolve::doTighten
bool doTighten() const
Whether we want to do tighten part of presolve.
Definition: ClpPresolve.hpp:115
CoinPostsolveMatrix
Augments CoinPrePostsolveMatrix with information about the problem that is only needed during postsol...
Definition: CoinPresolveMatrix.hpp:1421
CoinPresolveMatrix
Augments CoinPrePostsolveMatrix with information about the problem that is only needed during presolv...
Definition: CoinPresolveMatrix.hpp:835
ClpPresolve::doDupcol
bool doDupcol() const
Whether we want to do dupcol part of presolve.
Definition: ClpPresolve.hpp:139
ClpPresolve::originalColumns
const int * originalColumns() const
return pointer to original columns
ClpPresolve::nonLinearValue
double nonLinearValue() const
This version saves data in a file.
Definition: ClpPresolve.hpp:79
ClpPresolve::setOriginalModel
void setOriginalModel(ClpSimplex *model)
Set pointer to original model.
ClpPresolve::presolveStatus
int presolveStatus() const
Return presolve status (0,1,2)
ClpPresolve::ncols_
int ncols_
The postsolved problem will expand back to its former size as postsolve transformations are applied...
Definition: ClpPresolve.hpp:261
ClpPresolve::originalRow_
int * originalRow_
Original row numbers.
Definition: ClpPresolve.hpp:250
ClpPresolve::setDoForcing
void setDoForcing(bool doForcing)
This version saves data in a file.
Definition: ClpPresolve.hpp:126
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.
ClpSimplex.hpp
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::setDoDoubleton
void setDoDoubleton(bool doDoubleton)
This version saves data in a file.
Definition: ClpPresolve.hpp:102
ClpPresolve::setDoDependency
void setDoDependency(bool doDependency)
This version saves data in a file.
Definition: ClpPresolve.hpp:158
ClpPresolve::postsolve
virtual void postsolve(bool updateStatus=true)
Gets rid of presolve actions (e.g.when infeasible)
ClpPresolve::paction_
const CoinPresolveAction * paction_
The list of transformations applied.
Definition: ClpPresolve.hpp:254
ClpPresolve::doTripleton
bool doTripleton() const
Whether we want to do tripleton part of presolve.
Definition: ClpPresolve.hpp:107
ClpPresolve::numberPasses_
int numberPasses_
Number of major passes.
Definition: ClpPresolve.hpp:265
ClpPresolve::saveFile_
std::string saveFile_
Name of saved model file.
Definition: ClpPresolve.hpp:270
ClpPresolve::presolveActions_
int presolveActions_
Whether we want to skip dual part of presolve etc.
Definition: ClpPresolve.hpp:276
ClpPresolve::originalRows
const int * originalRows() const
return pointer to original rows
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::doDuprow
bool doDuprow() const
Whether we want to do duprow part of presolve.
Definition: ClpPresolve.hpp:147
ClpPresolve::setDoIntersection
void setDoIntersection(bool doIntersection)
This version saves data in a file.
Definition: ClpPresolve.hpp:190
ClpPresolve::ClpPresolve
ClpPresolve()
Default constructor.
ClpPresolve::model
ClpSimplex * model() const
Return pointer to presolved model, Up to user to destroy.
ClpPresolve
This is the Clp interface to CoinPresolve.
Definition: ClpPresolve.hpp:15
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:246
ClpPresolve::setDoDual
void setDoDual(bool doDual)
This version saves data in a file.
Definition: ClpPresolve.hpp:86
ClpPresolve::setDoSingleton
void setDoSingleton(bool doSingleton)
This version saves data in a file.
Definition: ClpPresolve.hpp:94
ClpPresolve::presolveActions
int presolveActions() const
Set whole group.
Definition: ClpPresolve.hpp:204
ClpPresolve::originalColumn_
int * originalColumn_
Original column numbers.
Definition: ClpPresolve.hpp:248
CoinPresolveAction
Abstract base class of all presolve routines.
Definition: CoinPresolveMatrix.hpp:155
ClpPresolve::doDoubleton
bool doDoubleton() const
Whether we want to do doubleton part of presolve.
Definition: ClpPresolve.hpp:99
ClpPresolve::destroyPresolve
void destroyPresolve()
Gets rid of presolve actions (e.g.when infeasible)
ClpPresolve::setDoTripleton
void setDoTripleton(bool doTripleton)
This version saves data in a file.
Definition: ClpPresolve.hpp:110
ClpSimplex
This solves LPs using the simplex method.
Definition: ClpSimplex.hpp:70
CoinPresolveMatrix.hpp
ClpPresolve::doForcing
bool doForcing() const
Whether we want to do forcing part of presolve.
Definition: ClpPresolve.hpp:123
ClpPresolve::setDoImpliedFree
void setDoImpliedFree(bool doImpliedfree)
This version saves data in a file.
Definition: ClpPresolve.hpp:134
ClpPresolve::doGubrow
bool doGubrow() const
Whether we want to do gubrow part of presolve.
Definition: ClpPresolve.hpp:171
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:196
ClpPresolve::setPresolveActions
void setPresolveActions(int action)
This version saves data in a file.
Definition: ClpPresolve.hpp:207
ClpPresolve::doSingleton
bool doSingleton() const
Whether we want to do singleton part of presolve.
Definition: ClpPresolve.hpp:91
ClpPresolve::setDoDupcol
void setDoDupcol(bool doDupcol)
This version saves data in a file.
Definition: ClpPresolve.hpp:142
ClpPresolve::doIntersection
bool doIntersection() const
Whether we want to allow duplicate intersections.
Definition: ClpPresolve.hpp:187
ClpPresolve::originalModel
ClpSimplex * originalModel() const
Return pointer to original model.
ClpPresolve::doTwoxTwo
bool doTwoxTwo() const
Whether we want to do twoxtwo part of presolve.
Definition: ClpPresolve.hpp:179
ClpPresolve::presolvedModel_
ClpSimplex * presolvedModel_
ClpPresolved model - up to user to destroy by deleteClpPresolvedModel.
Definition: ClpPresolve.hpp:240
ClpPresolve::rowObjective_
double * rowObjective_
Row objective.
Definition: ClpPresolve.hpp:252
ClpPresolve::statistics
void statistics()
Asks for statistics.
Definition: ClpPresolve.hpp:215
ClpPresolve::doDual
bool doDual() const
Whether we want to do dual part of presolve.
Definition: ClpPresolve.hpp:83
ClpPresolve::setDoSingletonColumn
void setDoSingletonColumn(bool doSingleton)
This version saves data in a file.
Definition: ClpPresolve.hpp:166
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)
This version saves data in a file.
ClpPresolve::doDependency
bool doDependency() const
Whether we want to do dependency part of presolve.
Definition: ClpPresolve.hpp:155
ClpPresolve::setDoTighten
void setDoTighten(bool doTighten)
This version saves data in a file.
Definition: ClpPresolve.hpp:118
ClpPresolve::setDoDuprow
void setDoDuprow(bool doDuprow)
This version saves data in a file.
Definition: ClpPresolve.hpp:150
ClpPresolve::originalModel_
ClpSimplex * originalModel_
Original model - must not be destroyed before postsolve.
Definition: ClpPresolve.hpp:237
ClpPresolve::nrows_
int nrows_
Original model - must not be destroyed before postsolve.
Definition: ClpPresolve.hpp:262
ClpPresolve::~ClpPresolve
virtual ~ClpPresolve()
Virtual destructor.
ClpPresolve::doImpliedFree
bool doImpliedFree() const
Whether we want to do impliedfree part of presolve.
Definition: ClpPresolve.hpp:131
ClpPresolve::setDoTwoxtwo
void setDoTwoxtwo(bool doTwoxTwo)
This version saves data in a file.
Definition: ClpPresolve.hpp:182