Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef CoinDenseFactorization_H
00012 #define CoinDenseFactorization_H
00013
00014 #include <iostream>
00015 #include <string>
00016 #include <cassert>
00017 #include "CoinFinite.hpp"
00018 #include "CoinIndexedVector.hpp"
00019 #include "CoinFactorization.hpp"
00020 class CoinPackedMatrix;
00022 class CoinOtherFactorization {
00023
00024 public:
00025
00028
00029 CoinOtherFactorization ( );
00031 CoinOtherFactorization ( const CoinOtherFactorization &other);
00032
00034 virtual ~CoinOtherFactorization ( );
00036 CoinOtherFactorization & operator = ( const CoinOtherFactorization & other );
00037
00039 virtual CoinOtherFactorization * clone() const = 0;
00041
00044
00045 inline int status ( ) const {
00046 return status_;
00047 }
00049 inline void setStatus ( int value)
00050 { status_=value; }
00052 inline int pivots ( ) const {
00053 return numberPivots_;
00054 }
00056 inline void setPivots ( int value )
00057 { numberPivots_=value; }
00059 inline void setNumberRows(int value)
00060 { numberRows_ = value; }
00062 inline int numberRows ( ) const {
00063 return numberRows_;
00064 }
00066 inline int numberColumns ( ) const {
00067 return numberColumns_;
00068 }
00070 inline int numberGoodColumns ( ) const {
00071 return numberGoodU_;
00072 }
00074 inline void relaxAccuracyCheck(double value)
00075 { relaxCheck_ = value;}
00076 inline double getAccuracyCheck() const
00077 { return relaxCheck_;}
00079 inline int maximumPivots ( ) const {
00080 return maximumPivots_ ;
00081 }
00083 virtual void maximumPivots ( int value );
00084
00086 inline double pivotTolerance ( ) const {
00087 return pivotTolerance_ ;
00088 }
00089 void pivotTolerance ( double value );
00091 inline double zeroTolerance ( ) const {
00092 return zeroTolerance_ ;
00093 }
00094 void zeroTolerance ( double value );
00095 #ifndef COIN_FAST_CODE
00096
00097 inline double slackValue ( ) const {
00098 return slackValue_ ;
00099 }
00100 void slackValue ( double value );
00101 #endif
00102
00103 virtual CoinFactorizationDouble * elements() const;
00105 virtual int * pivotRow() const;
00107 virtual CoinFactorizationDouble * workArea() const;
00109 virtual int * intWorkArea() const;
00111 virtual int * numberInRow() const;
00113 virtual int * numberInColumn() const;
00115 virtual CoinBigIndex * starts() const;
00117 virtual int * permuteBack() const;
00122 inline int solveMode() const
00123 { return solveMode_ ;}
00128 inline void setSolveMode(int value)
00129 { solveMode_ = value;}
00131 virtual bool wantsTableauColumn() const;
00136 virtual void setUsefulInformation(const int * info,int whereFrom);
00138 virtual void clearArrays() {}
00140
00142
00143 virtual int * indices() const = 0;
00145 virtual int * permute() const = 0;
00147 virtual int numberElements ( ) const = 0;
00149
00151
00152 virtual void getAreas ( int numberRows,
00153 int numberColumns,
00154 CoinBigIndex maximumL,
00155 CoinBigIndex maximumU ) = 0;
00156
00158 virtual void preProcess ( ) = 0;
00164 virtual int factor ( ) = 0;
00166 virtual void postProcess(const int * sequence, int * pivotVariable) = 0;
00168 virtual void makeNonSingular(int * sequence, int numberColumns) = 0;
00170
00173
00181 virtual int replaceColumn ( CoinIndexedVector * regionSparse,
00182 int pivotRow,
00183 double pivotCheck ,
00184 bool checkBeforeModifying=false,
00185 double acceptablePivot=1.0e-8)=0;
00187
00197 virtual int updateColumnFT ( CoinIndexedVector * regionSparse,
00198 CoinIndexedVector * regionSparse2,
00199 bool noPermute=false) = 0;
00202 virtual int updateColumn ( CoinIndexedVector * regionSparse,
00203 CoinIndexedVector * regionSparse2,
00204 bool noPermute=false) const = 0;
00206 virtual int updateTwoColumnsFT(CoinIndexedVector * regionSparse1,
00207 CoinIndexedVector * regionSparse2,
00208 CoinIndexedVector * regionSparse3,
00209 bool noPermute=false) = 0;
00214 virtual int updateColumnTranspose ( CoinIndexedVector * regionSparse,
00215 CoinIndexedVector * regionSparse2) const = 0;
00217
00219 protected:
00220
00223
00224 double pivotTolerance_;
00226 double zeroTolerance_;
00227 #ifndef COIN_FAST_CODE
00228
00229 double slackValue_;
00230 #else
00231 #ifndef slackValue_
00232 #define slackValue_ -1.0
00233 #endif
00234 #endif
00235
00236 double relaxCheck_;
00238 CoinBigIndex factorElements_;
00240 int numberRows_;
00242 int numberColumns_;
00244 int numberGoodU_;
00246 int maximumPivots_;
00248 int numberPivots_;
00250 int status_;
00252 int maximumRows_;
00254 CoinBigIndex maximumSpace_;
00256 int * pivotRow_;
00261 CoinFactorizationDouble * elements_;
00263 CoinFactorizationDouble * workArea_;
00268 int solveMode_;
00270 };
00280 class CoinDenseFactorization : public CoinOtherFactorization {
00281 friend void CoinDenseFactorizationUnitTest( const std::string & mpsDir );
00282
00283 public:
00284
00287
00288 CoinDenseFactorization ( );
00290 CoinDenseFactorization ( const CoinDenseFactorization &other);
00291
00293 virtual ~CoinDenseFactorization ( );
00295 CoinDenseFactorization & operator = ( const CoinDenseFactorization & other );
00297 virtual CoinOtherFactorization * clone() const ;
00299
00302
00303 virtual void getAreas ( int numberRows,
00304 int numberColumns,
00305 CoinBigIndex maximumL,
00306 CoinBigIndex maximumU );
00307
00309 virtual void preProcess ( );
00315 virtual int factor ( );
00317 virtual void postProcess(const int * sequence, int * pivotVariable);
00319 virtual void makeNonSingular(int * sequence, int numberColumns);
00321
00324
00325 virtual inline int numberElements ( ) const {
00326 return numberRows_*(numberColumns_+numberPivots_);
00327 }
00329 double maximumCoefficient() const;
00331
00334
00342 virtual int replaceColumn ( CoinIndexedVector * regionSparse,
00343 int pivotRow,
00344 double pivotCheck ,
00345 bool checkBeforeModifying=false,
00346 double acceptablePivot=1.0e-8);
00348
00358 virtual inline int updateColumnFT ( CoinIndexedVector * regionSparse,
00359 CoinIndexedVector * regionSparse2,
00360 bool = false)
00361 { return updateColumn(regionSparse,regionSparse2);}
00364 virtual int updateColumn ( CoinIndexedVector * regionSparse,
00365 CoinIndexedVector * regionSparse2,
00366 bool noPermute=false) const;
00368 virtual int updateTwoColumnsFT(CoinIndexedVector * regionSparse1,
00369 CoinIndexedVector * regionSparse2,
00370 CoinIndexedVector * regionSparse3,
00371 bool noPermute=false);
00376 virtual int updateColumnTranspose ( CoinIndexedVector * regionSparse,
00377 CoinIndexedVector * regionSparse2) const;
00379
00380
00384
00385 inline void clearArrays()
00386 { gutsOfDestructor();}
00388 virtual inline int * indices() const
00389 { return reinterpret_cast<int *> (elements_+numberRows_*numberRows_);}
00391 virtual inline int * permute() const
00392 { return NULL;;}
00394
00396 void gutsOfDestructor();
00398 void gutsOfInitialize();
00400 void gutsOfCopy(const CoinDenseFactorization &other);
00401
00403 protected:
00406 int checkPivot(double saveFromU, double oldPivot) const;
00408 protected:
00409
00412
00413 };
00414 #endif