CoinUtils  2.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CoinDenseFactorization.hpp
Go to the documentation of this file.
1 /* $Id: CoinDenseFactorization.hpp 1416 2011-04-17 09:57:29Z stefan $ */
2 // Copyright (C) 2008, 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 /*
8  Authors
9 
10  John Forrest
11 
12  */
13 #ifndef CoinDenseFactorization_H
14 #define CoinDenseFactorization_H
15 
16 #include <iostream>
17 #include <string>
18 #include <cassert>
19 #include "CoinTypes.hpp"
20 #include "CoinIndexedVector.hpp"
21 #include "CoinFactorization.hpp"
22 class CoinPackedMatrix;
25 
26 public:
27 
34 
36  virtual ~CoinOtherFactorization ( );
39 
41  virtual CoinOtherFactorization * clone() const = 0;
43 
46  inline int status ( ) const {
48  return status_;
49  }
51  inline void setStatus ( int value)
52  { status_=value; }
54  inline int pivots ( ) const {
55  return numberPivots_;
56  }
58  inline void setPivots ( int value )
59  { numberPivots_=value; }
61  inline void setNumberRows(int value)
62  { numberRows_ = value; }
64  inline int numberRows ( ) const {
65  return numberRows_;
66  }
68  inline int numberColumns ( ) const {
69  return numberColumns_;
70  }
72  inline int numberGoodColumns ( ) const {
73  return numberGoodU_;
74  }
76  inline void relaxAccuracyCheck(double value)
77  { relaxCheck_ = value;}
78  inline double getAccuracyCheck() const
79  { return relaxCheck_;}
81  inline int maximumPivots ( ) const {
82  return maximumPivots_ ;
83  }
85  virtual void maximumPivots ( int value );
86 
88  inline double pivotTolerance ( ) const {
89  return pivotTolerance_ ;
90  }
91  void pivotTolerance ( double value );
93  inline double zeroTolerance ( ) const {
94  return zeroTolerance_ ;
95  }
96  void zeroTolerance ( double value );
97 #ifndef COIN_FAST_CODE
98  inline double slackValue ( ) const {
100  return slackValue_ ;
101  }
102  void slackValue ( double value );
103 #endif
104  virtual CoinFactorizationDouble * elements() const;
107  virtual int * pivotRow() const;
109  virtual CoinFactorizationDouble * workArea() const;
111  virtual int * intWorkArea() const;
113  virtual int * numberInRow() const;
115  virtual int * numberInColumn() const;
117  virtual CoinBigIndex * starts() const;
119  virtual int * permuteBack() const;
124  inline int solveMode() const
125  { return solveMode_ ;}
130  inline void setSolveMode(int value)
131  { solveMode_ = value;}
133  virtual bool wantsTableauColumn() const;
138  virtual void setUsefulInformation(const int * info,int whereFrom);
140  virtual void clearArrays() {}
142 
144  virtual int * indices() const = 0;
147  virtual int * permute() const = 0;
149  virtual int numberElements ( ) const = 0;
151 
153  virtual void getAreas ( int numberRows,
155  int numberColumns,
156  CoinBigIndex maximumL,
157  CoinBigIndex maximumU ) = 0;
158 
160  virtual void preProcess ( ) = 0;
166  virtual int factor ( ) = 0;
168  virtual void postProcess(const int * sequence, int * pivotVariable) = 0;
170  virtual void makeNonSingular(int * sequence, int numberColumns) = 0;
172 
175 
183  virtual int replaceColumn ( CoinIndexedVector * regionSparse,
184  int pivotRow,
185  double pivotCheck ,
186  bool checkBeforeModifying=false,
187  double acceptablePivot=1.0e-8)=0;
189 
199  virtual int updateColumnFT ( CoinIndexedVector * regionSparse,
200  CoinIndexedVector * regionSparse2,
201  bool noPermute=false) = 0;
204  virtual int updateColumn ( CoinIndexedVector * regionSparse,
205  CoinIndexedVector * regionSparse2,
206  bool noPermute=false) const = 0;
208  virtual int updateTwoColumnsFT(CoinIndexedVector * regionSparse1,
209  CoinIndexedVector * regionSparse2,
210  CoinIndexedVector * regionSparse3,
211  bool noPermute=false) = 0;
216  virtual int updateColumnTranspose ( CoinIndexedVector * regionSparse,
217  CoinIndexedVector * regionSparse2) const = 0;
219 
221 protected:
222 
225  double pivotTolerance_;
229 #ifndef COIN_FAST_CODE
230  double slackValue_;
232 #else
233 #ifndef slackValue_
234 #define slackValue_ -1.0
235 #endif
236 #endif
237  double relaxCheck_;
252  int status_;
258  int * pivotRow_;
272 };
283  friend void CoinDenseFactorizationUnitTest( const std::string & mpsDir );
284 
285 public:
286 
293 
295  virtual ~CoinDenseFactorization ( );
299  virtual CoinOtherFactorization * clone() const ;
301 
304  virtual void getAreas ( int numberRows,
306  int numberColumns,
307  CoinBigIndex maximumL,
308  CoinBigIndex maximumU );
309 
311  virtual void preProcess ( );
317  virtual int factor ( );
319  virtual void postProcess(const int * sequence, int * pivotVariable);
321  virtual void makeNonSingular(int * sequence, int numberColumns);
323 
326  virtual inline int numberElements ( ) const {
329  }
331  double maximumCoefficient() const;
333 
336 
344  virtual int replaceColumn ( CoinIndexedVector * regionSparse,
345  int pivotRow,
346  double pivotCheck ,
347  bool checkBeforeModifying=false,
348  double acceptablePivot=1.0e-8);
350 
360  virtual inline int updateColumnFT ( CoinIndexedVector * regionSparse,
361  CoinIndexedVector * regionSparse2,
362  bool = false)
363  { return updateColumn(regionSparse,regionSparse2);}
366  virtual int updateColumn ( CoinIndexedVector * regionSparse,
367  CoinIndexedVector * regionSparse2,
368  bool noPermute=false) const;
370  virtual int updateTwoColumnsFT(CoinIndexedVector * regionSparse1,
371  CoinIndexedVector * regionSparse2,
372  CoinIndexedVector * regionSparse3,
373  bool noPermute=false);
378  virtual int updateColumnTranspose ( CoinIndexedVector * regionSparse,
379  CoinIndexedVector * regionSparse2) const;
381 
386  inline void clearArrays()
388  { gutsOfDestructor();}
390  virtual inline int * indices() const
391  { return reinterpret_cast<int *> (elements_+numberRows_*numberRows_);}
393  virtual inline int * permute() const
394  { return NULL;/*pivotRow_*/;}
396 
398  void gutsOfDestructor();
400  void gutsOfInitialize();
402  void gutsOfCopy(const CoinDenseFactorization &other);
403 
405 protected:
408  int checkPivot(double saveFromU, double oldPivot) const;
410 protected:
411 
414 
415 };
416 #endif