/usr/include/coin/ClpPresolve.hpp is in coinor-libclp-dev 1.15.5-1ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | /* $Id: ClpPresolve.hpp 1928 2013-04-06 12:54:16Z stefan $ */
// Copyright (C) 2002, International Business Machines
// Corporation and others. All Rights Reserved.
// This code is licensed under the terms of the Eclipse Public License (EPL).
#ifndef ClpPresolve_H
#define ClpPresolve_H
#include "ClpSimplex.hpp"
class CoinPresolveAction;
#include "CoinPresolveMatrix.hpp"
/** This is the Clp interface to CoinPresolve
*/
class ClpPresolve {
public:
/**@name Main Constructor, destructor */
//@{
/// Default constructor
ClpPresolve();
/// Virtual destructor
virtual ~ClpPresolve();
//@}
/**@name presolve - presolves a model, transforming the model
* and saving information in the ClpPresolve object needed for postsolving.
* This underlying (protected) method is virtual; the idea is that in the future,
* one could override this method to customize how the various
* presolve techniques are applied.
This version of presolve returns a pointer to a new presolved
model. NULL if infeasible or unbounded.
This should be paired with postsolve
below. The advantage of going back to original model is that it
will be exactly as it was i.e. 0.0 will not become 1.0e-19.
If keepIntegers is true then bounds may be tightened in
original. Bounds will be moved by up to feasibilityTolerance
to try and stay feasible.
Names will be dropped in presolved model if asked
*/
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);
#ifndef CLP_NO_STD
/** This version saves data in a file. The passed in model
is updated to be presolved model.
Returns non-zero if infeasible*/
int presolvedModelToFile(ClpSimplex &si, std::string fileName,
double feasibilityTolerance = 0.0,
bool keepIntegers = true,
int numberPasses = 5,
bool dropNames = false,
bool doRowObjective = false);
#endif
/** Return pointer to presolved model,
Up to user to destroy */
ClpSimplex * model() const;
/// Return pointer to original model
ClpSimplex * originalModel() const;
/// Set pointer to original model
void setOriginalModel(ClpSimplex * model);
/// return pointer to original columns
const int * originalColumns() const;
/// return pointer to original rows
const int * originalRows() const;
/** "Magic" number. If this is non-zero then any elements with this value
may change and so presolve is very limited in what can be done
to the row and column. This is for non-linear problems.
*/
inline void setNonLinearValue(double value) {
nonLinearValue_ = value;
}
inline double nonLinearValue() const {
return nonLinearValue_;
}
/// Whether we want to do dual part of presolve
inline bool doDual() const {
return (presolveActions_ & 1) == 0;
}
inline void setDoDual(bool doDual) {
if (doDual) presolveActions_ &= ~1;
else presolveActions_ |= 1;
}
/// Whether we want to do singleton part of presolve
inline bool doSingleton() const {
return (presolveActions_ & 2) == 0;
}
inline void setDoSingleton(bool doSingleton) {
if (doSingleton) presolveActions_ &= ~2;
else presolveActions_ |= 2;
}
/// Whether we want to do doubleton part of presolve
inline bool doDoubleton() const {
return (presolveActions_ & 4) == 0;
}
inline void setDoDoubleton(bool doDoubleton) {
if (doDoubleton) presolveActions_ &= ~4;
else presolveActions_ |= 4;
}
/// Whether we want to do tripleton part of presolve
inline bool doTripleton() const {
return (presolveActions_ & 8) == 0;
}
inline void setDoTripleton(bool doTripleton) {
if (doTripleton) presolveActions_ &= ~8;
else presolveActions_ |= 8;
}
/// Whether we want to do tighten part of presolve
inline bool doTighten() const {
return (presolveActions_ & 16) == 0;
}
inline void setDoTighten(bool doTighten) {
if (doTighten) presolveActions_ &= ~16;
else presolveActions_ |= 16;
}
/// Whether we want to do forcing part of presolve
inline bool doForcing() const {
return (presolveActions_ & 32) == 0;
}
inline void setDoForcing(bool doForcing) {
if (doForcing) presolveActions_ &= ~32;
else presolveActions_ |= 32;
}
/// Whether we want to do impliedfree part of presolve
inline bool doImpliedFree() const {
return (presolveActions_ & 64) == 0;
}
inline void setDoImpliedFree(bool doImpliedfree) {
if (doImpliedfree) presolveActions_ &= ~64;
else presolveActions_ |= 64;
}
/// Whether we want to do dupcol part of presolve
inline bool doDupcol() const {
return (presolveActions_ & 128) == 0;
}
inline void setDoDupcol(bool doDupcol) {
if (doDupcol) presolveActions_ &= ~128;
else presolveActions_ |= 128;
}
/// Whether we want to do duprow part of presolve
inline bool doDuprow() const {
return (presolveActions_ & 256) == 0;
}
inline void setDoDuprow(bool doDuprow) {
if (doDuprow) presolveActions_ &= ~256;
else presolveActions_ |= 256;
}
/// Whether we want to do singleton column part of presolve
inline bool doSingletonColumn() const {
return (presolveActions_ & 512) == 0;
}
inline void setDoSingletonColumn(bool doSingleton) {
if (doSingleton) presolveActions_ &= ~512;
else presolveActions_ |= 512;
}
/// Whether we want to do gubrow part of presolve
inline bool doGubrow() const {
return (presolveActions_ & 1024) == 0;
}
inline void setDoGubrow(bool doGubrow) {
if (doGubrow) presolveActions_ &= ~1024;
else presolveActions_ |= 1024;
}
/// Whether we want to do twoxtwo part of presolve
inline bool doTwoxTwo() const {
return (presolveActions_ & 2048) != 0;
}
inline void setDoTwoxtwo(bool doTwoxTwo) {
if (!doTwoxTwo) presolveActions_ &= ~2048;
else presolveActions_ |= 2048;
}
/// Set whole group
inline int presolveActions() const {
return presolveActions_ & 0xffff;
}
inline void setPresolveActions(int action) {
presolveActions_ = (presolveActions_ & 0xffff0000) | (action & 0xffff);
}
/// Substitution level
inline void setSubstitution(int value) {
substitution_ = value;
}
/// Asks for statistics
inline void statistics() {
presolveActions_ |= 0x80000000;
}
/// Return presolve status (0,1,2)
int presolveStatus() const;
/**@name postsolve - postsolve the problem. If the problem
has not been solved to optimality, there are no guarantees.
If you are using an algorithm like simplex that has a concept
of "basic" rows/cols, then set updateStatus
Note that if you modified the original problem after presolving,
then you must ``undo'' these modifications before calling postsolve.
This version updates original*/
virtual void postsolve(bool updateStatus = true);
/// Gets rid of presolve actions (e.g.when infeasible)
void destroyPresolve();
/**@name private or protected data */
private:
/// Original model - must not be destroyed before postsolve
ClpSimplex * originalModel_;
/// ClpPresolved model - up to user to destroy by deleteClpPresolvedModel
ClpSimplex * presolvedModel_;
/** "Magic" number. If this is non-zero then any elements with this value
may change and so presolve is very limited in what can be done
to the row and column. This is for non-linear problems.
One could also allow for cases where sign of coefficient is known.
*/
double nonLinearValue_;
/// Original column numbers
int * originalColumn_;
/// Original row numbers
int * originalRow_;
/// Row objective
double * rowObjective_;
/// The list of transformations applied.
const CoinPresolveAction *paction_;
/// The postsolved problem will expand back to its former size
/// as postsolve transformations are applied.
/// It is efficient to allocate data structures for the final size
/// of the problem rather than expand them as needed.
/// These fields give the size of the original problem.
int ncols_;
int nrows_;
CoinBigIndex nelems_;
/// Number of major passes
int numberPasses_;
/// Substitution level
int substitution_;
#ifndef CLP_NO_STD
/// Name of saved model file
std::string saveFile_;
#endif
/** Whether we want to skip dual part of presolve etc.
512 bit allows duplicate column processing on integer columns
and dual stuff on integers
*/
int presolveActions_;
protected:
/// If you want to apply the individual presolve routines differently,
/// or perhaps add your own to the mix,
/// define a derived class and override this method
virtual const CoinPresolveAction *presolve(CoinPresolveMatrix *prob);
/// Postsolving is pretty generic; just apply the transformations
/// in reverse order.
/// You will probably only be interested in overriding this method
/// if you want to add code to test for consistency
/// while debugging new presolve techniques.
virtual void postsolve(CoinPostsolveMatrix &prob);
/** This is main part of Presolve */
virtual ClpSimplex * gutsOfPresolvedModel(ClpSimplex * originalModel,
double feasibilityTolerance,
bool keepIntegers,
int numberPasses,
bool dropNames,
bool doRowObjective,
const char * prohibitedRows=NULL,
const char * prohibitedColumns=NULL);
};
#endif
|