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;}
00120 inline double slackValue ( ) const {
00121 return slackValue_ ;
00122 }
00123 void slackValue ( double value );
00125 double maximumCoefficient() const;
00127
00130
00138 int replaceColumn ( CoinIndexedVector * regionSparse,
00139 int pivotRow,
00140 double pivotCheck ,
00141 bool checkBeforeModifying=false);
00143
00153 inline int updateColumnFT ( CoinIndexedVector * regionSparse,
00154 CoinIndexedVector * regionSparse2)
00155 { return updateColumn(regionSparse,regionSparse2);}
00158 int updateColumn ( CoinIndexedVector * regionSparse,
00159 CoinIndexedVector * regionSparse2,
00160 bool noPermute=false) const;
00165 int updateColumnTranspose ( CoinIndexedVector * regionSparse,
00166 CoinIndexedVector * regionSparse2) const;
00168
00169
00173
00174 inline void clearArrays()
00175 { gutsOfDestructor();}
00177 inline double * elements() const
00178 { return elements_;}
00180 inline int * indices() const
00181 { return (int *) (elements_+numberRows_*numberRows_);}
00183 inline CoinBigIndex * starts() const
00184 { return (CoinBigIndex *) pivotRow_;}
00186 inline int * pivotRow() const
00187 { return pivotRow_;}
00189 inline int * permute() const
00190 { return pivotRow_;}
00192 inline int * permuteBack() const
00193 { return pivotRow_+numberRows_;}
00195 inline double * workArea() const
00196 { return workArea_;}
00198 inline int * intWorkArea() const
00199 { return (int *) workArea_;}
00201
00203 void gutsOfDestructor();
00205 void gutsOfInitialize();
00207 void gutsOfCopy(const CoinDenseFactorization &other);
00208
00210 protected:
00213 int checkPivot(double saveFromU, double oldPivot) const;
00215 protected:
00216
00219
00220 double pivotTolerance_;
00222 double zeroTolerance_;
00224 double slackValue_;
00226 double relaxCheck_;
00228 int numberRows_;
00230 int numberColumns_;
00232 int maximumRows_;
00234 CoinBigIndex maximumSpace_;
00236 int numberGoodU_;
00238 int maximumPivots_;
00240 int numberPivots_;
00242 CoinBigIndex factorElements_;
00244 int * pivotRow_;
00246 int status_;
00251 double * elements_;
00253 double * workArea_;
00255 };
00256 #endif