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

- File List
- File Members

# /home/coin/svn-release/Blis-0.94.1/Clp/src/AbcSimplexFactorization.hpp

Go to the documentation of this file.

    00001 /* $Id: AbcSimplexFactorization.hpp 2078 2015-01-05 12:39:49Z forrest $ */
    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 #ifndef AbcSimplexFactorization_H
    00007 #define AbcSimplexFactorization_H
    00008
    00009
    00010 #include "CoinPragma.hpp"
    00011
    00012 #include "CoinAbcCommon.hpp"
    00013 #include "CoinAbcFactorization.hpp"
    00014 #include "AbcMatrix.hpp"
    00015 //#include "CoinAbcAnyFactorization.hpp"
    00016 #include "AbcSimplex.hpp"
    00017 #ifndef ABC_USE_COIN_FACTORIZATION
    00018 class ClpFactorization;
    00019 class CoinFactorization;
    00020 #else
    00021 #include "ClpFactorization.hpp"
    00022 #include "CoinFactorization.hpp"
    00023 #endif
    00024
    00027 class AbcSimplexFactorization
    00028 {
    00029
    00030 public:
    00042   int factorize (AbcSimplex * model, int solveType, bool valuesPass);
    00043 #ifdef EARLY_FACTORIZE
    00045   inline int factorize (AbcSimplex * model, CoinIndexedVector & stuff)
    00046   { return coinAbcFactorization_->factorize(model,stuff);}
    00047 #endif
    00048
    00049
    00050
    00054   AbcSimplexFactorization(int numberRows=0);
    00056   ~AbcSimplexFactorization();
    00058
    00062   AbcSimplexFactorization(const AbcSimplexFactorization&, int denseIfSmaller = 0);
    00063   AbcSimplexFactorization& operator=(const AbcSimplexFactorization&);
    00065   void setFactorization(AbcSimplexFactorization & rhs);
    00067
    00068   /*  **** below here is so can use networkish basis */
    00071
    00076   inline
    00077 #ifdef ABC_LONG_FACTORIZATION
    00078   long
    00079 #endif
    00080   double checkReplacePart1 ( CoinIndexedVector * regionSparse,
    00081                              int pivotRow)
    00082   {return coinAbcFactorization_->checkReplacePart1(regionSparse,pivotRow);}
    00087   inline
    00088 #ifdef ABC_LONG_FACTORIZATION
    00089   long
    00090 #endif
    00091   double checkReplacePart1 ( CoinIndexedVector * regionSparse,
    00092                                   CoinIndexedVector * partialUpdate,
    00093                                   int pivotRow)
    00094   {return coinAbcFactorization_->checkReplacePart1(regionSparse,partialUpdate,pivotRow);}
    00095 #ifdef MOVE_REPLACE_PART1A
    00096
    00100   inline void checkReplacePart1a ( CoinIndexedVector * regionSparse,
    00101                              int pivotRow)
    00102   {coinAbcFactorization_->checkReplacePart1a(regionSparse,pivotRow);}
    00103   inline double checkReplacePart1b (CoinIndexedVector * regionSparse,
    00104                              int pivotRow)
    00105   {return coinAbcFactorization_->checkReplacePart1b(regionSparse,pivotRow);}
    00106 #endif
    00107
    00109   inline int checkReplacePart2 ( int pivotRow,
    00110                                  double btranAlpha,
    00111                                  double ftranAlpha,
    00112 #ifdef ABC_LONG_FACTORIZATION
    00113                                  long
    00114 #endif
    00115                                  double ftAlpha)
    00116   {return coinAbcFactorization_->checkReplacePart2(pivotRow,btranAlpha,ftranAlpha,ftAlpha);}
    00117 #ifdef ABC_LONG_FACTORIZATION
    00119   inline void clearHiddenArrays()
    00120   { coinAbcFactorization_->clearHiddenArrays();}
    00121 #endif
    00122
    00124   void replaceColumnPart3 ( const AbcSimplex * model,
    00125                             CoinIndexedVector * regionSparse,
    00126                             CoinIndexedVector * tableauColumn,
    00127                             int pivotRow,
    00128 #ifdef ABC_LONG_FACTORIZATION
    00129                             long
    00130 #endif
    00131                             double alpha );
    00134   void replaceColumnPart3 ( const AbcSimplex * model,
    00135                             CoinIndexedVector * regionSparse,
    00136                             CoinIndexedVector * tableauColumn,
    00137                             CoinIndexedVector * partialUpdate,
    00138                             int pivotRow,
    00139 #ifdef ABC_LONG_FACTORIZATION
    00140                             long
    00141 #endif
    00142                             double alpha );
    00143 #ifdef EARLY_FACTORIZE
    00145   inline int replaceColumns ( const AbcSimplex * model,
    00146                         CoinIndexedVector & stuff,
    00147                               int firstPivot,int lastPivot,bool cleanUp)
    00148   { return coinAbcFactorization_->replaceColumns(model,stuff,firstPivot,lastPivot,cleanUp);}
    00149 #endif
    00150
    00151
    00155 #if 0
    00156
    00160   int updateColumnFT ( CoinIndexedVector * regionSparse,
    00161                        CoinIndexedVector * regionSparse2);
    00164   int updateColumn ( CoinIndexedVector * regionSparse,
    00165                      CoinIndexedVector * regionSparse2) const;
    00171   int updateTwoColumnsFT ( CoinIndexedVector * regionSparse1,
    00172                            CoinIndexedVector * regionSparse2,
    00173                            CoinIndexedVector * regionSparse3) ;
    00176   int updateColumnTranspose ( CoinIndexedVector * regionSparse,
    00177                               CoinIndexedVector * regionSparse2) const;
    00178 #endif
    00179
    00182   inline int updateColumnFT ( CoinIndexedVector & regionSparseFT)
    00183   { return coinAbcFactorization_->updateColumnFT(regionSparseFT);}
    00184   inline int updateColumnFTPart1 ( CoinIndexedVector & regionSparseFT)
    00185   { return coinAbcFactorization_->updateColumnFTPart1(regionSparseFT);}
    00186   inline void updateColumnFTPart2 ( CoinIndexedVector & regionSparseFT)
    00187   { coinAbcFactorization_->updateColumnFTPart2(regionSparseFT);}
    00191   inline void updateColumnFT ( CoinIndexedVector & regionSparseFT,
    00192                                CoinIndexedVector & partialUpdate,
    00193                                int which)
    00194   { coinAbcFactorization_->updateColumnFT(regionSparseFT,partialUpdate,which);}
    00196   inline int updateColumn ( CoinIndexedVector & regionSparse) const
    00197   { return coinAbcFactorization_->updateColumn(regionSparse);}
    00202   inline int updateTwoColumnsFT ( CoinIndexedVector & regionSparseFT,
    00203                            CoinIndexedVector & regionSparseOther)
    00204   { return coinAbcFactorization_->updateTwoColumnsFT(regionSparseFT,regionSparseOther);}
    00206   inline int updateColumnTranspose ( CoinIndexedVector & regionSparse) const
    00207   { return coinAbcFactorization_->updateColumnTranspose(regionSparse);}
    00209   inline void updateColumnCpu ( CoinIndexedVector & regionSparse,int whichCpu) const
    00210 #ifndef ABC_USE_COIN_FACTORIZATION
    00211   { coinAbcFactorization_->updateColumnCpu(regionSparse,whichCpu);}
    00212 #else
    00213   { coinAbcFactorization_->updateColumn(regionSparse);}
    00214 #endif
    00215
    00216   inline void updateColumnTransposeCpu ( CoinIndexedVector & regionSparse,int whichCpu) const
    00217 #ifndef ABC_USE_COIN_FACTORIZATION
    00218   { coinAbcFactorization_->updateColumnTransposeCpu(regionSparse,whichCpu);}
    00219 #else
    00220   { coinAbcFactorization_->updateColumnTranspose(regionSparse);}
    00221 #endif
    00222
    00223   inline void updateFullColumn ( CoinIndexedVector & regionSparse) const
    00224   { coinAbcFactorization_->updateFullColumn(regionSparse);}
    00226   inline void updateFullColumnTranspose ( CoinIndexedVector & regionSparse) const
    00227   { coinAbcFactorization_->updateFullColumnTranspose(regionSparse);}
    00229   void updateWeights ( CoinIndexedVector & regionSparse) const
    00230 #ifndef ABC_USE_COIN_FACTORIZATION
    00231   { coinAbcFactorization_->updateWeights(regionSparse);}
    00232 #else
    00233   { coinAbcFactorization_->updateColumn(regionSparse);}
    00234 #endif
    00235
    00236
    00238
    00239   inline int numberElements (  ) const {
    00240     return coinAbcFactorization_->numberElements() ;
    00241   }
    00243   inline int maximumPivots (  ) const {
    00244     return coinAbcFactorization_->maximumPivots() ;
    00245   }
    00247   inline void maximumPivots (  int value) {
    00248     coinAbcFactorization_->maximumPivots(value);
    00249   }
    00251   inline bool usingFT() const
    00252   { return !coinAbcFactorization_->wantsTableauColumn();}
    00254   inline int pivots (  ) const {
    00255     return coinAbcFactorization_->pivots() ;
    00256   }
    00258   inline void setModel(AbcSimplex * model)
    00259   {model_ = model;}
    00261   inline void setPivots ( int value ) const {
    00262     coinAbcFactorization_->setPivots(value) ;
    00263   }
    00265   inline double areaFactor (  ) const {
    00266     return coinAbcFactorization_->areaFactor() ;
    00267   }
    00269   inline void areaFactor ( double value) {
    00270     coinAbcFactorization_->areaFactor(value);
    00271   }
    00273   inline double zeroTolerance (  ) const {
    00274     return coinAbcFactorization_->zeroTolerance() ;
    00275   }
    00277   inline void zeroTolerance (  double value) {
    00278     coinAbcFactorization_->zeroTolerance(value);
    00279   }
    00281   void saferTolerances (  double zeroTolerance, double pivotTolerance);
    00283   inline int status (  ) const {
    00284     return coinAbcFactorization_->status() ;
    00285   }
    00287   inline void setStatus (  int value) {
    00288     coinAbcFactorization_->setStatus(value) ;
    00289   }
    00290 #if ABC_PARALLEL==2
    00292   inline void setParallelMode(int value)
    00293   {coinAbcFactorization_->setParallelMode(value);};
    00294 #endif
    00296   inline int numberDense() const {
    00297     return coinAbcFactorization_->numberDense() ;
    00298   }
    00299   bool timeToRefactorize() const;
    00300 #if CLP_FACTORIZATION_NEW_TIMING>1
    00301   void statsRefactor(char when) const;
    00302 #endif
    00304   inline void clearArrays() {
    00305     coinAbcFactorization_->clearArrays();
    00306   }
    00308   inline int numberRows (  ) const {
    00309     return coinAbcFactorization_->numberRows() ;
    00310   }
    00312   inline int numberSlacks() const
    00313   { return numberSlacks_;}
    00315   inline double pivotTolerance (  ) const {
    00316     return coinAbcFactorization_->pivotTolerance();
    00317   }
    00319   inline void pivotTolerance (  double value) {
    00320     coinAbcFactorization_->pivotTolerance(value);
    00321   }
    00323   inline double minimumPivotTolerance (  ) const {
    00324     return coinAbcFactorization_->minimumPivotTolerance();
    00325   }
    00327   inline void minimumPivotTolerance (  double value) {
    00328     coinAbcFactorization_->minimumPivotTolerance(value);
    00329   }
    00331   inline double * pivotRegion() const
    00332   { return coinAbcFactorization_->pivotRegion();}
    00334   //inline void relaxAccuracyCheck(double /*value*/) {
    00335   //abort();
    00336   //}
    00338   inline void almostDestructor() {
    00339     coinAbcFactorization_->clearArrays();
    00340   }
    00342   void setDenseThreshold(int number);
    00343   int getDenseThreshold() const;
    00345   void forceOtherFactorization(int which);
    00347   void goDenseOrSmall(int numberRows);
    00349   inline int goDenseThreshold() const {
    00350     return goDenseThreshold_;
    00351   }
    00353   inline void setGoDenseThreshold(int value) {
    00354     goDenseThreshold_ = value;
    00355   }
    00357   inline int goSmallThreshold() const {
    00358     return goSmallThreshold_;
    00359   }
    00361   inline void setGoSmallThreshold(int value) {
    00362     goSmallThreshold_ = value;
    00363   }
    00365   inline int goLongThreshold() const {
    00366     return goLongThreshold_;
    00367   }
    00369   inline void setGoLongThreshold(int value) {
    00370     goLongThreshold_ = value;
    00371   }
    00373   inline int typeOfFactorization() const
    00374   { return forceB_;}
    00376   void synchronize(const ClpFactorization * otherFactorization,const AbcSimplex * model);
    00378
    00382   void goSparse();
    00383 #ifndef NDEBUG
    00384 #ifndef ABC_USE_COIN_FACTORIZATION
    00385   inline void checkMarkArrays() const
    00386   { coinAbcFactorization_->checkMarkArrays();}
    00387 #else
    00388   inline void checkMarkArrays() const
    00389   { }
    00390 #endif
    00391 #endif
    00393   inline bool needToReorder() const {abort();return true;}
    00395 #ifndef ABC_USE_COIN_FACTORIZATION
    00396   CoinAbcAnyFactorization * factorization() const
    00397   { return coinAbcFactorization_;}
    00398 #else
    00399   CoinFactorization * factorization() const
    00400   { return coinAbcFactorization_;}
    00401 #endif
    00402
    00403
    00405 private:
    00406
    00409
    00410   AbcSimplex * model_;
    00412 #ifndef ABC_USE_COIN_FACTORIZATION
    00413   CoinAbcAnyFactorization * coinAbcFactorization_;
    00414 #else
    00415   CoinFactorization * coinAbcFactorization_;
    00416 #endif
    00417 #ifdef CLP_FACTORIZATION_NEW_TIMING
    00419   mutable double shortestAverage_;
    00420   mutable double totalInR_;
    00421   mutable double totalInIncreasingU_;
    00422   mutable int endLengthU_;
    00423   mutable int lastNumberPivots_;
    00424   mutable int effectiveStartNumberU_;
    00425 #endif
    00427   int forceB_;
    00429   int goDenseThreshold_;
    00431   int goSmallThreshold_;
    00433   int goLongThreshold_;
    00435   int numberSlacks_;
    00436
    00437 };
    00438
    00439 #endif