00001
00002
00003 #ifndef CoinSnapshot_H
00004 #define CoinSnapshot_H
00005
00006 class CoinPackedMatrix;
00007 #include "CoinFinite.hpp"
00008
00009
00010
00022 class CoinSnapshot {
00023
00024 public:
00025
00026
00032
00033 inline int getNumCols() const
00034 { return numCols_;}
00035
00037 inline int getNumRows() const
00038 { return numRows_;}
00039
00041 inline int getNumElements() const
00042 { return numElements_;}
00043
00045 inline int getNumIntegers() const
00046 { return numIntegers_;}
00047
00049 inline const double * getColLower() const
00050 { return colLower_;}
00051
00053 inline const double * getColUpper() const
00054 { return colUpper_;}
00055
00057 inline const double * getRowLower() const
00058 { return rowLower_;}
00059
00061 inline const double * getRowUpper() const
00062 { return rowUpper_;}
00063
00071 inline const double * getRightHandSide() const
00072 { return rightHandSide_;}
00073
00075 inline const double * getObjCoefficients() const
00076 { return objCoefficients_;}
00077
00079 inline double getObjSense() const
00080 { return objSense_;}
00081
00083 inline bool isContinuous(int colIndex) const
00084 { return colType_[colIndex]=='C';}
00085
00087 inline bool isBinary(int colIndex) const
00088 { return colType_[colIndex]=='B';}
00089
00091 inline bool isInteger(int colIndex) const
00092 { return colType_[colIndex]=='B'||colType_[colIndex]=='I';}
00093
00095 inline bool isIntegerNonBinary(int colIndex) const
00096 { return colType_[colIndex]=='I';}
00097
00099 inline bool isFreeBinary(int colIndex) const
00100 { return colType_[colIndex]=='B'&&colUpper_[colIndex]>colLower_[colIndex];}
00101
00103 inline const char * getColType() const
00104 { return colType_;}
00105
00107 inline const CoinPackedMatrix * getMatrixByRow() const
00108 { return matrixByRow_;}
00109
00111 inline const CoinPackedMatrix * getMatrixByCol() const
00112 { return matrixByCol_;}
00113
00115 inline const CoinPackedMatrix * getOriginalMatrixByRow() const
00116 { return originalMatrixByRow_;}
00117
00119 inline const CoinPackedMatrix * getOriginalMatrixByCol() const
00120 { return originalMatrixByCol_;}
00122
00125
00126 inline const double * getColSolution() const
00127 { return colSolution_;}
00128
00130 inline const double * getRowPrice() const
00131 { return rowPrice_;}
00132
00134 inline const double * getReducedCost() const
00135 { return reducedCost_;}
00136
00138 inline const double * getRowActivity() const
00139 { return rowActivity_;}
00140
00142 inline const double * getDoNotSeparateThis() const
00143 { return doNotSeparateThis_;}
00145
00148
00149 inline double getInfinity() const
00150 { return infinity_;}
00151
00154 inline double getObjValue() const
00155 { return objValue_;}
00156
00158 inline double getObjOffset() const
00159 { return objOffset_;}
00160
00162 inline double getDualTolerance() const
00163 { return dualTolerance_;}
00164
00166 inline double getPrimalTolerance() const
00167 { return primalTolerance_;}
00168
00170 inline double getIntegerTolerance() const
00171 { return integerTolerance_;}
00172
00174 inline double getIntegerUpperBound() const
00175 { return integerUpperBound_;}
00176
00178 inline double getIntegerLowerBound() const
00179 { return integerLowerBound_;}
00181
00182
00183
00198 void loadProblem(const CoinPackedMatrix& matrix,
00199 const double* collb, const double* colub,
00200 const double* obj,
00201 const double* rowlb, const double* rowub,
00202 bool makeRowCopy=false);
00203
00205
00206
00207
00210
00211 inline void setNumCols(int value)
00212 { numCols_ = value;}
00213
00215 inline void setNumRows(int value)
00216 { numRows_ = value;}
00217
00219 inline void setNumElements(int value)
00220 { numElements_ = value;}
00221
00223 inline void setNumIntegers(int value)
00224 { numIntegers_ = value;}
00225
00227 void setColLower(const double * array, bool copyIn=true);
00228
00230 void setColUpper(const double * array, bool copyIn=true);
00231
00233 void setRowLower(const double * array, bool copyIn=true);
00234
00236 void setRowUpper(const double * array, bool copyIn=true);
00237
00245 void setRightHandSide(const double * array, bool copyIn=true);
00246
00255 void createRightHandSide();
00256
00258 void setObjCoefficients(const double * array, bool copyIn=true);
00259
00261 inline void setObjSense(double value)
00262 { objSense_ = value;}
00263
00265 void setColType(const char *array, bool copyIn=true);
00266
00268 void setMatrixByRow(const CoinPackedMatrix * matrix, bool copyIn=true);
00269
00271 void createMatrixByRow();
00272
00274 void setMatrixByCol(const CoinPackedMatrix * matrix, bool copyIn=true);
00275
00277 void setOriginalMatrixByRow(const CoinPackedMatrix * matrix, bool copyIn=true);
00278
00280 void setOriginalMatrixByCol(const CoinPackedMatrix * matrix, bool copyIn=true);
00281
00283 void setColSolution(const double * array, bool copyIn=true);
00284
00286 void setRowPrice(const double * array, bool copyIn=true);
00287
00289 void setReducedCost(const double * array, bool copyIn=true);
00290
00292 void setRowActivity(const double * array, bool copyIn=true);
00293
00295 void setDoNotSeparateThis(const double * array, bool copyIn=true);
00296
00298 inline void setInfinity(double value)
00299 { infinity_ = value;}
00300
00302 inline void setObjValue(double value)
00303 { objValue_ = value;}
00304
00306 inline void setObjOffset(double value)
00307 { objOffset_ = value;}
00308
00310 inline void setDualTolerance(double value)
00311 { dualTolerance_ = value;}
00312
00314 inline void setPrimalTolerance(double value)
00315 { primalTolerance_ = value;}
00316
00318 inline void setIntegerTolerance(double value)
00319 { integerTolerance_ = value;}
00320
00322 inline void setIntegerUpperBound(double value)
00323 { integerUpperBound_ = value;}
00324
00326 inline void setIntegerLowerBound(double value)
00327 { integerLowerBound_ = value;}
00329
00330
00331
00333
00334
00335 CoinSnapshot();
00336
00338 CoinSnapshot(const CoinSnapshot &);
00339
00341 CoinSnapshot & operator=(const CoinSnapshot& rhs);
00342
00344 virtual ~CoinSnapshot ();
00345
00347
00348 private:
00350
00351
00357 void gutsOfDestructor(int type);
00359 void gutsOfCopy(const CoinSnapshot & rhs);
00361
00363
00365 double objSense_;
00366
00368 double infinity_;
00369
00371 double objValue_;
00372
00374 double objOffset_;
00375
00377 double dualTolerance_;
00378
00380 double primalTolerance_;
00381
00383 double integerTolerance_;
00384
00386 double integerUpperBound_;
00387
00389 double integerLowerBound_;
00390
00392 const double * colLower_;
00393
00395 const double * colUpper_;
00396
00398 const double * rowLower_;
00399
00401 const double * rowUpper_;
00402
00404 const double * rightHandSide_;
00405
00407 const double * objCoefficients_;
00408
00410 const char * colType_;
00411
00413 const CoinPackedMatrix * matrixByRow_;
00414
00416 const CoinPackedMatrix * matrixByCol_;
00417
00419 const CoinPackedMatrix * originalMatrixByRow_;
00420
00422 const CoinPackedMatrix * originalMatrixByCol_;
00423
00425 const double * colSolution_;
00426
00428 const double * rowPrice_;
00429
00431 const double * reducedCost_;
00432
00434 const double * rowActivity_;
00435
00437 const double * doNotSeparateThis_;
00438
00440 int numCols_;
00441
00443 int numRows_;
00444
00446 int numElements_;
00447
00449 int numIntegers_;
00450
00452 typedef struct {
00453 unsigned int colLower:1;
00454 unsigned int colUpper:1;
00455 unsigned int rowLower:1;
00456 unsigned int rowUpper:1;
00457 unsigned int rightHandSide:1;
00458 unsigned int objCoefficients:1;
00459 unsigned int colType:1;
00460 unsigned int matrixByRow:1;
00461 unsigned int matrixByCol:1;
00462 unsigned int originalMatrixByRow:1;
00463 unsigned int originalMatrixByCol:1;
00464 unsigned int colSolution:1;
00465 unsigned int rowPrice:1;
00466 unsigned int reducedCost:1;
00467 unsigned int rowActivity:1;
00468 unsigned int doNotSeparateThis:1;
00469 } coinOwned;
00470 coinOwned owned_;
00472 };
00473 #endif