00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef CoinDenseFactorization_H
00011 #define CoinDenseFactorization_H
00012
00013 #include <iostream>
00014 #include <string>
00015 #include <cassert>
00016 #include "CoinFinite.hpp"
00017 #include "CoinIndexedVector.hpp"
00018 class CoinPackedMatrix;
00028 class CoinDenseFactorization {
00029 friend void CoinDenseFactorizationUnitTest( const std::string & mpsDir );
00030
00031 public:
00032
00035
00036 CoinDenseFactorization ( );
00038 CoinDenseFactorization ( const CoinDenseFactorization &other);
00039
00041 ~CoinDenseFactorization ( );
00043 CoinDenseFactorization & operator = ( const CoinDenseFactorization & other );
00045
00048
00049 void getAreas ( int numberRows,
00050 int numberColumns,
00051 CoinBigIndex maximumL,
00052 CoinBigIndex maximumU );
00053
00055 void preProcess ( );
00061 int factor ( );
00063 void postProcess(const int * sequence, int * pivotVariable);
00065 void makeNonSingular(int * sequence, int numberColumns);
00067
00070
00071 inline int status ( ) const {
00072 return status_;
00073 }
00075 inline void setStatus ( int value)
00076 { status_=value; }
00078 inline int pivots ( ) const {
00079 return numberPivots_;
00080 }
00082 inline int numberRows ( ) const {
00083 return numberRows_;
00084 }
00086 inline int numberColumns ( ) const {
00087 return numberColumns_;
00088 }
00090 inline int numberElements ( ) const {
00091 return numberRows_*(numberColumns_+numberPivots_);
00092 }
00094 inline int numberGoodColumns ( ) const {
00095 return numberGoodU_;
00096 }
00098 inline void relaxAccuracyCheck(double value)
00099 { relaxCheck_ = value;}
00100 inline double getAccuracyCheck() const
00101 { return relaxCheck_;}
00103 inline int maximumPivots ( ) const {
00104 return maximumPivots_ ;
00105 }
00106 void maximumPivots ( int value );
00107
00109 inline double pivotTolerance ( ) const {
00110 return pivotTolerance_ ;
00111 }
00112 void pivotTolerance ( double value );
00114 inline double zeroTolerance ( ) const {
00115 return zeroTolerance_ ;
00116 }
00117 inline void zeroTolerance ( double value )
00118 { zeroTolerance_ = value;}
00119 #ifndef COIN_FAST_CODE
00121 inline double slackValue ( ) const {
00122 return slackValue_ ;
00123 }
00124 void slackValue ( double value );
00125 #endif
00127 double maximumCoefficient() const;
00128
00129
00132
00140 int replaceColumn ( CoinIndexedVector * regionSparse,
00141 int pivotRow,
00142 double pivotCheck ,
00143 bool checkBeforeModifying=false);
00145
00155 inline int updateColumnFT ( CoinIndexedVector * regionSparse,
00156 CoinIndexedVector * regionSparse2)
00157 { return updateColumn(regionSparse,regionSparse2);}
00160 int updateColumn ( CoinIndexedVector * regionSparse,
00161 CoinIndexedVector * regionSparse2,
00162 bool noPermute=false) const;
00167 int updateColumnTranspose ( CoinIndexedVector * regionSparse,
00168 CoinIndexedVector * regionSparse2) const;
00170
00171
00175
00176 inline void clearArrays()
00177 { gutsOfDestructor();}
00179 inline double * elements() const
00180 { return elements_;}
00182 inline int * indices() const
00183 { return (int *) (elements_+numberRows_*numberRows_);}
00185 inline CoinBigIndex * starts() const
00186 { return (CoinBigIndex *) pivotRow_;}
00188 inline int * pivotRow() const
00189 { return pivotRow_;}
00191 inline int * permute() const
00192 { return NULL;;}
00194 inline int * permuteBack() const
00195 { return pivotRow_+numberRows_;}
00197 inline double * workArea() const
00198 { return workArea_;}
00200 inline int * intWorkArea() const
00201 { return (int *) workArea_;}
00203
00205 void gutsOfDestructor();
00207 void gutsOfInitialize();
00209 void gutsOfCopy(const CoinDenseFactorization &other);
00210
00212 protected:
00215 int checkPivot(double saveFromU, double oldPivot) const;
00217 protected:
00218
00221
00222 double pivotTolerance_;
00224 double zeroTolerance_;
00225 #ifndef COIN_FAST_CODE
00227 double slackValue_;
00228 #else
00229 #ifndef slackValue_
00230 #define slackValue_ -1.0
00231 #endif
00232 #endif
00234 double relaxCheck_;
00236 int numberRows_;
00238 int numberColumns_;
00240 int maximumRows_;
00242 CoinBigIndex maximumSpace_;
00244 int numberGoodU_;
00246 int maximumPivots_;
00248 int numberPivots_;
00250 CoinBigIndex factorElements_;
00252 int * pivotRow_;
00254 int status_;
00255
00259 double * elements_;
00261 double * workArea_;
00263 };
00264 #endif