CoinAbcBaseFactorization.hpp

Go to the documentation of this file.
00001 /* $Id: CoinAbcBaseFactorization.hpp 1910 2013-01-27 02:00:13Z stefan $ */
00002 // Copyright (C) 2002, International Business Machines
00003 // Corporation and others, Copyright (C) 2012, FasterCoin.  All Rights Reserved.
00004 // This code is licensed under the terms of the Eclipse Public License (EPL).
00005 
00006 /* 
00007    Authors
00008    
00009    John Forrest
00010 
00011  */
00018 #include "AbcCommon.hpp"
00019 #include "CoinAbcHelperFunctions.hpp"
00020 #if ABC_PARALLEL
00021 #define FACTOR_CPU 4
00022 #else
00023 #define FACTOR_CPU 1
00024 #endif
00025 #define LARGE_SET COIN_INT_MAX-10
00026 #define LARGE_UNSET (LARGE_SET+1)
00027 
00028 class CoinAbcTypeFactorization  : public 
00029 CoinAbcAnyFactorization 
00030 {
00031    friend void CoinAbcFactorizationUnitTest( const std::string & mpsDir );
00032 
00033 public:
00034 
00037 
00038     CoinAbcTypeFactorization (  );
00040   CoinAbcTypeFactorization ( const CoinAbcTypeFactorization &other);
00042   CoinAbcTypeFactorization ( const CoinFactorization &other);
00043 
00045   virtual ~CoinAbcTypeFactorization (  );
00047   virtual CoinAbcAnyFactorization * clone() const ;
00049   void almostDestructor();
00051   void show_self (  ) const;
00053   void sort (  ) const;
00055     CoinAbcTypeFactorization & operator = ( const CoinAbcTypeFactorization & other );
00057 
00060 
00061   CoinSimplexDouble conditionNumber() const;
00062   
00064 
00067 
00068   inline CoinSimplexInt *permute (  ) const {
00069     return NULL; //permute_.array();
00070   }
00072   virtual inline CoinSimplexInt * indices() const
00073   { return indexRowU_.array();}
00075   virtual inline CoinSimplexInt *pivotColumn (  ) const {
00076     return pivotColumn_.array();
00077   }
00079   virtual inline CoinFactorizationDouble *pivotRegion (  ) const {
00080     return pivotRegionAddress_;
00081   }
00082 #if ABC_SMALL<2
00084   inline CoinBigIndex * startRowL() const
00085   { return startRowL_.array();}
00086 #endif
00087 
00089   inline CoinBigIndex * startColumnL() const
00090   { return startColumnL_.array();}
00091 
00092 #if ABC_SMALL<2
00094   inline CoinSimplexInt * indexColumnL() const
00095   { return indexColumnL_.array();}
00096 #endif
00097 
00099   inline CoinSimplexInt * indexRowL() const
00100   { return indexRowL_.array();}
00101 
00102 #if ABC_SMALL<2
00104   inline CoinFactorizationDouble * elementByRowL() const
00105   { return elementByRowL_.array();}
00106 #endif
00107 
00110   inline CoinSimplexInt * pivotLinkedBackwards() const
00111   { return firstCount_.array()+numberRows_+1;}
00112   inline CoinSimplexInt * pivotLinkedForwards() const
00113   { return firstCount_.array()+2*numberRows_+3;}
00114   inline CoinSimplexInt * pivotLOrder() const
00115   { return firstCount_.array();}
00116 #if ABC_SMALL<0
00117 #define ABC_USE_FUNCTION_POINTERS 0
00118 #define SMALL_PERMUTE
00119 #endif
00120 #ifdef ABC_USE_FUNCTION_POINTERS
00121   typedef void (*scatterUpdate) (int,CoinFactorizationDouble,const CoinFactorizationDouble *, CoinFactorizationDouble *);
00122 #if ABC_USE_FUNCTION_POINTERS
00123   typedef struct {
00124     scatterUpdate functionPointer;
00125     CoinBigIndex offset;
00126     int number;
00127   } scatterStruct;
00128 #else
00129   typedef struct {
00130     CoinBigIndex offset;
00131     int number;
00132   } scatterStruct;
00133 #endif
00135   inline scatterStruct * scatterUColumn() const
00136   { return scatterPointersUColumnAddress_;}
00137 #endif
00138 
00140 
00143   inline CoinSimplexInt * firstCount() const
00144   { return firstCount_.array();} 
00145 
00147   inline CoinSimplexInt * nextCount() const
00148   { return firstCount_.array()+numberRows_+2;} 
00149 
00151   inline CoinSimplexInt * lastCount() const
00152   { return firstCount_.array()+3*numberRows_+2;} 
00153 
00155   inline CoinSimplexInt numberRowsExtra (  ) const {
00156     return numberRowsExtra_;
00157   }
00159   inline CoinBigIndex numberL() const
00160   { return numberL_;}
00161 
00163   inline CoinBigIndex baseL() const
00164   { return baseL_;}
00166   inline CoinSimplexInt maximumRowsExtra (  ) const {
00167     return maximumRowsExtra_;
00168   }
00170   virtual inline CoinBigIndex numberElements (  ) const {
00171     return totalElements_;
00172   }
00174   inline CoinSimplexInt numberForrestTomlin (  ) const {
00175     return numberInColumn_.array()[numberRowsExtra_];
00176   }
00178   CoinSimplexDouble adjustedAreaFactor() const;
00180   inline CoinSimplexInt messageLevel (  ) const {
00181     return messageLevel_ ;
00182   }
00183   void messageLevel (  CoinSimplexInt value );
00185   virtual void maximumPivots (  CoinSimplexInt value );
00186 
00187 #if ABC_SMALL<4
00189   inline CoinSimplexInt denseThreshold() const 
00190     { return denseThreshold_;}
00192   inline void setDenseThreshold(CoinSimplexInt value)
00193     { denseThreshold_ = value;}
00194 #endif
00196   CoinSimplexDouble maximumCoefficient() const;
00197 #if 0
00199   inline bool forrestTomlin() const
00200   { return doForrestTomlin_;}
00201   inline void setForrestTomlin(bool value)
00202   { doForrestTomlin_=value;}
00203 #endif
00205   inline bool spaceForForrestTomlin() const
00206   {
00207     CoinBigIndex start = lastEntryByColumnU_;
00208     CoinBigIndex space = lengthAreaU_ - ( start + numberRowsExtra_ );
00209     return (space>=0); //&&doForrestTomlin_;
00210   }
00212 
00215 
00216 
00218   inline CoinBigIndex numberElementsU (  ) const {
00219     return lengthU_;
00220   }
00222   inline void setNumberElementsU(CoinBigIndex value)
00223   { lengthU_ = value; }
00225   inline CoinBigIndex lengthAreaU (  ) const {
00226     return lengthAreaU_;
00227   }
00229   inline CoinBigIndex numberElementsL (  ) const {
00230     return lengthL_;
00231   }
00233   inline CoinBigIndex lengthAreaL (  ) const {
00234     return lengthAreaL_;
00235   }
00237   inline CoinBigIndex numberElementsR (  ) const {
00238     return lengthR_;
00239   }
00241   inline CoinBigIndex numberCompressions() const
00242   { return numberCompressions_;}
00244   //virtual CoinSimplexInt * pivotRow() const;
00246   //virtual CoinFactorizationDouble * workArea() const;
00248   //virtual CoinSimplexInt * intWorkArea() const;
00250   virtual inline CoinBigIndex * starts() const
00251   { return startColumnU_.array();}
00253   virtual inline CoinSimplexInt * numberInRow() const
00254   { return numberInRow_.array();}
00256   virtual inline CoinSimplexInt * numberInColumn() const
00257   { return numberInColumn_.array();}
00259   virtual inline CoinFactorizationDouble * elements() const
00260   { return elementU_.array();}
00262   inline CoinBigIndex * startColumnR() const
00263   {return reinterpret_cast<CoinBigIndex *>(firstCount_.array()+3*numberRows_+4);}
00265   inline CoinFactorizationDouble * elementU() const
00266   { return elementU_.array();}
00268   inline CoinSimplexInt * indexRowU() const
00269   { return indexRowU_.array();}
00271   inline CoinBigIndex * startColumnU() const
00272   { return startColumnU_.array();}
00273 #if COIN_BIG_DOUBLE==1
00275   void toLongArray(CoinIndexedVector * vector,int which) const;
00277   void fromLongArray(CoinIndexedVector * vector) const;
00279   void fromLongArray(int which) const;
00281   long double * denseVector(CoinIndexedVector * vector) const;
00283   long double * denseVector(CoinIndexedVector & vector) const;
00285   const long double * denseVector(const CoinIndexedVector * vector) const;
00287   const long double * denseVector(const CoinIndexedVector & vector) const;
00289   void scan(CoinIndexedVector * vector) const;
00291   void clearHiddenArrays();
00292 #else
00294   inline double * denseVector(CoinIndexedVector * vector) const
00295   {return vector->denseVector();}
00296   inline double * denseVector(CoinIndexedVector & vector) const
00297   {return vector.denseVector();}
00299   inline const double * denseVector(const CoinIndexedVector * vector) const
00300   {return vector->denseVector();}
00301   inline const double * denseVector(const CoinIndexedVector & vector) const
00302   {return vector.denseVector();}
00304   inline void toLongArray(CoinIndexedVector * vector,int which) const {}
00306   inline void fromLongArray(CoinIndexedVector * vector) const {}
00308   inline void fromLongArray(int which) const {}
00310   inline void scan(CoinIndexedVector * vector) const
00311   {vector->scan(0,numberRows_,zeroTolerance_);}
00312 #endif
00313 #ifdef ABC_ORDERED_FACTORIZATION
00315   void permuteInForFtran(CoinIndexedVector & regionSparse,bool full=false) const ;
00317   void permuteInForBtranAndMultiply(CoinIndexedVector & regionSparse, bool full=false) const ;
00319   void permuteOutForBtran(CoinIndexedVector & regionSparse) const ;
00320 #endif
00321 
00326   //inline CoinSimplexInt persistenceFlag() const
00327   //{ return persistenceFlag_;}
00329 
00332 #if 0
00333 
00337   virtual int checkReplace ( const AbcSimplex * model,
00338                       CoinIndexedVector * regionSparse,
00339                       int pivotRow,
00340                       CoinSimplexDouble & pivotCheck,
00341                              double acceptablePivot = 1.0e-8);
00346   virtual CoinSimplexInt replaceColumn ( CoinIndexedVector * regionSparse,
00347                       CoinSimplexInt pivotRow,
00348                       CoinSimplexDouble pivotCheck ,
00349                       bool skipBtranU=false,
00350                       CoinSimplexDouble acceptablePivot=1.0e-8);
00351 #endif
00352 
00356   virtual 
00357 #ifdef ABC_LONG_FACTORIZATION 
00358   long
00359 #endif
00360   double checkReplacePart1 (  CoinIndexedVector * regionSparse,
00361                                      int pivotRow);
00366   virtual 
00367 #ifdef ABC_LONG_FACTORIZATION 
00368   long
00369 #endif
00370   double checkReplacePart1 (  CoinIndexedVector * regionSparse,
00371                                       CoinIndexedVector * partialUpdate,
00372                                      int pivotRow);
00373 #ifdef MOVE_REPLACE_PART1A
00374 
00378   virtual void checkReplacePart1a (  CoinIndexedVector * regionSparse,
00379                                      int pivotRow);
00380   virtual 
00381 #ifdef ABC_LONG_FACTORIZATION 
00382   long
00383 #endif
00384   double checkReplacePart1b (  CoinIndexedVector * regionSparse,
00385                                      int pivotRow);
00386 #endif
00387 
00389   virtual int checkReplacePart2 ( int pivotRow,
00390                                   CoinSimplexDouble btranAlpha, 
00391                                   double ftranAlpha, 
00392 #ifdef ABC_LONG_FACTORIZATION 
00393                                   long
00394 #endif
00395                                   double ftAlpha,
00396                                   double acceptablePivot = 1.0e-8);
00399   virtual void replaceColumnPart3 ( const AbcSimplex * model,
00400                       CoinIndexedVector * regionSparse,
00401                       CoinIndexedVector * tableauColumn,
00402                       int pivotRow,
00403 #ifdef ABC_LONG_FACTORIZATION 
00404                                     long
00405 #endif
00406                        double alpha );
00409   virtual void replaceColumnPart3 ( const AbcSimplex * model,
00410                                     CoinIndexedVector * regionSparse,
00411                                     CoinIndexedVector * tableauColumn,
00412                                     CoinIndexedVector * partialUpdate,
00413                                     int pivotRow,
00414 #ifdef ABC_LONG_FACTORIZATION 
00415                                   long
00416 #endif
00417                                     double alpha );
00418 #ifdef EARLY_FACTORIZE
00420   virtual int replaceColumns ( const AbcSimplex * model,
00421                                CoinIndexedVector & stuff,
00422                                int firstPivot,int lastPivot,bool cleanUp);
00423 #endif
00425   void updatePartialUpdate(CoinIndexedVector & partialUpdate);
00427   inline virtual bool wantsTableauColumn() const
00428   {return false;}
00432   int replaceColumnU ( CoinIndexedVector * regionSparse,
00433                        CoinBigIndex * deletedPosition,
00434                        CoinSimplexInt * deletedColumns,
00435                        CoinSimplexInt pivotRow);
00437 
00440 
00441 
00442 
00448   virtual CoinSimplexInt updateColumnFT ( CoinIndexedVector & regionSparse);
00449   virtual int updateColumnFTPart1 ( CoinIndexedVector & regionSparse) ;
00450   virtual void updateColumnFTPart2 ( CoinIndexedVector & regionSparse) ;
00454   virtual void updateColumnFT ( CoinIndexedVector & regionSparseFT,
00455                                 CoinIndexedVector & partialUpdate,
00456                                 int which);
00459   virtual CoinSimplexInt updateColumn ( CoinIndexedVector & regionSparse) const;
00465  virtual CoinSimplexInt updateTwoColumnsFT ( CoinIndexedVector & regionFT,
00466                                      CoinIndexedVector & regionOther);
00471   virtual CoinSimplexInt updateColumnTranspose ( CoinIndexedVector & regionSparse) const;
00473   virtual void updateFullColumn ( CoinIndexedVector & regionSparse) const;
00475   virtual void updateFullColumnTranspose ( CoinIndexedVector & regionSparse) const;
00477   virtual void updateWeights ( CoinIndexedVector & regionSparse) const;
00479   virtual void updateColumnCpu ( CoinIndexedVector & regionSparse,int whichCpu) const;
00481   virtual void updateColumnTransposeCpu ( CoinIndexedVector & regionSparse,int whichCpu) const;
00482   void unpack ( CoinIndexedVector * regionFrom,
00483                 CoinIndexedVector * regionTo) const;
00484   void pack ( CoinIndexedVector * regionFrom,
00485                 CoinIndexedVector * regionTo) const;
00487   inline void goSparse() {}
00488   void goSparse2();
00489 #ifndef NDEBUG
00490   virtual void checkMarkArrays() const;
00491 #endif
00492 #if ABC_SMALL<2
00493 
00494   inline CoinSimplexInt sparseThreshold ( ) const
00495   { return sparseThreshold_;}
00496 #endif
00497 
00498   void sparseThreshold ( CoinSimplexInt value );
00500 
00501 
00505 
00506   inline void clearArrays()
00507   { gutsOfDestructor();}
00509 
00510 
00511   void checkSparse();
00513   void gutsOfDestructor(CoinSimplexInt type=1);
00515   void gutsOfInitialize(CoinSimplexInt type);
00516   void gutsOfCopy(const CoinAbcTypeFactorization &other);
00517 
00519   void resetStatistics();
00520   void printRegion(const CoinIndexedVector & vector, const char * where) const;
00521 
00523 
00525 
00526   virtual void getAreas ( CoinSimplexInt numberRows,
00527                   CoinSimplexInt numberColumns,
00528                   CoinBigIndex maximumL,
00529                   CoinBigIndex maximumU );
00530 
00532   virtual void preProcess ( );
00533   void preProcess (CoinSimplexInt );
00535   double preProcess3 ( );
00536   void preProcess4 ( );
00538   virtual CoinSimplexInt factor (AbcSimplex * model);
00539 #ifdef EARLY_FACTORIZE
00541   virtual int factorize (AbcSimplex * model, CoinIndexedVector & stuff);
00542 #endif
00544   virtual void postProcess(const CoinSimplexInt * sequence, CoinSimplexInt * pivotVariable);
00546   virtual void makeNonSingular(CoinSimplexInt * sequence);
00547 protected:
00550   CoinSimplexInt factorSparse (  );
00553   CoinSimplexInt factorDense (  );
00554 
00556   bool pivotOneOtherRow ( CoinSimplexInt pivotRow,
00557                           CoinSimplexInt pivotColumn );
00559   bool pivotRowSingleton ( CoinSimplexInt pivotRow,
00560                            CoinSimplexInt pivotColumn );
00562   void pivotColumnSingleton ( CoinSimplexInt pivotRow,
00563                               CoinSimplexInt pivotColumn );
00565   void afterPivot( CoinSimplexInt pivotRow,
00566                               CoinSimplexInt pivotColumn );
00568   int wantToGoDense();
00569 
00574   bool getColumnSpace ( CoinSimplexInt iColumn,
00575                         CoinSimplexInt extraNeeded );
00576 
00579   bool reorderU();
00583   bool getColumnSpaceIterateR ( CoinSimplexInt iColumn, CoinFactorizationDouble value,
00584                                CoinSimplexInt iRow);
00590   CoinBigIndex getColumnSpaceIterate ( CoinSimplexInt iColumn, CoinFactorizationDouble value,
00591                                CoinSimplexInt iRow);
00595   bool getRowSpace ( CoinSimplexInt iRow, CoinSimplexInt extraNeeded );
00596 
00600   bool getRowSpaceIterate ( CoinSimplexInt iRow,
00601                             CoinSimplexInt extraNeeded );
00603   void checkConsistency (  );
00604 //#define CHECK_LINKS
00605 #ifdef CHECK_LINKS
00606   void checkLinks(int x=0);
00607 #else
00608 #  define checkLinks(x) 
00609 #endif
00611   inline void addLink ( CoinSimplexInt index, CoinSimplexInt count ) {
00612     CoinSimplexInt * COIN_RESTRICT nextCount = nextCountAddress_;
00613     CoinSimplexInt * COIN_RESTRICT firstCount = this->firstCount();
00614     CoinSimplexInt * COIN_RESTRICT lastCount = lastCountAddress_;
00615     CoinSimplexInt next = firstCount[count];
00616     firstCount[count] = index;
00617     nextCount[index] = next;
00618     lastCount[index] = count-numberRows_-2; // points to firstCount[count] 
00619     if (next>=0)
00620       lastCount[next] = index;
00621   }
00623   inline void deleteLink ( CoinSimplexInt index ) {
00624     CoinSimplexInt * COIN_RESTRICT nextCount = nextCountAddress_;
00625     CoinSimplexInt * COIN_RESTRICT lastCount = lastCountAddress_;
00626     CoinSimplexInt next = nextCount[index];
00627     CoinSimplexInt last = lastCount[index];
00628     assert (next!=index);
00629     assert (last!=index);
00630     if (next>=0)
00631       lastCount[next] = last;
00632     if (last>=0) {
00633       nextCount[last] = next;
00634     } else {
00635       int count=last+numberRows_+2;
00636       CoinSimplexInt * COIN_RESTRICT firstCount = this->firstCount();
00637       firstCount[count]=next;
00638     }
00639   }
00641   inline void modifyLink ( CoinSimplexInt index, CoinSimplexInt count ) {
00642     CoinSimplexInt * COIN_RESTRICT nextCount = nextCountAddress_;
00643     CoinSimplexInt * COIN_RESTRICT lastCount = lastCountAddress_;
00644     CoinSimplexInt * COIN_RESTRICT firstCount = this->firstCount();
00645     CoinSimplexInt next2 = firstCount[count];
00646     if (next2==index)
00647       return;
00648     firstCount[count] = index;
00649     CoinSimplexInt next = nextCount[index];
00650     CoinSimplexInt last = lastCount[index];
00651     assert (next!=index);
00652     assert (last!=index);
00653     nextCount[index] = next2;
00654     lastCount[index] = count-numberRows_-2; // points to firstCount[count] 
00655     if (next>=0)
00656       lastCount[next] = last;
00657     if (next2>=0)
00658       lastCount[next2] = index;
00659     if (last>=0) {
00660       nextCount[last] = next;
00661     } else {
00662       int count=last+numberRows_+2;
00663       firstCount[count]=next;
00664     }
00665   }
00667   void separateLinks();
00668   void separateLinks(CoinSimplexInt,CoinSimplexInt);
00670   void cleanup (  );
00672   void doAddresses();
00673 
00675   void updateColumnL ( CoinIndexedVector * region
00676 #if ABC_SMALL<2
00677                        , CoinAbcStatistics & statistics
00678 #endif
00679 #if ABC_PARALLEL
00680                        ,int whichSparse=0
00681 #endif
00682                        ) const;
00684   void updateColumnLDensish ( CoinIndexedVector * region ) const;
00686   void updateColumnLDense ( CoinIndexedVector * region ) const;
00688   void updateColumnLSparse ( CoinIndexedVector * region 
00689 #if ABC_PARALLEL
00690                              ,int whichSparse
00691 #endif
00692                              ) const;
00693 
00695   void updateColumnR ( CoinIndexedVector * region
00696 #if ABC_SMALL<2
00697                        , CoinAbcStatistics & statistics 
00698 #endif
00699 #if ABC_PARALLEL
00700                        ,int whichSparse=0
00701 #endif
00702                        ) const;
00704   bool storeFT(
00705 #if ABC_SMALL<3
00706                const 
00707 #endif
00708                CoinIndexedVector * regionFT);
00710   void updateColumnU ( CoinIndexedVector * region
00711 #if ABC_SMALL<2
00712                        , CoinAbcStatistics & statistics
00713 #endif
00714 #if ABC_PARALLEL
00715                        ,int whichSparse=0
00716 #endif
00717                        ) const;
00718 
00720   void updateColumnUSparse ( CoinIndexedVector * regionSparse
00721 #if ABC_PARALLEL
00722                              ,int whichSparse
00723 #endif
00724                              ) const;
00726   void updateColumnUDensish (  CoinIndexedVector * regionSparse) const;
00728   void updateColumnUDense (  CoinIndexedVector * regionSparse) const;
00730   void updateTwoColumnsUDensish (
00731                                  CoinSimplexInt & numberNonZero1,
00732                                  CoinFactorizationDouble * COIN_RESTRICT region1, 
00733                                  CoinSimplexInt * COIN_RESTRICT index1,
00734                                  CoinSimplexInt & numberNonZero2,
00735                                  CoinFactorizationDouble * COIN_RESTRICT region2, 
00736                                  CoinSimplexInt * COIN_RESTRICT index2) const;
00738   void updateColumnPFI ( CoinIndexedVector * regionSparse) const; 
00740   void updateColumnTransposePFI ( CoinIndexedVector * region) const;
00743   void updateColumnTransposeU ( CoinIndexedVector * region,
00744                                 CoinSimplexInt smallestIndex
00745 #if ABC_SMALL<2
00746                        , CoinAbcStatistics & statistics
00747 #endif
00748 #if ABC_PARALLEL
00749                   ,int whichCpu
00750 #endif
00751                                 ) const;
00754   void updateColumnTransposeUDensish ( CoinIndexedVector * region,
00755                                        CoinSimplexInt smallestIndex) const;
00758   void updateColumnTransposeUSparse ( CoinIndexedVector * region
00759 #if ABC_PARALLEL
00760                                                 ,int whichSparse
00761 #endif
00762                                       ) const;
00765   void updateColumnTransposeUByColumn ( CoinIndexedVector * region,
00766                                         CoinSimplexInt smallestIndex) const;
00767 
00769   void updateColumnTransposeR ( CoinIndexedVector * region 
00770 #if ABC_SMALL<2
00771                        , CoinAbcStatistics & statistics
00772 #endif
00773                                 ) const;
00775   void updateColumnTransposeRDensish ( CoinIndexedVector * region ) const;
00777   void updateColumnTransposeRSparse ( CoinIndexedVector * region ) const;
00778 
00780   void updateColumnTransposeL ( CoinIndexedVector * region 
00781 #if ABC_SMALL<2
00782                        , CoinAbcStatistics & statistics
00783 #endif
00784 #if ABC_PARALLEL
00785                                       ,int whichSparse
00786 #endif
00787                                 ) const;
00789   void updateColumnTransposeLDensish ( CoinIndexedVector * region ) const;
00791   void updateColumnTransposeLByRow ( CoinIndexedVector * region ) const;
00793   void updateColumnTransposeLSparse ( CoinIndexedVector * region 
00794 #if ABC_PARALLEL
00795                                                 ,int whichSparse
00796 #endif
00797                                       ) const;
00798 public:
00803   CoinSimplexInt replaceColumnPFI ( CoinIndexedVector * regionSparse,
00804                          CoinSimplexInt pivotRow, CoinSimplexDouble alpha);
00805 protected:
00808   CoinSimplexInt checkPivot(CoinSimplexDouble saveFromU, CoinSimplexDouble oldPivot) const;
00810   int pivot ( CoinSimplexInt pivotRow,
00811                CoinSimplexInt pivotColumn,
00812                CoinBigIndex pivotRowPosition,
00813                CoinBigIndex pivotColumnPosition,
00814                CoinFactorizationDouble * COIN_RESTRICT work,
00815                CoinSimplexUnsignedInt * COIN_RESTRICT workArea2,
00816                CoinSimplexInt increment2,
00817                int * COIN_RESTRICT markRow );
00818   int pivot ( CoinSimplexInt & pivotRow,
00819                CoinSimplexInt & pivotColumn,
00820                CoinBigIndex pivotRowPosition,
00821                CoinBigIndex pivotColumnPosition,
00822                int * COIN_RESTRICT markRow );
00823 #if ABC_SMALL<2
00824 #define CONVERTROW 2
00825 #elif ABC_SMALL<4
00826 #else
00827 #undef ABC_DENSE_CODE
00828 #define ABC_DENSE_CODE 0
00829 #endif
00830 
00832 
00833 protected:
00834 
00837   CoinSimplexInt * pivotColumnAddress_;
00838   CoinSimplexInt * permuteAddress_;
00839   CoinFactorizationDouble * pivotRegionAddress_;
00840   CoinFactorizationDouble * elementUAddress_;
00841   CoinSimplexInt * indexRowUAddress_;
00842   CoinSimplexInt * numberInColumnAddress_;
00843   CoinSimplexInt * numberInColumnPlusAddress_;
00844 #ifdef ABC_USE_FUNCTION_POINTERS
00846   scatterStruct * scatterPointersUColumnAddress_;
00847   CoinFactorizationDouble * elementUColumnPlusAddress_;
00848 #endif
00849   CoinBigIndex * startColumnUAddress_;
00850 #if CONVERTROW
00851   CoinBigIndex * convertRowToColumnUAddress_;
00852 #if CONVERTROW>1
00853   CoinBigIndex * convertColumnToRowUAddress_;
00854 #endif
00855 #endif
00856 #if ABC_SMALL<2
00857   CoinFactorizationDouble * elementRowUAddress_;
00858 #endif
00859   CoinBigIndex * startRowUAddress_;
00860   CoinSimplexInt * numberInRowAddress_;
00861   CoinSimplexInt * indexColumnUAddress_;
00862   CoinSimplexInt * firstCountAddress_;
00864   CoinSimplexInt * nextCountAddress_;
00866   CoinSimplexInt * lastCountAddress_;
00867   CoinSimplexInt * nextColumnAddress_;
00868   CoinSimplexInt * lastColumnAddress_;
00869   CoinSimplexInt * nextRowAddress_;
00870   CoinSimplexInt * lastRowAddress_;
00871   CoinSimplexInt * saveColumnAddress_;
00872   //CoinSimplexInt * saveColumnAddress2_;
00873   CoinCheckZero * markRowAddress_;
00874   CoinSimplexInt * listAddress_;
00875   CoinFactorizationDouble * elementLAddress_;
00876   CoinSimplexInt * indexRowLAddress_;
00877   CoinBigIndex * startColumnLAddress_;
00878 #if ABC_SMALL<2
00879   CoinBigIndex * startRowLAddress_;
00880 #endif
00881   CoinSimplexInt * pivotLinkedBackwardsAddress_;
00882   CoinSimplexInt * pivotLinkedForwardsAddress_;
00883   CoinSimplexInt * pivotLOrderAddress_;
00884   CoinBigIndex * startColumnRAddress_;
00886   CoinFactorizationDouble *elementRAddress_;
00888   CoinSimplexInt *indexRowRAddress_;
00889   CoinSimplexInt * indexColumnLAddress_;
00890   CoinFactorizationDouble * elementByRowLAddress_;
00891 #if ABC_SMALL<4
00892   CoinFactorizationDouble * denseAreaAddress_;
00893 #endif
00894   CoinFactorizationDouble * workAreaAddress_;
00895   CoinSimplexUnsignedInt * workArea2Address_;
00896   mutable CoinSimplexInt * sparseAddress_;
00897 #ifdef SMALL_PERMUTE
00898   CoinSimplexInt * fromSmallToBigRow_;
00899   CoinSimplexInt * fromSmallToBigColumn_;
00900 #endif    
00902   CoinSimplexInt numberRowsExtra_;
00904   CoinSimplexInt maximumRowsExtra_;
00906   CoinSimplexInt numberRowsSmall_;
00908   CoinSimplexInt numberGoodL_;
00910   CoinSimplexInt numberRowsLeft_;
00913   CoinBigIndex totalElements_;
00915   CoinBigIndex firstZeroed_;
00916 #if ABC_SMALL<2
00918   CoinSimplexInt sparseThreshold_;
00919 #endif
00921   CoinSimplexInt numberR_;
00923   CoinBigIndex lengthR_;
00925   CoinBigIndex lengthAreaR_;
00927   CoinBigIndex numberL_;
00929   CoinBigIndex baseL_;
00931   CoinBigIndex lengthL_;
00933   CoinBigIndex lengthAreaL_;
00935   CoinSimplexInt numberU_;
00937   CoinBigIndex maximumU_;
00939   CoinBigIndex lengthU_;
00941   CoinBigIndex lengthAreaU_;
00943   CoinBigIndex lastEntryByColumnU_;
00944 #ifdef ABC_USE_FUNCTION_POINTERS
00946   CoinBigIndex lastEntryByColumnUPlus_;
00948   CoinBigIndex lengthAreaUPlus_;
00949 #endif
00951   CoinBigIndex lastEntryByRowU_;
00953   CoinSimplexInt numberTrials_;
00954 #if ABC_SMALL<4
00956   CoinSimplexInt leadingDimension_;
00957 #endif
00958 #if COIN_BIG_DOUBLE==1
00960   mutable CoinFactorizationLongDoubleArrayWithLength longArray_[FACTOR_CPU];
00962   mutable CoinIndexedVector * associatedVector_[FACTOR_CPU];
00963 #endif
00965   CoinIntArrayWithLength pivotColumn_;
00967   CoinIntArrayWithLength permute_;
00969   CoinBigIndexArrayWithLength startRowU_;
00971   CoinIntArrayWithLength numberInRow_;
00973   CoinIntArrayWithLength numberInColumn_;
00975   CoinIntArrayWithLength numberInColumnPlus_;
00976 
00978   CoinIntArrayWithLength firstCount_;
00980   CoinIntArrayWithLength nextColumn_;
00982   CoinIntArrayWithLength lastColumn_;
00984   CoinIntArrayWithLength nextRow_;
00986   CoinIntArrayWithLength lastRow_;
00988   CoinIntArrayWithLength saveColumn_;
00990   CoinIntArrayWithLength markRow_;
00992   CoinIntArrayWithLength indexColumnU_;
00994   CoinFactorizationDoubleArrayWithLength pivotRegion_;
00996   CoinFactorizationDoubleArrayWithLength elementU_;
00998   CoinIntArrayWithLength indexRowU_;
01000   CoinBigIndexArrayWithLength startColumnU_;
01001 #ifdef ABC_USE_FUNCTION_POINTERS
01003   CoinArbitraryArrayWithLength scatterUColumn_;
01004 #endif
01005 #if CONVERTROW
01007   CoinBigIndexArrayWithLength convertRowToColumnU_;
01008 #if CONVERTROW>1
01010   CoinBigIndexArrayWithLength convertColumnToRowU_;
01011 #endif
01012 #endif
01013 #if ABC_SMALL<2
01015   CoinFactorizationDoubleArrayWithLength elementRowU_;
01016 #endif
01018   CoinFactorizationDoubleArrayWithLength elementL_;
01020   CoinIntArrayWithLength indexRowL_;
01022   CoinBigIndexArrayWithLength startColumnL_;
01023 #if ABC_SMALL<4
01025   CoinFactorizationDoubleArrayWithLength denseArea_;
01026 #endif
01028   CoinFactorizationDoubleArrayWithLength workArea_;
01030   CoinUnsignedIntArrayWithLength workArea2_;
01031 #if ABC_SMALL<2
01033   CoinBigIndexArrayWithLength startRowL_;
01035   CoinIntArrayWithLength indexColumnL_;
01037   CoinFactorizationDoubleArrayWithLength elementByRowL_;
01039   mutable CoinIntArrayWithLength sparse_;
01040 #endif
01042   CoinSimplexInt messageLevel_;
01044   CoinBigIndex numberCompressions_;
01045   // last slack pivot row
01046   CoinSimplexInt lastSlack_;
01047 #if ABC_SMALL<2
01049   mutable double ftranCountInput_;
01050   mutable double ftranCountAfterL_;
01051   mutable double ftranCountAfterR_;
01052   mutable double ftranCountAfterU_;
01053   double ftranAverageAfterL_;
01054   double ftranAverageAfterR_;
01055   double ftranAverageAfterU_;
01056 #if FACTORIZATION_STATISTICS
01057   double ftranTwiddleFactor1_;
01058   double ftranTwiddleFactor2_;
01059 #endif  
01060   mutable CoinSimplexInt numberFtranCounts_;
01061 #endif
01063   CoinSimplexInt maximumRows_;
01064 #if ABC_SMALL<2
01065   mutable double ftranFTCountInput_;
01066   mutable double ftranFTCountAfterL_;
01067   mutable double ftranFTCountAfterR_;
01068   mutable double ftranFTCountAfterU_;
01069   double ftranFTAverageAfterL_;
01070   double ftranFTAverageAfterR_;
01071   double ftranFTAverageAfterU_;
01072 #if FACTORIZATION_STATISTICS
01073   double ftranFTTwiddleFactor1_;
01074   double ftranFTTwiddleFactor2_;
01075 #endif  
01076   mutable CoinSimplexInt numberFtranFTCounts_;
01077 #endif
01078 #if ABC_SMALL<4
01080   CoinSimplexInt denseThreshold_;
01081 #endif
01082 #if ABC_SMALL<2
01083   mutable double btranCountInput_;
01084   mutable double btranCountAfterU_;
01085   mutable double btranCountAfterR_;
01086   mutable double btranCountAfterL_;
01087   double btranAverageAfterU_;
01088   double btranAverageAfterR_;
01089   double btranAverageAfterL_;
01090 #if FACTORIZATION_STATISTICS
01091   double btranTwiddleFactor1_;
01092   double btranTwiddleFactor2_;
01093 #endif  
01094   mutable CoinSimplexInt numberBtranCounts_;
01095 #endif
01097   CoinSimplexInt maximumMaximumPivots_;
01098 #if ABC_SMALL<2
01100   mutable double ftranFullCountInput_;
01101   mutable double ftranFullCountAfterL_;
01102   mutable double ftranFullCountAfterR_;
01103   mutable double ftranFullCountAfterU_;
01104   double ftranFullAverageAfterL_;
01105   double ftranFullAverageAfterR_;
01106   double ftranFullAverageAfterU_;
01107 #if FACTORIZATION_STATISTICS
01108   double ftranFullTwiddleFactor1_;
01109   double ftranFullTwiddleFactor2_;
01110 #endif  
01111   mutable CoinSimplexInt numberFtranFullCounts_;
01112 #endif
01114   CoinSimplexInt initialNumberRows_;
01115 #if ABC_SMALL<2
01117   mutable double btranFullCountInput_;
01118   mutable double btranFullCountAfterL_;
01119   mutable double btranFullCountAfterR_;
01120   mutable double btranFullCountAfterU_;
01121   double btranFullAverageAfterL_;
01122   double btranFullAverageAfterR_;
01123   double btranFullAverageAfterU_;
01124 #if FACTORIZATION_STATISTICS
01125   double btranFullTwiddleFactor1_;
01126   double btranFullTwiddleFactor2_;
01127 #endif  
01128   mutable CoinSimplexInt numberBtranFullCounts_;
01129 #endif
01130 
01136   CoinSimplexInt state_;
01138   CoinBigIndex sizeSparseArray_;
01139 public:
01140 #if ABC_SMALL<2
01141 #if ABC_SMALL>=0
01142   inline bool gotLCopy() const {return ((state_&ABC_FAC_GOT_LCOPY)!=0);}
01143   inline void setNoGotLCopy() {state_ &= ~ABC_FAC_GOT_LCOPY;}
01144   inline void setYesGotLCopy() {state_ |= ABC_FAC_GOT_LCOPY;}
01145   inline bool gotRCopy() const {return ((state_&ABC_FAC_GOT_RCOPY)!=0);}
01146   inline void setNoGotRCopy() {state_ &= ~ABC_FAC_GOT_RCOPY;}
01147   inline void setYesGotRCopy() {state_ |= ABC_FAC_GOT_RCOPY;}
01148   inline bool gotUCopy() const {return ((state_&ABC_FAC_GOT_UCOPY)!=0);}
01149   inline void setNoGotUCopy() {state_ &= ~ABC_FAC_GOT_UCOPY;}
01150   inline void setYesGotUCopy() {state_ |= ABC_FAC_GOT_UCOPY;}
01151   inline bool gotSparse() const {return ((state_&ABC_FAC_GOT_SPARSE)!=0);}
01152   inline void setNoGotSparse() {state_ &= ~ABC_FAC_GOT_SPARSE;}
01153   inline void setYesGotSparse() {state_ |= ABC_FAC_GOT_SPARSE;}
01154 #else
01155   // force use of copies
01156   inline bool gotLCopy() const {return true;}
01157   inline void setNoGotLCopy() {}
01158   inline void setYesGotLCopy() {}
01159   inline bool gotRCopy() const {return true;}
01160   inline void setNoGotRCopy() {}
01161   inline void setYesGotRCopy() {}
01162   inline bool gotUCopy() const {return true;}
01163   inline void setNoGotUCopy() {}
01164   inline void setYesGotUCopy() {}
01165   inline bool gotSparse() const {return true;}
01166   inline void setNoGotSparse() {}
01167   inline void setYesGotSparse() {}
01168 #endif
01169 #else
01170   // force no use of copies
01171   inline bool gotLCopy() const {return false;}
01172   inline void setNoGotLCopy() {}
01173   inline void setYesGotLCopy() {}
01174   inline bool gotRCopy() const {return false;}
01175   inline void setNoGotRCopy() {}
01176   inline void setYesGotRCopy() {}
01177   inline bool gotUCopy() const {return false;}
01178   inline void setNoGotUCopy() {}
01179   inline void setYesGotUCopy() {}
01180   inline bool gotSparse() const {return false;}
01181   inline void setNoGotSparse() {}
01182   inline void setYesGotSparse() {}
01183 #endif
01184 
01189   //CoinSimplexInt persistenceFlag_;
01191 };
01192 
01193 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 12 Nov 2013 for Clp by  doxygen 1.6.1