Ignore:
Timestamp:
Jan 2, 2008 5:14:29 AM (12 years ago)
Author:
forrest
Message:

changes to try and make faster

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Clp/src/ClpFactorization.hpp

    r1055 r1147  
    1616    a genuine ClpNetworkBasis object
    1717*/
    18 
    19 class ClpFactorization : public CoinFactorization {
     18class ClpFactorization
     19#ifndef CLP_MULTIPLE_FACTORIZATIONS   
     20  : public CoinFactorization
     21#endif
     22{
     23
     24  //friend class CoinFactorization;
    2025 
    2126public:
     
    9398                              CoinIndexedVector * regionSparse2) const;
    9499  //@}
     100#ifdef CLP_MULTIPLE_FACTORIZATIONS   
     101  /**@name Lifted from CoinFactorization */
     102  //@{
     103  /// Total number of elements in factorization
     104  inline int numberElements (  ) const {
     105    if (coinFactorizationA_) return coinFactorizationA_->numberElements(); else return 0 ;
     106  }
     107  /// Returns address of permute region
     108  inline int *permute (  ) const {
     109    if (coinFactorizationA_) return coinFactorizationA_->permute(); else return NULL ;
     110  }
     111  /// Returns address of pivotColumn region (also used for permuting)
     112  inline int *pivotColumn (  ) const {
     113    if (coinFactorizationA_) return coinFactorizationA_->pivotColumn(); else return NULL ;
     114  }
     115  /// Maximum number of pivots between factorizations
     116  inline int maximumPivots (  ) const {
     117    if (coinFactorizationA_) return coinFactorizationA_->maximumPivots();  else return 0 ;
     118  }
     119  /// Set maximum number of pivots between factorizations
     120  inline void maximumPivots (  int value) {
     121    if (coinFactorizationA_) coinFactorizationA_->maximumPivots(value);
     122  }
     123  /// Returns number of pivots since factorization
     124  inline int pivots (  ) const {
     125    if (coinFactorizationA_) return coinFactorizationA_->pivots(); else return 0 ;
     126  }
     127  /// Whether larger areas needed
     128  inline double areaFactor (  ) const {
     129    if (coinFactorizationA_) return coinFactorizationA_->areaFactor(); else return 0.0 ;
     130  }
     131  /// Set whether larger areas needed
     132  inline void areaFactor ( double value) {
     133    if (coinFactorizationA_) coinFactorizationA_->areaFactor(value);
     134  }
     135  /// Zero tolerance
     136  inline double zeroTolerance (  ) const {
     137    if (coinFactorizationA_) return coinFactorizationA_->zeroTolerance();  else return 1.0e-13 ;
     138  }
     139  /// Set zero tolerance
     140  inline void zeroTolerance (  double value) {
     141    if (coinFactorizationA_) coinFactorizationA_->zeroTolerance(value);
     142  }
     143  /**  get sparse threshold */
     144  inline int sparseThreshold ( ) const
     145  { if (coinFactorizationA_) return coinFactorizationA_->sparseThreshold(); else return 0 ;}
     146  /**  Set sparse threshold */
     147  inline void sparseThreshold ( int value)
     148  { if (coinFactorizationA_) coinFactorizationA_->sparseThreshold(value); }
     149  /// Returns status
     150  inline int status (  ) const {
     151    if (coinFactorizationA_) return coinFactorizationA_->status(); else return 0 ;
     152  }
     153  /// Returns number of dense rows
     154  inline int numberDense() const
     155  { if (coinFactorizationA_) return coinFactorizationA_->numberDense(); else return 0 ;}
     156#if 0
     157  /// Returns number in U area
     158  inline CoinBigIndex numberElementsU (  ) const {
     159    if (coinFactorizationA_) return coinFactorizationA_->numberElementsU(); else return 0 ;
     160  }
     161  /// Returns number in L area
     162  inline CoinBigIndex numberElementsL (  ) const {
     163    if (coinFactorizationA_) return coinFactorizationA_->numberElementsL(); else return 0 ;
     164  }
     165  /// Returns number in R area
     166  inline CoinBigIndex numberElementsR (  ) const {
     167    if (coinFactorizationA_) return coinFactorizationA_->numberElementsR(); else return 0 ;
     168  }
     169#endif
     170  inline bool timeToRefactorize() const
     171  {
     172    if (coinFactorizationA_) {
     173      return (coinFactorizationA_->pivots()*3>coinFactorizationA_->maximumPivots()*2&&
     174              coinFactorizationA_->numberElementsR()*3>(coinFactorizationA_->numberElementsL()+
     175                                                        coinFactorizationA_->numberElementsU())*2+1000&&
     176              !coinFactorizationA_->numberDense());
     177    } else {
     178      return false;
     179    }
     180  }
     181  /// Level of detail of messages
     182  inline int messageLevel (  ) const {
     183    if (coinFactorizationA_) return coinFactorizationA_->messageLevel();  else return 0 ;
     184  }
     185  /// Set level of detail of messages
     186  inline void messageLevel (  int value) {
     187    if (coinFactorizationA_) coinFactorizationA_->messageLevel(value);
     188  }
     189  /// Get rid of all memory
     190  inline void clearArrays()
     191  { if (coinFactorizationA_) coinFactorizationA_->clearArrays();}
     192  /// Number of Rows after factorization
     193  inline int numberRows (  ) const {
     194    if (coinFactorizationA_) return coinFactorizationA_->numberRows(); else return 0 ;
     195  }
     196  /// Gets dense threshold
     197  inline int denseThreshold() const
     198  { if (coinFactorizationA_) return coinFactorizationA_->denseThreshold(); else return 0 ;}
     199  /// Sets dense threshold
     200  inline void setDenseThreshold(int value)
     201  { if (coinFactorizationA_) coinFactorizationA_->setDenseThreshold(value);}
     202  /// Pivot tolerance
     203  inline double pivotTolerance (  ) const {
     204    if (coinFactorizationA_) return coinFactorizationA_->pivotTolerance();  else return 1.0e-8 ;
     205  }
     206  /// Set pivot tolerance
     207  inline void pivotTolerance (  double value) {
     208    if (coinFactorizationA_) coinFactorizationA_->pivotTolerance(value);
     209  }
     210  /// Allows change of pivot accuracy check 1.0 == none >1.0 relaxed
     211  inline void relaxAccuracyCheck(double value)
     212  { if (coinFactorizationA_) coinFactorizationA_->relaxAccuracyCheck(value);}
     213  /** Array persistence flag
     214      If 0 then as now (delete/new)
     215      1 then only do arrays if bigger needed
     216      2 as 1 but give a bit extra if bigger needed
     217  */
     218  inline int persistenceFlag() const
     219  { if (coinFactorizationA_) return coinFactorizationA_->persistenceFlag(); else return 0 ;}
     220  inline void setPersistenceFlag(int value)
     221  { if (coinFactorizationA_) coinFactorizationA_->setPersistenceFlag(value);}
     222  /// Delete all stuff (leaves as after CoinFactorization())
     223  inline void almostDestructor()
     224  { if (coinFactorizationA_) coinFactorizationA_->almostDestructor(); }
     225  /// Returns areaFactor but adjusted for dense
     226  inline double adjustedAreaFactor() const
     227  { if (coinFactorizationA_) return coinFactorizationA_->adjustedAreaFactor(); else return 0.0 ; }
     228  inline void setBiasLU(int value)
     229  { if (coinFactorizationA_) coinFactorizationA_->setBiasLU(value);}
     230  /// true if Forrest Tomlin update, false if PFI
     231  inline void setForrestTomlin(bool value)
     232  { if (coinFactorizationA_) coinFactorizationA_->setForrestTomlin(value);}
     233  /// Sets default values
     234  inline void setDefaultValues() {
     235    if (coinFactorizationA_) {
     236      coinFactorizationA_->increasingRows(2);
     237      // row activities have negative sign
     238      coinFactorizationA_->slackValue(-1.0);
     239      coinFactorizationA_->zeroTolerance(1.0e-13);
     240    }
     241  }
     242#else
     243  inline bool timeToRefactorize() const
     244  {
     245    return (pivots()*3>maximumPivots()*2&&
     246            numberElementsR()*3>(numberElementsL()+numberElementsU())*2+1000&&
     247            !numberDense());
     248  }
     249  /// Sets default values
     250  inline void setDefaultValues() {
     251    increasingRows(2);
     252    // row activities have negative sign
     253    slackValue(-1.0);
     254    zeroTolerance(1.0e-13);
     255  }
     256#endif
     257  //@}
    95258   
    96259  /**@name other stuff */
     
    124287  ClpNetworkBasis * networkBasis_;
    125288#endif
     289#ifdef CLP_MULTIPLE_FACTORIZATIONS   
     290  /// Pointer to CoinFactorization
     291  CoinFactorization * coinFactorizationA_;
     292#endif
    126293  //@}
    127294};
Note: See TracChangeset for help on using the changeset viewer.