CoinOslFactorization.hpp
Go to the documentation of this file.
1 /* $Id: CoinOslFactorization.hpp 1191 2009-07-25 08:38:12Z forrest $ */
2 // Copyright (C) 1987, 2009, International Business Machines
3 // Corporation and others. All Rights Reserved.
4 
5 /*
6  Authors
7 
8  John Forrest
9 
10  */
11 #ifndef CoinOslFactorization_H
12 #define CoinOslFactorization_H
13 #include <iostream>
14 #include <string>
15 #include <cassert>
16 #include "CoinFinite.hpp"
17 #include "CoinIndexedVector.hpp"
19 class CoinPackedMatrix;
27 typedef struct {int suc, pre;} EKKHlink;
28 typedef struct _EKKfactinfo {
29  double drtpiv;
30  double demark;
31  double zpivlu;
32  double zeroTolerance;
33  double areaFactor;
34  int *xrsadr;
35  int *xcsadr;
36  int *xrnadr;
37  int *xcnadr;
38  int *krpadr;
39  int *kcpadr;
40  int *mpermu;
41  int *bitArray;
42  int * back;
43  char * nonzero;
44  double * trueStart;
45  mutable double *kadrpm;
48  double *R_etas_element;
49 
50  int *xecadr;
51  int *xeradr;
52  double *xeeadr;
53  double *xe2adr;
56  double * kw1adr;
57  double * kw2adr;
58  double * kw3adr;
59  int * hpivcoR;
60  int nrow;
61  int nrowmx;
63  int firstLRow;
64  int maxinv;
65  int nnetas;
66  int iterin;
67  int iter0;
68  int invok;
69  int nbfinv;
71  int nnentl;
72  int nnentu;
73  int ndenuc;
74  int npivots; /* use as xpivsq in factorization */
75  int kmxeta;
76  int xnetal;
79  int iterno;
81  int lastSlack;
83  int xnetalval;
84  int lstart;
86  mutable int packedMode;
88  int nuspike;
89  bool rows_ok; /* replaces test using mrstrt[1] */
90 
91  int nR_etas;
92  int sortedEta; /* if vector for F-T is sorted */
94  int ifvsol;
95  int eta_size;
97  int maxNNetas;
98 } EKKfactinfo;
99 
101  friend void CoinOslFactorizationUnitTest( const std::string & mpsDir );
102 
103 public:
104 
111 
113  virtual ~CoinOslFactorization ( );
117  virtual CoinOtherFactorization * clone() const ;
119 
122  virtual void getAreas ( int numberRows,
124  int numberColumns,
125  CoinBigIndex maximumL,
126  CoinBigIndex maximumU );
127 
129  virtual void preProcess ( );
135  virtual int factor ( );
137  virtual void postProcess(const int * sequence, int * pivotVariable);
139  virtual void makeNonSingular(int * sequence, int numberColumns);
147  int factorize ( const CoinPackedMatrix & matrix,
148  int rowIsBasic[], int columnIsBasic[] ,
149  double areaFactor = 0.0 );
151 
154  virtual inline int numberElements ( ) const {
157  }
159  virtual CoinFactorizationDouble * elements() const;
161  virtual int * pivotRow() const;
163  virtual CoinFactorizationDouble * workArea() const;
165  virtual int * intWorkArea() const;
167  virtual int * numberInRow() const;
169  virtual int * numberInColumn() const;
171  virtual CoinBigIndex * starts() const;
173  virtual int * permuteBack() const;
175  virtual bool wantsTableauColumn() const;
180  virtual void setUsefulInformation(const int * info,int whereFrom);
182  virtual void maximumPivots ( int value );
183 
185  double maximumCoefficient() const;
187  double conditionNumber() const;
189  virtual void clearArrays();
191 
194 
202  virtual int replaceColumn ( CoinIndexedVector * regionSparse,
203  int pivotRow,
204  double pivotCheck ,
205  bool checkBeforeModifying=false,
206  double acceptablePivot=1.0e-8);
208 
218  virtual int updateColumnFT ( CoinIndexedVector * regionSparse,
219  CoinIndexedVector * regionSparse2,
220  bool noPermute=false);
223  virtual int updateColumn ( CoinIndexedVector * regionSparse,
224  CoinIndexedVector * regionSparse2,
225  bool noPermute=false) const;
227  virtual int updateTwoColumnsFT(CoinIndexedVector * regionSparse1,
228  CoinIndexedVector * regionSparse2,
229  CoinIndexedVector * regionSparse3,
230  bool noPermute=false);
235  virtual int updateColumnTranspose ( CoinIndexedVector * regionSparse,
236  CoinIndexedVector * regionSparse2) const;
238 
243  //inline void clearArrays()
245  //{ gutsOfDestructor();}
247  virtual int * indices() const;
249  virtual inline int * permute() const
250  { return NULL;/*pivotRow_*/;}
252 
254  void gutsOfDestructor(bool clearFact=true);
256  void gutsOfInitialize(bool zapFact=true);
258  void gutsOfCopy(const CoinOslFactorization &other);
259 
261 protected:
264  int checkPivot(double saveFromU, double oldPivot) const;
266 protected:
267 
273 };
274 #endif