• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

/build/buildd/coinutils-2.6.4/CoinUtils/src/CoinSnapshot.hpp

Go to the documentation of this file.
00001 /* $Id: CoinSnapshot.hpp 1191 2009-07-25 08:38:12Z forrest $ */
00002 // Copyright (C) 2006, International Business Machines
00003 // Corporation and others.  All Rights Reserved.
00004 #ifndef CoinSnapshot_H
00005 #define CoinSnapshot_H
00006 
00007 class CoinPackedMatrix;
00008 #include "CoinFinite.hpp"
00009 
00010 //#############################################################################
00011 
00023 class CoinSnapshot  {
00024   
00025 public:
00026   
00027   //---------------------------------------------------------------------------
00033 
00034   inline int getNumCols() const
00035   { return numCols_;}
00036   
00038   inline int getNumRows() const
00039   { return numRows_;}
00040   
00042   inline int getNumElements() const
00043   { return numElements_;}
00044   
00046   inline int getNumIntegers() const
00047   { return numIntegers_;}
00048   
00050   inline const double * getColLower() const
00051   { return colLower_;}
00052   
00054   inline const double * getColUpper() const
00055   { return colUpper_;}
00056   
00058   inline const double * getRowLower() const
00059   { return rowLower_;}
00060   
00062   inline const double * getRowUpper() const
00063   { return rowUpper_;}
00064   
00072   inline const double * getRightHandSide() const
00073   { return rightHandSide_;}
00074 
00076   inline const double * getObjCoefficients() const
00077   { return objCoefficients_;}
00078   
00080   inline double getObjSense() const
00081   { return objSense_;}
00082   
00084   inline bool isContinuous(int colIndex) const
00085   { return colType_[colIndex]=='C';}
00086   
00088   inline bool isBinary(int colIndex) const
00089   { return colType_[colIndex]=='B';}
00090   
00092   inline bool isInteger(int colIndex) const
00093   { return colType_[colIndex]=='B'||colType_[colIndex]=='I';}
00094   
00096   inline bool isIntegerNonBinary(int colIndex) const
00097   { return colType_[colIndex]=='I';}
00098   
00100   inline bool isFreeBinary(int colIndex) const
00101   { return colType_[colIndex]=='B'&&colUpper_[colIndex]>colLower_[colIndex];}
00102 
00104   inline const char * getColType() const
00105   { return colType_;}
00106   
00108   inline const CoinPackedMatrix * getMatrixByRow() const
00109   { return matrixByRow_;}
00110   
00112   inline const CoinPackedMatrix * getMatrixByCol() const
00113   { return matrixByCol_;}
00114   
00116   inline const CoinPackedMatrix * getOriginalMatrixByRow() const
00117   { return originalMatrixByRow_;}
00118   
00120   inline const CoinPackedMatrix * getOriginalMatrixByCol() const
00121   { return originalMatrixByCol_;}
00123   
00126 
00127   inline const double * getColSolution() const
00128   { return colSolution_;}
00129   
00131   inline const double * getRowPrice() const
00132   { return rowPrice_;}
00133   
00135   inline const double * getReducedCost() const
00136   { return reducedCost_;}
00137   
00139   inline const double * getRowActivity() const
00140   { return rowActivity_;}
00141   
00143   inline const double * getDoNotSeparateThis() const
00144   { return doNotSeparateThis_;}
00146   
00149 
00150   inline double getInfinity() const
00151   { return infinity_;}
00152   
00155   inline double getObjValue() const
00156   { return objValue_;}
00157 
00159   inline double getObjOffset() const
00160   { return objOffset_;}
00161 
00163   inline double getDualTolerance() const
00164   { return dualTolerance_;}
00165 
00167   inline double getPrimalTolerance() const
00168   { return primalTolerance_;}
00169 
00171   inline double getIntegerTolerance() const
00172   { return integerTolerance_;}
00173 
00175   inline double getIntegerUpperBound() const
00176   { return integerUpperBound_;}
00177 
00179   inline double getIntegerLowerBound() const
00180   { return integerLowerBound_;}
00182   
00183   //---------------------------------------------------------------------------
00184   
00199   void loadProblem(const CoinPackedMatrix& matrix,
00200                    const double* collb, const double* colub,   
00201                    const double* obj,
00202                    const double* rowlb, const double* rowub,
00203                    bool makeRowCopy=false);
00204   
00206   
00207   //---------------------------------------------------------------------------
00208   
00211 
00212   inline void setNumCols(int value)
00213   { numCols_ = value;}
00214   
00216   inline void setNumRows(int value)
00217   { numRows_ = value;}
00218   
00220   inline void setNumElements(int value)
00221   { numElements_ = value;}
00222   
00224   inline void setNumIntegers(int value)
00225   { numIntegers_ = value;}
00226   
00228   void setColLower(const double * array, bool copyIn=true);
00229   
00231   void setColUpper(const double * array, bool copyIn=true);
00232   
00234   void setRowLower(const double * array, bool copyIn=true);
00235   
00237   void setRowUpper(const double * array, bool copyIn=true);
00238   
00246   void setRightHandSide(const double * array, bool copyIn=true);
00247 
00256   void createRightHandSide();
00257 
00259   void setObjCoefficients(const double * array, bool copyIn=true);
00260   
00262   inline void setObjSense(double value)
00263   { objSense_ = value;}
00264   
00266   void setColType(const char *array, bool copyIn=true);
00267   
00269   void setMatrixByRow(const CoinPackedMatrix * matrix, bool copyIn=true);
00270   
00272   void createMatrixByRow();
00273   
00275   void setMatrixByCol(const CoinPackedMatrix * matrix, bool copyIn=true);
00276   
00278   void setOriginalMatrixByRow(const CoinPackedMatrix * matrix, bool copyIn=true);
00279   
00281   void setOriginalMatrixByCol(const CoinPackedMatrix * matrix, bool copyIn=true);
00282 
00284   void setColSolution(const double * array, bool copyIn=true);
00285   
00287   void setRowPrice(const double * array, bool copyIn=true);
00288   
00290   void setReducedCost(const double * array, bool copyIn=true);
00291   
00293   void setRowActivity(const double * array, bool copyIn=true);
00294   
00296   void setDoNotSeparateThis(const double * array, bool copyIn=true);
00297 
00299   inline void setInfinity(double value)
00300   { infinity_ = value;}
00301   
00303   inline void setObjValue(double value)
00304   { objValue_ = value;}
00305 
00307   inline void setObjOffset(double value)
00308   { objOffset_ = value;}
00309 
00311   inline void setDualTolerance(double value)
00312   { dualTolerance_ = value;}
00313 
00315   inline void setPrimalTolerance(double value)
00316   { primalTolerance_ = value;}
00317 
00319   inline void setIntegerTolerance(double value)
00320   { integerTolerance_ = value;}
00321 
00323   inline void setIntegerUpperBound(double value)
00324   { integerUpperBound_ = value;}
00325 
00327   inline void setIntegerLowerBound(double value)
00328   { integerLowerBound_ = value;}
00330   
00331   //---------------------------------------------------------------------------
00332   
00334 
00335 
00336   CoinSnapshot(); 
00337     
00339   CoinSnapshot(const CoinSnapshot &);
00340   
00342   CoinSnapshot & operator=(const CoinSnapshot& rhs);
00343   
00345   virtual ~CoinSnapshot ();
00346   
00348 
00349 private:
00351 
00352 
00358   void gutsOfDestructor(int type);
00360   void gutsOfCopy(const CoinSnapshot & rhs);
00362 
00364 
00366   double objSense_;
00367   
00369   double infinity_;
00370   
00372   double objValue_;
00373 
00375   double objOffset_;
00376 
00378   double dualTolerance_;
00379 
00381   double primalTolerance_;
00382 
00384   double integerTolerance_;
00385 
00387   double integerUpperBound_;
00388 
00390   double integerLowerBound_;
00391 
00393   const double * colLower_;
00394   
00396   const double * colUpper_;
00397   
00399   const double * rowLower_;
00400   
00402   const double * rowUpper_;
00403   
00405   const double * rightHandSide_;
00406   
00408   const double * objCoefficients_;
00409   
00411   const char * colType_;
00412   
00414   const CoinPackedMatrix * matrixByRow_;
00415   
00417   const CoinPackedMatrix * matrixByCol_;
00418   
00420   const CoinPackedMatrix * originalMatrixByRow_;
00421   
00423   const CoinPackedMatrix * originalMatrixByCol_;
00424 
00426   const double * colSolution_;
00427   
00429   const double * rowPrice_;
00430   
00432   const double * reducedCost_;
00433   
00435   const double * rowActivity_;
00436   
00438   const double * doNotSeparateThis_;
00439 
00441   int numCols_;
00442   
00444   int numRows_;
00445   
00447   int numElements_;
00448   
00450   int numIntegers_;
00451 
00453     typedef struct {
00454       unsigned int colLower:1;
00455       unsigned int colUpper:1;
00456       unsigned int rowLower:1;
00457       unsigned int rowUpper:1;
00458       unsigned int rightHandSide:1;
00459       unsigned int objCoefficients:1;
00460       unsigned int colType:1;
00461       unsigned int matrixByRow:1;
00462       unsigned int matrixByCol:1;
00463       unsigned int originalMatrixByRow:1;
00464       unsigned int originalMatrixByCol:1;
00465       unsigned int colSolution:1;
00466       unsigned int rowPrice:1;
00467       unsigned int reducedCost:1;
00468       unsigned int rowActivity:1;
00469       unsigned int doNotSeparateThis:1;
00470   } coinOwned;
00471   coinOwned owned_;
00473 };  
00474 #endif

Generated on Fri Oct 15 2010 18:21:02 by  doxygen 1.7.1