CoinOslFactorization.hpp
Go to the documentation of this file.
1 /* $Id: CoinOslFactorization.hpp 1416 2011-04-17 09:57:29Z stefan $ */
2 // Copyright (C) 1987, 2009, International Business Machines
3 // Corporation and others. All Rights Reserved.
4 // This code is licensed under the terms of the Eclipse Public License (EPL).
5 
6 /*
7  Authors
8 
9  John Forrest
10 
11  */
12 #ifndef CoinOslFactorization_H
13 #define CoinOslFactorization_H
14 #include <iostream>
15 #include <string>
16 #include <cassert>
17 #include "CoinTypes.hpp"
18 #include "CoinIndexedVector.hpp"
20 class CoinPackedMatrix;
28 typedef struct {int suc, pre;} EKKHlink;
29 typedef struct _EKKfactinfo {
30  double drtpiv;
31  double demark;
32  double zpivlu;
33  double zeroTolerance;
34  double areaFactor;
35  int *xrsadr;
36  int *xcsadr;
37  int *xrnadr;
38  int *xcnadr;
39  int *krpadr;
40  int *kcpadr;
41  int *mpermu;
42  int *bitArray;
43  int * back;
44  char * nonzero;
45  double * trueStart;
46  mutable double *kadrpm;
49  double *R_etas_element;
50 
51  int *xecadr;
52  int *xeradr;
53  double *xeeadr;
54  double *xe2adr;
57  double * kw1adr;
58  double * kw2adr;
59  double * kw3adr;
60  int * hpivcoR;
61  int nrow;
62  int nrowmx;
64  int firstLRow;
65  int maxinv;
66  int nnetas;
67  int iterin;
68  int iter0;
69  int invok;
70  int nbfinv;
72  int nnentl;
73  int nnentu;
74 #ifdef CLP_REUSE_ETAS
75  int save_nnentu;
76 #endif
77  int ndenuc;
78  int npivots; /* use as xpivsq in factorization */
79  int kmxeta;
80  int xnetal;
83  int iterno;
85  int lastSlack;
87  int xnetalval;
88  int lstart;
90  mutable int packedMode;
92  int nuspike;
93  bool rows_ok; /* replaces test using mrstrt[1] */
94 #ifdef CLP_REUSE_ETAS
95  mutable int reintro;
96 #endif
97  int nR_etas;
98  int sortedEta; /* if vector for F-T is sorted */
100  int ifvsol;
101  int eta_size;
104 } EKKfactinfo;
105 
107  friend void CoinOslFactorizationUnitTest( const std::string & mpsDir );
108 
109 public:
110 
117 
119  virtual ~CoinOslFactorization ( );
123  virtual CoinOtherFactorization * clone() const ;
125 
128  virtual void getAreas ( int numberRows,
130  int numberColumns,
131  CoinBigIndex maximumL,
132  CoinBigIndex maximumU );
133 
135  virtual void preProcess ( );
141  virtual int factor ( );
143  virtual void postProcess(const int * sequence, int * pivotVariable);
145  virtual void makeNonSingular(int * sequence, int numberColumns);
153  int factorize ( const CoinPackedMatrix & matrix,
154  int rowIsBasic[], int columnIsBasic[] ,
155  double areaFactor = 0.0 );
157 
160  virtual inline int numberElements ( ) const {
163  }
165  virtual CoinFactorizationDouble * elements() const;
167  virtual int * pivotRow() const;
169  virtual CoinFactorizationDouble * workArea() const;
171  virtual int * intWorkArea() const;
173  virtual int * numberInRow() const;
175  virtual int * numberInColumn() const;
177  virtual CoinBigIndex * starts() const;
179  virtual int * permuteBack() const;
181  virtual bool wantsTableauColumn() const;
186  virtual void setUsefulInformation(const int * info,int whereFrom);
188  virtual void maximumPivots ( int value );
189 
191  double maximumCoefficient() const;
193  double conditionNumber() const;
195  virtual void clearArrays();
197 
200 
208  virtual int replaceColumn ( CoinIndexedVector * regionSparse,
209  int pivotRow,
210  double pivotCheck ,
211  bool checkBeforeModifying=false,
212  double acceptablePivot=1.0e-8);
214 
224  virtual int updateColumnFT ( CoinIndexedVector * regionSparse,
225  CoinIndexedVector * regionSparse2,
226  bool noPermute=false);
229  virtual int updateColumn ( CoinIndexedVector * regionSparse,
230  CoinIndexedVector * regionSparse2,
231  bool noPermute=false) const;
233  virtual int updateTwoColumnsFT(CoinIndexedVector * regionSparse1,
234  CoinIndexedVector * regionSparse2,
235  CoinIndexedVector * regionSparse3,
236  bool noPermute=false);
241  virtual int updateColumnTranspose ( CoinIndexedVector * regionSparse,
242  CoinIndexedVector * regionSparse2) const;
244 
249  //inline void clearArrays()
251  //{ gutsOfDestructor();}
253  virtual int * indices() const;
255  virtual inline int * permute() const
256  { return NULL;/*pivotRow_*/;}
258 
260  void gutsOfDestructor(bool clearFact=true);
262  void gutsOfInitialize(bool zapFact=true);
264  void gutsOfCopy(const CoinOslFactorization &other);
265 
267 protected:
270  int checkPivot(double saveFromU, double oldPivot) const;
272 protected:
273 
279 };
280 #endif
struct _EKKfactinfo EKKfactinfo
virtual int updateColumnTranspose(CoinIndexedVector *regionSparse, CoinIndexedVector *regionSparse2) const
Updates one column (BTRAN) from regionSparse2 regionSparse starts as zero and is zero at end Note - i...
virtual int * indices() const
Get rid of all memory.
int CoinBigIndex
virtual int numberElements() const
Total number of elements in factorization.
CoinOslFactorization()
Default constructor.
virtual int * pivotRow() const
Returns pivot row.
int numberColumns_
Number of Columns in factorization.
virtual int updateColumnFT(CoinIndexedVector *regionSparse, CoinIndexedVector *regionSparse2, bool noPermute=false)
Updates one column (FTRAN) from regionSparse2 Tries to do FT update number returned is negative if no...
EKKfactinfo factInfo_
Osl factorization data.
virtual int * intWorkArea() const
Returns int work area.
int factorize(const CoinPackedMatrix &matrix, int rowIsBasic[], int columnIsBasic[], double areaFactor=0.0)
When part of LP - given by basic variables.
virtual int * numberInRow() const
Number of entries in each row.
virtual void postProcess(const int *sequence, int *pivotVariable)
Does post processing on valid factorization - putting variables on correct rows.
int numberColumns() const
Total number of columns in factorization.
virtual int updateColumn(CoinIndexedVector *regionSparse, CoinIndexedVector *regionSparse2, bool noPermute=false) const
This version has same effect as above with FTUpdate==false so number returned is always &gt;=0...
Abstract base class which also has some scalars so can be used from Dense or Simp.
Sparse Matrix Base Class.
virtual void clearArrays()
Get rid of all memory.
friend void CoinOslFactorizationUnitTest(const std::string &mpsDir)
virtual int * permuteBack() const
Returns permute back.
double CoinFactorizationDouble
Definition: CoinTypes.hpp:57
virtual CoinOtherFactorization * clone() const
Clone.
double maximumCoefficient() const
Returns maximum absolute value in factorization.
int checkPivot(double saveFromU, double oldPivot) const
Returns accuracy status of replaceColumn returns 0=OK, 1=Probably OK, 2=singular. ...
virtual void preProcess()
PreProcesses column ordered copy of basis.
virtual void getAreas(int numberRows, int numberColumns, CoinBigIndex maximumL, CoinBigIndex maximumU)
Gets space for a factorization.
virtual CoinFactorizationDouble * elements() const
Returns array to put basis elements in.
virtual int * numberInColumn() const
Number of entries in each column.
Indexed Vector.
virtual int factor()
Does most of factorization returning status 0 - OK -99 - needs more memory -1 - singular - use number...
int maximumPivots() const
Maximum number of pivots between factorizations.
virtual void setUsefulInformation(const int *info, int whereFrom)
Useful information for factorization 0 - iteration number whereFrom is 0 for factorize and 1 for repl...
virtual CoinBigIndex * starts() const
Returns array to put basis starts in.
virtual void makeNonSingular(int *sequence, int numberColumns)
Makes a non-singular basis by replacing variables.
virtual int * permute() const
Returns permute in.
int numberRows() const
Number of Rows after factorization.
virtual int updateTwoColumnsFT(CoinIndexedVector *regionSparse1, CoinIndexedVector *regionSparse2, CoinIndexedVector *regionSparse3, bool noPermute=false)
does FTRAN on two columns
virtual int replaceColumn(CoinIndexedVector *regionSparse, int pivotRow, double pivotCheck, bool checkBeforeModifying=false, double acceptablePivot=1.0e-8)
Replaces one Column to basis, returns 0=OK, 1=Probably OK, 2=singular, 3=no room If checkBeforeModify...
void gutsOfCopy(const CoinOslFactorization &other)
The real work of copy.
CoinOslFactorization & operator=(const CoinOslFactorization &other)
= copy
virtual bool wantsTableauColumn() const
Returns true if wants tableauColumn in replaceColumn.
virtual CoinFactorizationDouble * workArea() const
Returns work area.
void gutsOfInitialize(bool zapFact=true)
The real work of constructor.
int numberPivots_
Number pivots since last factorization.
void gutsOfDestructor(bool clearFact=true)
The real work of desstructor.
int numberRows_
Number of Rows in factorization.
virtual ~CoinOslFactorization()
Destructor.
double conditionNumber() const
Condition number - product of pivots after factorization.