# CoinOslFactorization.hpp

Go to the documentation of this file.

    00001 /* $Id: CoinOslFactorization.hpp 1416 2011-04-17 09:57:29Z stefan $ */
    00002 // Copyright (C) 1987, 2009, International Business Machines
    00003 // Corporation and others.  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  */
    00012 #ifndef CoinOslFactorization_H
    00013 #define CoinOslFactorization_H
    00014 #include <iostream>
    00015 #include <string>
    00016 #include <cassert>
    00017 #include "CoinTypes.hpp"
    00018 #include "CoinIndexedVector.hpp"
    00019 #include "CoinDenseFactorization.hpp"
    00020 class CoinPackedMatrix;
    00028 typedef struct {int suc, pre;} EKKHlink;
    00029 typedef struct _EKKfactinfo {
    00030   double drtpiv;
    00031   double demark;
    00032   double zpivlu;
    00033   double zeroTolerance;
    00034   double areaFactor;
    00035   int *xrsadr;
    00036   int *xcsadr;
    00037   int *xrnadr;
    00038   int *xcnadr;
    00039   int *krpadr;
    00040   int *kcpadr;
    00041   int *mpermu;
    00042   int *bitArray;
    00043   int * back;
    00044   char * nonzero;
    00045   double * trueStart;
    00046   mutable double *kadrpm;
    00047   int *R_etas_index;
    00048   int *R_etas_start;
    00049   double *R_etas_element;
    00050
    00051   int *xecadr;
    00052   int *xeradr;
    00053   double *xeeadr;
    00054   double *xe2adr;
    00055   EKKHlink * kp1adr;
    00056   EKKHlink * kp2adr;
    00057   double * kw1adr;
    00058   double * kw2adr;
    00059   double * kw3adr;
    00060   int * hpivcoR;
    00061   int nrow;
    00062   int nrowmx;
    00063   int firstDoRow;
    00064   int firstLRow;
    00065   int maxinv;
    00066   int nnetas;
    00067   int iterin;
    00068   int iter0;
    00069   int invok;
    00070   int nbfinv;
    00071   int num_resets;
    00072   int nnentl;
    00073   int nnentu;
    00074 #ifdef CLP_REUSE_ETAS
    00075   int save_nnentu;
    00076 #endif
    00077   int ndenuc;
    00078   int npivots; /* use as xpivsq in factorization */
    00079   int kmxeta;
    00080   int xnetal;
    00081   int first_dense;
    00082   int last_dense;
    00083   int iterno;
    00084   int numberSlacks;
    00085   int lastSlack;
    00086   int firstNonSlack;
    00087   int xnetalval;
    00088   int lstart;
    00089   int if_sparse_update;
    00090   mutable int packedMode;
    00091   int switch_off_sparse_update;
    00092   int nuspike;
    00093   bool rows_ok; /* replaces test using mrstrt[1] */
    00094 #ifdef CLP_REUSE_ETAS
    00095   mutable int reintro;
    00096 #endif
    00097   int nR_etas;
    00098   int sortedEta; /* if vector for F-T is sorted */
    00099   int lastEtaCount;
    00100   int ifvsol;
    00101   int eta_size;
    00102   int last_eta_size;
    00103   int maxNNetas;
    00104 } EKKfactinfo;
    00105
    00106 class CoinOslFactorization : public CoinOtherFactorization {
    00107    friend void CoinOslFactorizationUnitTest( const std::string & mpsDir );
    00108
    00109 public:
    00110
    00113
    00114   CoinOslFactorization (  );
    00116   CoinOslFactorization ( const CoinOslFactorization &other);
    00117
    00119   virtual ~CoinOslFactorization (  );
    00121   CoinOslFactorization & operator = ( const CoinOslFactorization & other );
    00123   virtual CoinOtherFactorization * clone() const ;
    00125
    00128
    00129   virtual void getAreas ( int numberRows,
    00130                   int numberColumns,
    00131                   CoinBigIndex maximumL,
    00132                   CoinBigIndex maximumU );
    00133
    00135   virtual void preProcess ( );
    00141   virtual int factor ( );
    00143   virtual void postProcess(const int * sequence, int * pivotVariable);
    00145   virtual void makeNonSingular(int * sequence, int numberColumns);
    00153   int factorize ( const CoinPackedMatrix & matrix,
    00154                   int rowIsBasic[], int columnIsBasic[] ,
    00155                   double areaFactor = 0.0 );
    00157
    00160
    00161   virtual inline int numberElements (  ) const {
    00162     return numberRows_*(numberColumns_+numberPivots_);
    00163   }
    00165   virtual CoinFactorizationDouble * elements() const;
    00167   virtual int * pivotRow() const;
    00169   virtual CoinFactorizationDouble * workArea() const;
    00171   virtual int * intWorkArea() const;
    00173   virtual int * numberInRow() const;
    00175   virtual int * numberInColumn() const;
    00177   virtual CoinBigIndex * starts() const;
    00179   virtual int * permuteBack() const;
    00181   virtual bool wantsTableauColumn() const;
    00186   virtual void setUsefulInformation(const int * info,int whereFrom);
    00188   virtual void maximumPivots (  int value );
    00189
    00191   double maximumCoefficient() const;
    00193   double conditionNumber() const;
    00195   virtual void clearArrays();
    00197
    00200
    00208   virtual int replaceColumn ( CoinIndexedVector * regionSparse,
    00209                       int pivotRow,
    00210                       double pivotCheck ,
    00211                               bool checkBeforeModifying=false,
    00212                               double acceptablePivot=1.0e-8);
    00214
    00224   virtual int updateColumnFT ( CoinIndexedVector * regionSparse,
    00225                                       CoinIndexedVector * regionSparse2,
    00226                                       bool noPermute=false);
    00229   virtual int updateColumn ( CoinIndexedVector * regionSparse,
    00230                      CoinIndexedVector * regionSparse2,
    00231                      bool noPermute=false) const;
    00233     virtual int updateTwoColumnsFT(CoinIndexedVector * regionSparse1,
    00234                            CoinIndexedVector * regionSparse2,
    00235                            CoinIndexedVector * regionSparse3,
    00236                            bool noPermute=false);
    00241   virtual int updateColumnTranspose ( CoinIndexedVector * regionSparse,
    00242                               CoinIndexedVector * regionSparse2) const;
    00244
    00245
    00249
    00250   //inline void clearArrays()
    00251   //{ gutsOfDestructor();}
    00253   virtual int * indices() const;
    00255   virtual inline int * permute() const
    00256   { return NULL;/*pivotRow_*/;}
    00258
    00260   void gutsOfDestructor(bool clearFact=true);
    00262   void gutsOfInitialize(bool zapFact=true);
    00264   void gutsOfCopy(const CoinOslFactorization &other);
    00265
    00267 protected:
    00270   int checkPivot(double saveFromU, double oldPivot) const;
    00272 protected:
    00273
    00276
    00277   EKKfactinfo factInfo_;
    00279 };
    00280 #endif

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines