# AbcSimplexFactorization.hpp

Go to the documentation of this file.

    00001 /* $Id: AbcSimplexFactorization.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 #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 class ClpFactorization;
    00018
    00022 class AbcSimplexFactorization
    00023 {
    00024
    00025 public:
    00037   int factorize (AbcSimplex * model, int solveType, bool valuesPass);
    00038 #ifdef EARLY_FACTORIZE
    00040   inline int factorize (AbcSimplex * model, CoinIndexedVector & stuff)
    00041   { return coinAbcFactorization_->factorize(model,stuff);}
    00042 #endif
    00043
    00044
    00045
    00049   AbcSimplexFactorization(int numberRows=0);
    00051   ~AbcSimplexFactorization();
    00053
    00057   AbcSimplexFactorization(const AbcSimplexFactorization&, int denseIfSmaller = 0);
    00058   AbcSimplexFactorization& operator=(const AbcSimplexFactorization&);
    00060   void setFactorization(AbcSimplexFactorization & rhs);
    00062
    00063   /*  **** below here is so can use networkish basis */
    00066
    00071   inline
    00072 #ifdef ABC_LONG_FACTORIZATION
    00073   long
    00074 #endif
    00075   double checkReplacePart1 ( CoinIndexedVector * regionSparse,
    00076                              int pivotRow)
    00077   {return coinAbcFactorization_->checkReplacePart1(regionSparse,pivotRow);}
    00082   inline
    00083 #ifdef ABC_LONG_FACTORIZATION
    00084   long
    00085 #endif
    00086   double checkReplacePart1 ( CoinIndexedVector * regionSparse,
    00087                                   CoinIndexedVector * partialUpdate,
    00088                                   int pivotRow)
    00089   {return coinAbcFactorization_->checkReplacePart1(regionSparse,partialUpdate,pivotRow);}
    00094   inline void checkReplacePart1a ( CoinIndexedVector * regionSparse,
    00095                              int pivotRow)
    00096   {coinAbcFactorization_->checkReplacePart1a(regionSparse,pivotRow);}
    00097   inline double checkReplacePart1b (CoinIndexedVector * regionSparse,
    00098                              int pivotRow)
    00099   {return coinAbcFactorization_->checkReplacePart1b(regionSparse,pivotRow);}
    00102   inline int checkReplacePart2 ( int pivotRow,
    00103                                  double btranAlpha,
    00104                                  double ftranAlpha,
    00105 #ifdef ABC_LONG_FACTORIZATION
    00106                                  long
    00107 #endif
    00108                                  double ftAlpha)
    00109   {return coinAbcFactorization_->checkReplacePart2(pivotRow,btranAlpha,ftranAlpha,ftAlpha);}
    00110 #ifdef ABC_LONG_FACTORIZATION
    00112   inline void clearHiddenArrays()
    00113   { coinAbcFactorization_->clearHiddenArrays();}
    00114 #endif
    00115
    00117   void replaceColumnPart3 ( const AbcSimplex * model,
    00118                             CoinIndexedVector * regionSparse,
    00119                             CoinIndexedVector * tableauColumn,
    00120                             int pivotRow,
    00121 #ifdef ABC_LONG_FACTORIZATION
    00122                             long
    00123 #endif
    00124                             double alpha );
    00127   void replaceColumnPart3 ( const AbcSimplex * model,
    00128                             CoinIndexedVector * regionSparse,
    00129                             CoinIndexedVector * tableauColumn,
    00130                             CoinIndexedVector * partialUpdate,
    00131                             int pivotRow,
    00132 #ifdef ABC_LONG_FACTORIZATION
    00133                             long
    00134 #endif
    00135                             double alpha );
    00136 #ifdef EARLY_FACTORIZE
    00138   inline int replaceColumns ( const AbcSimplex * model,
    00139                         CoinIndexedVector & stuff,
    00140                               int firstPivot,int lastPivot,bool cleanUp)
    00141   { return coinAbcFactorization_->replaceColumns(model,stuff,firstPivot,lastPivot,cleanUp);}
    00142 #endif
    00143
    00144
    00148 #if 0
    00149
    00153   int updateColumnFT ( CoinIndexedVector * regionSparse,
    00154                        CoinIndexedVector * regionSparse2);
    00157   int updateColumn ( CoinIndexedVector * regionSparse,
    00158                      CoinIndexedVector * regionSparse2) const;
    00164   int updateTwoColumnsFT ( CoinIndexedVector * regionSparse1,
    00165                            CoinIndexedVector * regionSparse2,
    00166                            CoinIndexedVector * regionSparse3) ;
    00169   int updateColumnTranspose ( CoinIndexedVector * regionSparse,
    00170                               CoinIndexedVector * regionSparse2) const;
    00171 #endif
    00172
    00175   inline int updateColumnFT ( CoinIndexedVector & regionSparseFT)
    00176   { return coinAbcFactorization_->updateColumnFT(regionSparseFT);}
    00177   inline int updateColumnFTPart1 ( CoinIndexedVector & regionSparseFT)
    00178   { return coinAbcFactorization_->updateColumnFTPart1(regionSparseFT);}
    00179   inline void updateColumnFTPart2 ( CoinIndexedVector & regionSparseFT)
    00180   { coinAbcFactorization_->updateColumnFTPart2(regionSparseFT);}
    00184   inline void updateColumnFT ( CoinIndexedVector & regionSparseFT,
    00185                                CoinIndexedVector & partialUpdate,
    00186                                int which)
    00187   { coinAbcFactorization_->updateColumnFT(regionSparseFT,partialUpdate,which);}
    00189   inline int updateColumn ( CoinIndexedVector & regionSparse) const
    00190   { return coinAbcFactorization_->updateColumn(regionSparse);}
    00195   inline int updateTwoColumnsFT ( CoinIndexedVector & regionSparseFT,
    00196                            CoinIndexedVector & regionSparseOther)
    00197   { return coinAbcFactorization_->updateTwoColumnsFT(regionSparseFT,regionSparseOther);}
    00199   inline int updateColumnTranspose ( CoinIndexedVector & regionSparse) const
    00200   { return coinAbcFactorization_->updateColumnTranspose(regionSparse);}
    00202   inline void updateColumnCpu ( CoinIndexedVector & regionSparse,int whichCpu) const
    00203   { coinAbcFactorization_->updateColumnCpu(regionSparse,whichCpu);}
    00205   inline void updateColumnTransposeCpu ( CoinIndexedVector & regionSparse,int whichCpu) const
    00206   { coinAbcFactorization_->updateColumnTransposeCpu(regionSparse,whichCpu);}
    00208   inline void updateFullColumn ( CoinIndexedVector & regionSparse) const
    00209   { coinAbcFactorization_->updateFullColumn(regionSparse);}
    00211   inline void updateFullColumnTranspose ( CoinIndexedVector & regionSparse) const
    00212   { coinAbcFactorization_->updateFullColumnTranspose(regionSparse);}
    00214   void updateWeights ( CoinIndexedVector & regionSparse) const
    00215   { coinAbcFactorization_->updateWeights(regionSparse);}
    00217
    00219
    00220   inline int numberElements (  ) const {
    00221     return coinAbcFactorization_->numberElements() ;
    00222   }
    00224   inline int maximumPivots (  ) const {
    00225     return coinAbcFactorization_->maximumPivots() ;
    00226   }
    00228   inline void maximumPivots (  int value) {
    00229     coinAbcFactorization_->maximumPivots(value);
    00230   }
    00232   inline bool usingFT() const
    00233   { return !coinAbcFactorization_->wantsTableauColumn();}
    00235   inline int pivots (  ) const {
    00236     return coinAbcFactorization_->pivots() ;
    00237   }
    00239   inline void setPivots ( int value ) const {
    00240     coinAbcFactorization_->setPivots(value) ;
    00241   }
    00243   inline double areaFactor (  ) const {
    00244     return coinAbcFactorization_->areaFactor() ;
    00245   }
    00247   inline void areaFactor ( double value) {
    00248     coinAbcFactorization_->areaFactor(value);
    00249   }
    00251   inline double zeroTolerance (  ) const {
    00252     return coinAbcFactorization_->zeroTolerance() ;
    00253   }
    00255   inline void zeroTolerance (  double value) {
    00256     coinAbcFactorization_->zeroTolerance(value);
    00257   }
    00259   void saferTolerances (  double zeroTolerance, double pivotTolerance);
    00261   inline int status (  ) const {
    00262     return coinAbcFactorization_->status() ;
    00263   }
    00265   inline void setStatus (  int value) {
    00266     coinAbcFactorization_->setStatus(value) ;
    00267   }
    00268 #if ABC_PARALLEL==2
    00270   inline void setParallelMode(int value)
    00271   {coinAbcFactorization_->setParallelMode(value);};
    00272 #endif
    00274   inline int numberDense() const {
    00275     return coinAbcFactorization_->numberDense() ;
    00276   }
    00277   inline bool timeToRefactorize() const {
    00278     return coinAbcFactorization_->pivots() > coinAbcFactorization_->numberRows() / 2.45 + 20;
    00279   }
    00281   inline void clearArrays() {
    00282     coinAbcFactorization_->clearArrays();
    00283   }
    00285   inline int numberRows (  ) const {
    00286     return coinAbcFactorization_->numberRows() ;
    00287   }
    00289   inline int numberSlacks() const
    00290   { return numberSlacks_;}
    00292   inline double pivotTolerance (  ) const {
    00293     return coinAbcFactorization_->pivotTolerance();
    00294   }
    00296   inline void pivotTolerance (  double value) {
    00297     coinAbcFactorization_->pivotTolerance(value);
    00298   }
    00300   inline double minimumPivotTolerance (  ) const {
    00301     return coinAbcFactorization_->minimumPivotTolerance();
    00302   }
    00304   inline void minimumPivotTolerance (  double value) {
    00305     coinAbcFactorization_->minimumPivotTolerance(value);
    00306   }
    00308   inline double * pivotRegion() const
    00309   { return coinAbcFactorization_->pivotRegion();}
    00311   //inline void relaxAccuracyCheck(double /*value*/) {
    00312   //abort();
    00313   //}
    00315   inline void almostDestructor() {
    00316     coinAbcFactorization_->clearArrays();
    00317   }
    00319   void setDenseThreshold(int number);
    00320   int getDenseThreshold() const;
    00322   void forceOtherFactorization(int which);
    00324   void goDenseOrSmall(int numberRows);
    00326   inline int goDenseThreshold() const {
    00327     return goDenseThreshold_;
    00328   }
    00330   inline void setGoDenseThreshold(int value) {
    00331     goDenseThreshold_ = value;
    00332   }
    00334   inline int goSmallThreshold() const {
    00335     return goSmallThreshold_;
    00336   }
    00338   inline void setGoSmallThreshold(int value) {
    00339     goSmallThreshold_ = value;
    00340   }
    00342   inline int goLongThreshold() const {
    00343     return goLongThreshold_;
    00344   }
    00346   inline void setGoLongThreshold(int value) {
    00347     goLongThreshold_ = value;
    00348   }
    00350   inline int typeOfFactorization() const
    00351   { return forceB_;}
    00353   void synchronize(const ClpFactorization * otherFactorization,const AbcSimplex * model);
    00355
    00359   void goSparse();
    00360 #ifndef NDEBUG
    00361   inline void checkMarkArrays() const
    00362   { coinAbcFactorization_->checkMarkArrays();}
    00363 #endif
    00365   inline bool needToReorder() const {abort();return true;}
    00367   CoinAbcAnyFactorization * factorization() const
    00368   { return coinAbcFactorization_;}
    00370
    00372 private:
    00373
    00376
    00377   AbcSimplex * model_;
    00379   CoinAbcAnyFactorization * coinAbcFactorization_;
    00381   int forceB_;
    00383   int goDenseThreshold_;
    00385   int goSmallThreshold_;
    00387   int goLongThreshold_;
    00389   int numberSlacks_;
    00391 };
    00392
    00393 #endif

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines