CoinDenseFactorization.hpp
Go to the documentation of this file.
1 /* $Id: CoinDenseFactorization.hpp 1191 2009-07-25 08:38:12Z forrest $ */
2 // Copyright (C) 2008, International Business Machines
3 // Corporation and others. All Rights Reserved.
4 
5 /*
6  Authors
7 
8  John Forrest
9 
10  */
11 #ifndef CoinDenseFactorization_H
12 #define CoinDenseFactorization_H
13 
14 #include <iostream>
15 #include <string>
16 #include <cassert>
17 #include "CoinFinite.hpp"
18 #include "CoinIndexedVector.hpp"
19 #include "CoinFactorization.hpp"
20 class CoinPackedMatrix;
23 
24 public:
25 
32 
34  virtual ~CoinOtherFactorization ( );
37 
39  virtual CoinOtherFactorization * clone() const = 0;
41 
44  inline int status ( ) const {
46  return status_;
47  }
49  inline void setStatus ( int value)
50  { status_=value; }
52  inline int pivots ( ) const {
53  return numberPivots_;
54  }
56  inline void setPivots ( int value )
57  { numberPivots_=value; }
59  inline void setNumberRows(int value)
60  { numberRows_ = value; }
62  inline int numberRows ( ) const {
63  return numberRows_;
64  }
66  inline int numberColumns ( ) const {
67  return numberColumns_;
68  }
70  inline int numberGoodColumns ( ) const {
71  return numberGoodU_;
72  }
74  inline void relaxAccuracyCheck(double value)
75  { relaxCheck_ = value;}
76  inline double getAccuracyCheck() const
77  { return relaxCheck_;}
79  inline int maximumPivots ( ) const {
80  return maximumPivots_ ;
81  }
83  virtual void maximumPivots ( int value );
84 
86  inline double pivotTolerance ( ) const {
87  return pivotTolerance_ ;
88  }
89  void pivotTolerance ( double value );
91  inline double zeroTolerance ( ) const {
92  return zeroTolerance_ ;
93  }
94  void zeroTolerance ( double value );
95 #ifndef COIN_FAST_CODE
96  inline double slackValue ( ) const {
98  return slackValue_ ;
99  }
100  void slackValue ( double value );
101 #endif
102  virtual CoinFactorizationDouble * elements() const;
105  virtual int * pivotRow() const;
107  virtual CoinFactorizationDouble * workArea() const;
109  virtual int * intWorkArea() const;
111  virtual int * numberInRow() const;
113  virtual int * numberInColumn() const;
115  virtual CoinBigIndex * starts() const;
117  virtual int * permuteBack() const;
122  inline int solveMode() const
123  { return solveMode_ ;}
128  inline void setSolveMode(int value)
129  { solveMode_ = value;}
131  virtual bool wantsTableauColumn() const;
136  virtual void setUsefulInformation(const int * info,int whereFrom);
138  virtual void clearArrays() {}
140 
142  virtual int * indices() const = 0;
145  virtual int * permute() const = 0;
147  virtual int numberElements ( ) const = 0;
149 
151  virtual void getAreas ( int numberRows,
153  int numberColumns,
154  CoinBigIndex maximumL,
155  CoinBigIndex maximumU ) = 0;
156 
158  virtual void preProcess ( ) = 0;
164  virtual int factor ( ) = 0;
166  virtual void postProcess(const int * sequence, int * pivotVariable) = 0;
168  virtual void makeNonSingular(int * sequence, int numberColumns) = 0;
170 
173 
181  virtual int replaceColumn ( CoinIndexedVector * regionSparse,
182  int pivotRow,
183  double pivotCheck ,
184  bool checkBeforeModifying=false,
185  double acceptablePivot=1.0e-8)=0;
187 
197  virtual int updateColumnFT ( CoinIndexedVector * regionSparse,
198  CoinIndexedVector * regionSparse2,
199  bool noPermute=false) = 0;
202  virtual int updateColumn ( CoinIndexedVector * regionSparse,
203  CoinIndexedVector * regionSparse2,
204  bool noPermute=false) const = 0;
206  virtual int updateTwoColumnsFT(CoinIndexedVector * regionSparse1,
207  CoinIndexedVector * regionSparse2,
208  CoinIndexedVector * regionSparse3,
209  bool noPermute=false) = 0;
214  virtual int updateColumnTranspose ( CoinIndexedVector * regionSparse,
215  CoinIndexedVector * regionSparse2) const = 0;
217 
219 protected:
220 
223  double pivotTolerance_;
227 #ifndef COIN_FAST_CODE
228  double slackValue_;
230 #else
231 #ifndef slackValue_
232 #define slackValue_ -1.0
233 #endif
234 #endif
235  double relaxCheck_;
250  int status_;
256  int * pivotRow_;
270 };
281  friend void CoinDenseFactorizationUnitTest( const std::string & mpsDir );
282 
283 public:
284 
291 
293  virtual ~CoinDenseFactorization ( );
297  virtual CoinOtherFactorization * clone() const ;
299 
302  virtual void getAreas ( int numberRows,
304  int numberColumns,
305  CoinBigIndex maximumL,
306  CoinBigIndex maximumU );
307 
309  virtual void preProcess ( );
315  virtual int factor ( );
317  virtual void postProcess(const int * sequence, int * pivotVariable);
319  virtual void makeNonSingular(int * sequence, int numberColumns);
321 
324  virtual inline int numberElements ( ) const {
327  }
329  double maximumCoefficient() const;
331 
334 
342  virtual int replaceColumn ( CoinIndexedVector * regionSparse,
343  int pivotRow,
344  double pivotCheck ,
345  bool checkBeforeModifying=false,
346  double acceptablePivot=1.0e-8);
348 
358  virtual inline int updateColumnFT ( CoinIndexedVector * regionSparse,
359  CoinIndexedVector * regionSparse2,
360  bool = false)
361  { return updateColumn(regionSparse,regionSparse2);}
364  virtual int updateColumn ( CoinIndexedVector * regionSparse,
365  CoinIndexedVector * regionSparse2,
366  bool noPermute=false) const;
368  virtual int updateTwoColumnsFT(CoinIndexedVector * regionSparse1,
369  CoinIndexedVector * regionSparse2,
370  CoinIndexedVector * regionSparse3,
371  bool noPermute=false);
376  virtual int updateColumnTranspose ( CoinIndexedVector * regionSparse,
377  CoinIndexedVector * regionSparse2) const;
379 
384  inline void clearArrays()
386  { gutsOfDestructor();}
388  virtual inline int * indices() const
389  { return reinterpret_cast<int *> (elements_+numberRows_*numberRows_);}
391  virtual inline int * permute() const
392  { return NULL;/*pivotRow_*/;}
394 
396  void gutsOfDestructor();
398  void gutsOfInitialize();
400  void gutsOfCopy(const CoinDenseFactorization &other);
401 
403 protected:
406  int checkPivot(double saveFromU, double oldPivot) const;
408 protected:
409 
412 
413 };
414 #endif