- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# /home/coin/SVN-release/Bcps-0.91.0/CoinUtils/src/CoinDenseFactorization.hpp

Go to the documentation of this file.

    00001 // Copyright (C) 2008, International Business Machines
    00002 // Corporation and others.  All Rights Reserved.
    00003
    00004 /*
    00005    Authors
    00006
    00007    John Forrest
    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 #include "CoinFactorization.hpp"
    00019 class CoinPackedMatrix;
    00021 class CoinSmallFactorization {
    00022
    00023 public:
    00024
    00027
    00028   CoinSmallFactorization (  );
    00030   CoinSmallFactorization ( const CoinSmallFactorization &other);
    00031
    00033   virtual ~CoinSmallFactorization (  );
    00035   CoinSmallFactorization & operator = ( const CoinSmallFactorization & other );
    00036
    00038   virtual CoinSmallFactorization * clone() const = 0;
    00040
    00043
    00044   inline int status (  ) const {
    00045     return status_;
    00046   }
    00048   inline void setStatus (  int value)
    00049   {  status_=value;  }
    00051   inline int pivots (  ) const {
    00052     return numberPivots_;
    00053   }
    00055   inline void setPivots (  int value )
    00056   { numberPivots_=value; }
    00058   inline void setNumberRows(int value)
    00059   { numberRows_ = value; }
    00061   inline int numberRows (  ) const {
    00062     return numberRows_;
    00063   }
    00065   inline int numberColumns (  ) const {
    00066     return numberColumns_;
    00067   }
    00069   inline int numberGoodColumns (  ) const {
    00070     return numberGoodU_;
    00071   }
    00073   inline void relaxAccuracyCheck(double value)
    00074   { relaxCheck_ = value;}
    00075   inline double getAccuracyCheck() const
    00076   { return relaxCheck_;}
    00078   inline int maximumPivots (  ) const {
    00079     return maximumPivots_ ;
    00080   }
    00082   void maximumPivots (  int value );
    00083
    00085   inline double pivotTolerance (  ) const {
    00086     return pivotTolerance_ ;
    00087   }
    00088   void pivotTolerance (  double value );
    00090   inline double zeroTolerance (  ) const {
    00091     return zeroTolerance_ ;
    00092   }
    00093   void zeroTolerance (  double value );
    00094 #ifndef COIN_FAST_CODE
    00096   inline double slackValue (  ) const {
    00097     return slackValue_ ;
    00098   }
    00099   void slackValue (  double value );
    00100 #endif
    00102   inline CoinFactorizationDouble * elements() const
    00103   { return elements_;}
    00105   inline int * pivotRow() const
    00106   { return pivotRow_;}
    00108   inline CoinFactorizationDouble * workArea() const
    00109   { return workArea_;}
    00111   inline int * intWorkArea() const
    00112   { return reinterpret_cast<int *> (workArea_);}
    00114   inline CoinBigIndex * starts() const
    00115   { return reinterpret_cast<CoinBigIndex *> (pivotRow_);}
    00117   inline int * permuteBack() const
    00118   { return pivotRow_+numberRows_;}
    00120   inline int solveMode() const
    00121   { return solveMode_ ;}
    00123   inline void setSolveMode(int value)
    00124   { solveMode_ = value;}
    00126
    00128
    00129   virtual int * indices() const  = 0;
    00131   virtual int * permute() const = 0;
    00133   virtual int numberElements (  ) const = 0;
    00135
    00137
    00138   virtual void getAreas ( int numberRows,
    00139                   int numberColumns,
    00140                   CoinBigIndex maximumL,
    00141                   CoinBigIndex maximumU ) = 0;
    00142
    00144   virtual void preProcess ( ) = 0;
    00150   virtual int factor ( ) = 0;
    00152   virtual void postProcess(const int * sequence, int * pivotVariable) = 0;
    00154   virtual void makeNonSingular(int * sequence, int numberColumns) = 0;
    00156
    00159
    00167   virtual int replaceColumn ( CoinIndexedVector * regionSparse,
    00168                       int pivotRow,
    00169                       double pivotCheck ,
    00170                       bool checkBeforeModifying=false) = 0;
    00172
    00182   virtual int updateColumnFT ( CoinIndexedVector * regionSparse,
    00183                                CoinIndexedVector * regionSparse2,
    00184                                bool noPermute=false) = 0;
    00187   virtual int updateColumn ( CoinIndexedVector * regionSparse,
    00188                      CoinIndexedVector * regionSparse2,
    00189                      bool noPermute=false) const = 0;
    00191     virtual int updateTwoColumnsFT(CoinIndexedVector * regionSparse1,
    00192                            CoinIndexedVector * regionSparse2,
    00193                            CoinIndexedVector * regionSparse3,
    00194                            bool noPermute=false) = 0;
    00199   virtual int updateColumnTranspose ( CoinIndexedVector * regionSparse,
    00200                               CoinIndexedVector * regionSparse2) const = 0;
    00202
    00204 protected:
    00205
    00208
    00209   double pivotTolerance_;
    00211   double zeroTolerance_;
    00212 #ifndef COIN_FAST_CODE
    00214   double slackValue_;
    00215 #else
    00216 #ifndef slackValue_
    00217 #define slackValue_ -1.0
    00218 #endif
    00219 #endif
    00221   double relaxCheck_;
    00223   CoinBigIndex factorElements_;
    00225   int numberRows_;
    00227   int numberColumns_;
    00229   int numberGoodU_;
    00231   int maximumPivots_;
    00233   int numberPivots_;
    00235   int status_;
    00237   int maximumRows_;
    00239   CoinBigIndex maximumSpace_;
    00241   int * pivotRow_;
    00242
    00246   CoinFactorizationDouble * elements_;
    00248   CoinFactorizationDouble * workArea_;
    00250   int solveMode_;
    00252 };
    00262 class CoinDenseFactorization : public CoinSmallFactorization {
    00263    friend void CoinDenseFactorizationUnitTest( const std::string & mpsDir );
    00264
    00265 public:
    00266
    00269
    00270   CoinDenseFactorization (  );
    00272   CoinDenseFactorization ( const CoinDenseFactorization &other);
    00273
    00275   virtual ~CoinDenseFactorization (  );
    00277   CoinDenseFactorization & operator = ( const CoinDenseFactorization & other );
    00279   virtual CoinSmallFactorization * clone() const ;
    00281
    00284
    00285   virtual void getAreas ( int numberRows,
    00286                   int numberColumns,
    00287                   CoinBigIndex maximumL,
    00288                   CoinBigIndex maximumU );
    00289
    00291   virtual void preProcess ( );
    00297   virtual int factor ( );
    00299   virtual void postProcess(const int * sequence, int * pivotVariable);
    00301   virtual void makeNonSingular(int * sequence, int numberColumns);
    00303
    00306
    00307   virtual inline int numberElements (  ) const {
    00308     return numberRows_*(numberColumns_+numberPivots_);
    00309   }
    00311   double maximumCoefficient() const;
    00313
    00316
    00324   virtual int replaceColumn ( CoinIndexedVector * regionSparse,
    00325                       int pivotRow,
    00326                       double pivotCheck ,
    00327                       bool checkBeforeModifying=false);
    00329
    00339   virtual inline int updateColumnFT ( CoinIndexedVector * regionSparse,
    00340                                       CoinIndexedVector * regionSparse2,
    00341                                       bool noPermute=false)
    00342   { return updateColumn(regionSparse,regionSparse2);}
    00345   virtual int updateColumn ( CoinIndexedVector * regionSparse,
    00346                      CoinIndexedVector * regionSparse2,
    00347                      bool noPermute=false) const;
    00349     virtual int updateTwoColumnsFT(CoinIndexedVector * regionSparse1,
    00350                            CoinIndexedVector * regionSparse2,
    00351                            CoinIndexedVector * regionSparse3,
    00352                            bool noPermute=false);
    00357   virtual int updateColumnTranspose ( CoinIndexedVector * regionSparse,
    00358                               CoinIndexedVector * regionSparse2) const;
    00360
    00361
    00365
    00366   inline void clearArrays()
    00367   { gutsOfDestructor();}
    00369   virtual inline int * indices() const
    00370   { return reinterpret_cast<int *> (elements_+numberRows_*numberRows_);}
    00372   virtual inline int * permute() const
    00373   { return NULL;/*pivotRow_*/;}
    00375
    00377   void gutsOfDestructor();
    00379   void gutsOfInitialize();
    00381   void gutsOfCopy(const CoinDenseFactorization &other);
    00382
    00384 protected:
    00387   int checkPivot(double saveFromU, double oldPivot) const;
    00389 protected:
    00390
    00393
    00394 };
    00395 #endif