CoinDenseFactorization.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef CoinDenseFactorization_H
00014 #define CoinDenseFactorization_H
00015
00016 #include <iostream>
00017 #include <string>
00018 #include <cassert>
00019 #include "CoinTypes.hpp"
00020 #include "CoinIndexedVector.hpp"
00021 #include "CoinFactorization.hpp"
00022 #if COIN_FACTORIZATION_DENSE_CODE == 2
00023 #undef COIN_FACTORIZATION_DENSE_CODE
00024 #endif
00025 class CoinPackedMatrix;
00027 class CoinOtherFactorization {
00028
00029 public:
00030
00033
00034 CoinOtherFactorization ( );
00036 CoinOtherFactorization ( const CoinOtherFactorization &other);
00037
00039 virtual ~CoinOtherFactorization ( );
00041 CoinOtherFactorization & operator = ( const CoinOtherFactorization & other );
00042
00044 virtual CoinOtherFactorization * clone() const = 0;
00046
00049
00050 inline int status ( ) const {
00051 return status_;
00052 }
00054 inline void setStatus ( int value)
00055 { status_=value; }
00057 inline int pivots ( ) const {
00058 return numberPivots_;
00059 }
00061 inline void setPivots ( int value )
00062 { numberPivots_=value; }
00064 inline void setNumberRows(int value)
00065 { numberRows_ = value; }
00067 inline int numberRows ( ) const {
00068 return numberRows_;
00069 }
00071 inline int numberColumns ( ) const {
00072 return numberColumns_;
00073 }
00075 inline int numberGoodColumns ( ) const {
00076 return numberGoodU_;
00077 }
00079 inline void relaxAccuracyCheck(double value)
00080 { relaxCheck_ = value;}
00081 inline double getAccuracyCheck() const
00082 { return relaxCheck_;}
00084 inline int maximumPivots ( ) const {
00085 return maximumPivots_ ;
00086 }
00088 virtual void maximumPivots ( int value );
00089
00091 inline double pivotTolerance ( ) const {
00092 return pivotTolerance_ ;
00093 }
00094 void pivotTolerance ( double value );
00096 inline double zeroTolerance ( ) const {
00097 return zeroTolerance_ ;
00098 }
00099 void zeroTolerance ( double value );
00100 #ifndef COIN_FAST_CODE
00102 inline double slackValue ( ) const {
00103 return slackValue_ ;
00104 }
00105 void slackValue ( double value );
00106 #endif
00108 virtual CoinFactorizationDouble * elements() const;
00110 virtual int * pivotRow() const;
00112 virtual CoinFactorizationDouble * workArea() const;
00114 virtual int * intWorkArea() const;
00116 virtual int * numberInRow() const;
00118 virtual int * numberInColumn() const;
00120 virtual CoinBigIndex * starts() const;
00122 virtual int * permuteBack() const;
00123
00127 inline int solveMode() const
00128 { return solveMode_ ;}
00133 inline void setSolveMode(int value)
00134 { solveMode_ = value;}
00136 virtual bool wantsTableauColumn() const;
00141 virtual void setUsefulInformation(const int * info,int whereFrom);
00143 virtual void clearArrays() {}
00145
00147
00148 virtual int * indices() const = 0;
00150 virtual int * permute() const = 0;
00152 virtual int numberElements ( ) const = 0;
00154
00156
00157 virtual void getAreas ( int numberRows,
00158 int numberColumns,
00159 CoinBigIndex maximumL,
00160 CoinBigIndex maximumU ) = 0;
00161
00163 virtual void preProcess ( ) = 0;
00169 virtual int factor ( ) = 0;
00171 virtual void postProcess(const int * sequence, int * pivotVariable) = 0;
00173 virtual void makeNonSingular(int * sequence, int numberColumns) = 0;
00175
00178
00186 virtual int replaceColumn ( CoinIndexedVector * regionSparse,
00187 int pivotRow,
00188 double pivotCheck ,
00189 bool checkBeforeModifying=false,
00190 double acceptablePivot=1.0e-8)=0;
00192
00202 virtual int updateColumnFT ( CoinIndexedVector * regionSparse,
00203 CoinIndexedVector * regionSparse2,
00204 bool noPermute=false) = 0;
00207 virtual int updateColumn ( CoinIndexedVector * regionSparse,
00208 CoinIndexedVector * regionSparse2,
00209 bool noPermute=false) const = 0;
00211 virtual int updateTwoColumnsFT(CoinIndexedVector * regionSparse1,
00212 CoinIndexedVector * regionSparse2,
00213 CoinIndexedVector * regionSparse3,
00214 bool noPermute=false) = 0;
00219 virtual int updateColumnTranspose ( CoinIndexedVector * regionSparse,
00220 CoinIndexedVector * regionSparse2) const = 0;
00222
00224 protected:
00225
00228
00229 double pivotTolerance_;
00231 double zeroTolerance_;
00232 #ifndef COIN_FAST_CODE
00234 double slackValue_;
00235 #else
00236 #ifndef slackValue_
00237 #define slackValue_ -1.0
00238 #endif
00239 #endif
00241 double relaxCheck_;
00243 CoinBigIndex factorElements_;
00245 int numberRows_;
00247 int numberColumns_;
00249 int numberGoodU_;
00251 int maximumPivots_;
00253 int numberPivots_;
00255 int status_;
00257 int maximumRows_;
00259 CoinBigIndex maximumSpace_;
00261 int * pivotRow_;
00262
00266 CoinFactorizationDouble * elements_;
00268 CoinFactorizationDouble * workArea_;
00273 int solveMode_;
00275 };
00285 class CoinDenseFactorization : public CoinOtherFactorization {
00286 friend void CoinDenseFactorizationUnitTest( const std::string & mpsDir );
00287
00288 public:
00289
00292
00293 CoinDenseFactorization ( );
00295 CoinDenseFactorization ( const CoinDenseFactorization &other);
00296
00298 virtual ~CoinDenseFactorization ( );
00300 CoinDenseFactorization & operator = ( const CoinDenseFactorization & other );
00302 virtual CoinOtherFactorization * clone() const ;
00304
00307
00308 virtual void getAreas ( int numberRows,
00309 int numberColumns,
00310 CoinBigIndex maximumL,
00311 CoinBigIndex maximumU );
00312
00314 virtual void preProcess ( );
00320 virtual int factor ( );
00322 virtual void postProcess(const int * sequence, int * pivotVariable);
00324 virtual void makeNonSingular(int * sequence, int numberColumns);
00326
00329
00330 virtual inline int numberElements ( ) const {
00331 return numberRows_*(numberColumns_+numberPivots_);
00332 }
00334 double maximumCoefficient() const;
00336
00339
00347 virtual int replaceColumn ( CoinIndexedVector * regionSparse,
00348 int pivotRow,
00349 double pivotCheck ,
00350 bool checkBeforeModifying=false,
00351 double acceptablePivot=1.0e-8);
00353
00363 virtual inline int updateColumnFT ( CoinIndexedVector * regionSparse,
00364 CoinIndexedVector * regionSparse2,
00365 bool = false)
00366 { return updateColumn(regionSparse,regionSparse2);}
00369 virtual int updateColumn ( CoinIndexedVector * regionSparse,
00370 CoinIndexedVector * regionSparse2,
00371 bool noPermute=false) const;
00373 virtual int updateTwoColumnsFT(CoinIndexedVector * regionSparse1,
00374 CoinIndexedVector * regionSparse2,
00375 CoinIndexedVector * regionSparse3,
00376 bool noPermute=false);
00381 virtual int updateColumnTranspose ( CoinIndexedVector * regionSparse,
00382 CoinIndexedVector * regionSparse2) const;
00384
00385
00389
00390 inline void clearArrays()
00391 { gutsOfDestructor();}
00393 virtual inline int * indices() const
00394 { return reinterpret_cast<int *> (elements_+numberRows_*numberRows_);}
00396 virtual inline int * permute() const
00397 { return NULL;;}
00399
00401 void gutsOfDestructor();
00403 void gutsOfInitialize();
00405 void gutsOfCopy(const CoinDenseFactorization &other);
00406
00408 protected:
00411 int checkPivot(double saveFromU, double oldPivot) const;
00413 protected:
00414
00417
00418 };
00419 #endif