- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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"
19 #include "CoinDenseFactorization.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;
47 int *R_etas_index;
48 int *R_etas_start;
49 double *R_etas_element;
50
51 int *xecadr;
52 int *xeradr;
53 double *xeeadr;
54 double *xe2adr;
55 EKKHlink * kp1adr;
56 EKKHlink * kp2adr;
57 double * kw1adr;
58 double * kw2adr;
59 double * kw3adr;
60 int * hpivcoR;
61 int nrow;
62 int nrowmx;
63 int firstDoRow;
64 int firstLRow;
65 int maxinv;
66 int nnetas;
67 int iterin;
68 int iter0;
69 int invok;
70 int nbfinv;
71 int num_resets;
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;
81 int first_dense;
82 int last_dense;
83 int iterno;
84 int numberSlacks;
85 int lastSlack;
86 int firstNonSlack;
87 int xnetalval;
88 int lstart;
89 int if_sparse_update;
90 mutable int packedMode;
91 int switch_off_sparse_update;
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 */
99 int lastEtaCount;
100 int ifvsol;
101 int eta_size;
102 int last_eta_size;
103 int maxNNetas;
104 } EKKfactinfo;
105
106 class CoinOslFactorization : public CoinOtherFactorization {
107 friend void CoinOslFactorizationUnitTest( const std::string & mpsDir );
108
109 public:
110
113 CoinOslFactorization ( );
116 CoinOslFactorization ( const CoinOslFactorization &other);
117
119 virtual ~CoinOslFactorization ( );
121 CoinOslFactorization & operator = ( const CoinOslFactorization & other );
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 {
162 return numberRows_*(numberColumns_+numberPivots_);
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
276 EKKfactinfo factInfo_;
279 };
280 #endif
_EKKfactinfo::xrnadr
int * xrnadr
Definition: CoinOslFactorization.hpp:37
EKKfactinfo
struct _EKKfactinfo EKKfactinfo
CoinOslFactorization::updateColumnTranspose
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...
CoinOslFactorization::indices
virtual int * indices() const
Get rid of all memory.
CoinBigIndex
int CoinBigIndex
Definition: Coin_C_defines.h:105
CoinOslFactorization::numberElements
virtual int numberElements() const
Total number of elements in factorization.
Definition: CoinOslFactorization.hpp:161
CoinOslFactorization::CoinOslFactorization
CoinOslFactorization()
Default constructor.
_EKKfactinfo::xnetal
int xnetal
Definition: CoinOslFactorization.hpp:80
CoinOslFactorization::pivotRow
virtual int * pivotRow() const
Returns pivot row.
_EKKfactinfo::iterin
int iterin
Definition: CoinOslFactorization.hpp:67
_EKKfactinfo::drtpiv
double drtpiv
Definition: CoinOslFactorization.hpp:30
CoinOtherFactorization::numberColumns_
int numberColumns_
Number of Columns in factorization.
Definition: CoinDenseFactorization.hpp:247
_EKKfactinfo::xnetalval
int xnetalval
Definition: CoinOslFactorization.hpp:87
_EKKfactinfo::npivots
int npivots
Definition: CoinOslFactorization.hpp:78
_EKKfactinfo::iter0
int iter0
Definition: CoinOslFactorization.hpp:68
_EKKfactinfo::R_etas_index
int * R_etas_index
Definition: CoinOslFactorization.hpp:47
CoinOslFactorization::updateColumnFT
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...
CoinOslFactorization::factInfo_
EKKfactinfo factInfo_
Osl factorization data.
Definition: CoinOslFactorization.hpp:277
CoinOslFactorization::intWorkArea
virtual int * intWorkArea() const
Returns int work area.
CoinOslFactorization::factorize
int factorize(const CoinPackedMatrix &matrix, int rowIsBasic[], int columnIsBasic[], double areaFactor=0.0)
When part of LP - given by basic variables.
_EKKfactinfo::nbfinv
int nbfinv
Definition: CoinOslFactorization.hpp:70
_EKKfactinfo::firstNonSlack
int firstNonSlack
Definition: CoinOslFactorization.hpp:86
CoinOslFactorization::numberInRow
virtual int * numberInRow() const
Number of entries in each row.
CoinOslFactorization::postProcess
virtual void postProcess(const int *sequence, int *pivotVariable)
Does post processing on valid factorization - putting variables on correct rows.
_EKKfactinfo::first_dense
int first_dense
Definition: CoinOslFactorization.hpp:81
_EKKfactinfo::ifvsol
int ifvsol
Definition: CoinOslFactorization.hpp:100
CoinOtherFactorization::numberColumns
int numberColumns() const
Total number of columns in factorization.
Definition: CoinDenseFactorization.hpp:71
_EKKfactinfo::nuspike
int nuspike
Definition: CoinOslFactorization.hpp:92
_EKKfactinfo::switch_off_sparse_update
int switch_off_sparse_update
Definition: CoinOslFactorization.hpp:91
CoinOslFactorization::updateColumn
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...
CoinOtherFactorization
Abstract base class which also has some scalars so can be used from Dense or Simp.
Definition: CoinDenseFactorization.hpp:27
_EKKfactinfo::last_dense
int last_dense
Definition: CoinOslFactorization.hpp:82
_EKKfactinfo::nrowmx
int nrowmx
Definition: CoinOslFactorization.hpp:62
EKKHlink
This deals with Factorization and Updates This is ripped off from OSL!!!!!!!!!
Definition: CoinOslFactorization.hpp:28
_EKKfactinfo::krpadr
int * krpadr
Definition: CoinOslFactorization.hpp:39
_EKKfactinfo::packedMode
int packedMode
Definition: CoinOslFactorization.hpp:90
_EKKfactinfo::kw1adr
double * kw1adr
Definition: CoinOslFactorization.hpp:57
_EKKfactinfo::firstLRow
int firstLRow
Definition: CoinOslFactorization.hpp:64
CoinPackedMatrix
Sparse Matrix Base Class.
Definition: CoinPackedMatrix.hpp:79
_EKKfactinfo::kw2adr
double * kw2adr
Definition: CoinOslFactorization.hpp:58
_EKKfactinfo::zeroTolerance
double zeroTolerance
Definition: CoinOslFactorization.hpp:33
_EKKfactinfo::lastEtaCount
int lastEtaCount
Definition: CoinOslFactorization.hpp:99
_EKKfactinfo::xcsadr
int * xcsadr
Definition: CoinOslFactorization.hpp:36
_EKKfactinfo::xeeadr
double * xeeadr
Definition: CoinOslFactorization.hpp:53
CoinDenseFactorization.hpp
_EKKfactinfo::kmxeta
int kmxeta
Definition: CoinOslFactorization.hpp:79
_EKKfactinfo::last_eta_size
int last_eta_size
Definition: CoinOslFactorization.hpp:102
_EKKfactinfo::trueStart
double * trueStart
Definition: CoinOslFactorization.hpp:45
_EKKfactinfo::nonzero
char * nonzero
Definition: CoinOslFactorization.hpp:44
CoinOslFactorization::clearArrays
virtual void clearArrays()
Get rid of all memory.
_EKKfactinfo
Definition: CoinOslFactorization.hpp:29
_EKKfactinfo::ndenuc
int ndenuc
Definition: CoinOslFactorization.hpp:77
_EKKfactinfo::kw3adr
double * kw3adr
Definition: CoinOslFactorization.hpp:59
CoinOslFactorization::CoinOslFactorizationUnitTest
friend void CoinOslFactorizationUnitTest(const std::string &mpsDir)
_EKKfactinfo::xcnadr
int * xcnadr
Definition: CoinOslFactorization.hpp:38
_EKKfactinfo::kadrpm
double * kadrpm
Definition: CoinOslFactorization.hpp:46
_EKKfactinfo::firstDoRow
int firstDoRow
Definition: CoinOslFactorization.hpp:63
_EKKfactinfo::lastSlack
int lastSlack
Definition: CoinOslFactorization.hpp:85
CoinOslFactorization::permuteBack
virtual int * permuteBack() const
Returns permute back.
_EKKfactinfo::xeradr
int * xeradr
Definition: CoinOslFactorization.hpp:52
CoinFactorizationDouble
double CoinFactorizationDouble
Definition: CoinTypes.hpp:57
_EKKfactinfo::hpivcoR
int * hpivcoR
Definition: CoinOslFactorization.hpp:60
CoinOslFactorization::clone
virtual CoinOtherFactorization * clone() const
Clone.
CoinOslFactorization::maximumCoefficient
double maximumCoefficient() const
Returns maximum absolute value in factorization.
_EKKfactinfo::nnentu
int nnentu
Definition: CoinOslFactorization.hpp:73
CoinOslFactorization::checkPivot
int checkPivot(double saveFromU, double oldPivot) const
Returns accuracy status of replaceColumn returns 0=OK, 1=Probably OK, 2=singular. ...
_EKKfactinfo::xecadr
int * xecadr
Definition: CoinOslFactorization.hpp:51
CoinOslFactorization::preProcess
virtual void preProcess()
PreProcesses column ordered copy of basis.
CoinOslFactorization::getAreas
virtual void getAreas(int numberRows, int numberColumns, CoinBigIndex maximumL, CoinBigIndex maximumU)
Gets space for a factorization.
CoinIndexedVector.hpp
CoinOslFactorization::elements
virtual CoinFactorizationDouble * elements() const
Returns array to put basis elements in.
CoinOslFactorization::numberInColumn
virtual int * numberInColumn() const
Number of entries in each column.
_EKKfactinfo::mpermu
int * mpermu
Definition: CoinOslFactorization.hpp:41
CoinIndexedVector
Indexed Vector.
Definition: CoinIndexedVector.hpp:104
_EKKfactinfo::num_resets
int num_resets
Definition: CoinOslFactorization.hpp:71
_EKKfactinfo::if_sparse_update
int if_sparse_update
Definition: CoinOslFactorization.hpp:89
_EKKfactinfo::numberSlacks
int numberSlacks
Definition: CoinOslFactorization.hpp:84
_EKKfactinfo::nrow
int nrow
Definition: CoinOslFactorization.hpp:61
_EKKfactinfo::R_etas_start
int * R_etas_start
Definition: CoinOslFactorization.hpp:48
CoinOslFactorization::factor
virtual int factor()
Does most of factorization returning status 0 - OK -99 - needs more memory -1 - singular - use number...
CoinOtherFactorization::maximumPivots
int maximumPivots() const
Maximum number of pivots between factorizations.
Definition: CoinDenseFactorization.hpp:84
_EKKfactinfo::bitArray
int * bitArray
Definition: CoinOslFactorization.hpp:42
CoinOslFactorization::setUsefulInformation
virtual void setUsefulInformation(const int *info, int whereFrom)
Useful information for factorization 0 - iteration number whereFrom is 0 for factorize and 1 for repl...
CoinOslFactorization::starts
virtual CoinBigIndex * starts() const
Returns array to put basis starts in.
_EKKfactinfo::lstart
int lstart
Definition: CoinOslFactorization.hpp:88
CoinOslFactorization::makeNonSingular
virtual void makeNonSingular(int *sequence, int numberColumns)
Makes a non-singular basis by replacing variables.
CoinOslFactorization::permute
virtual int * permute() const
Returns permute in.
Definition: CoinOslFactorization.hpp:255
EKKHlink::suc
int suc
Definition: CoinOslFactorization.hpp:28
_EKKfactinfo::zpivlu
double zpivlu
Definition: CoinOslFactorization.hpp:32
_EKKfactinfo::maxinv
int maxinv
Definition: CoinOslFactorization.hpp:65
CoinTypes.hpp
CoinOtherFactorization::numberRows
int numberRows() const
Number of Rows after factorization.
Definition: CoinDenseFactorization.hpp:67
_EKKfactinfo::nnetas
int nnetas
Definition: CoinOslFactorization.hpp:66
CoinOslFactorization::updateTwoColumnsFT
virtual int updateTwoColumnsFT(CoinIndexedVector *regionSparse1, CoinIndexedVector *regionSparse2, CoinIndexedVector *regionSparse3, bool noPermute=false)
does FTRAN on two columns
_EKKfactinfo::invok
int invok
Definition: CoinOslFactorization.hpp:69
CoinOslFactorization::replaceColumn
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...
CoinOslFactorization::gutsOfCopy
void gutsOfCopy(const CoinOslFactorization &other)
The real work of copy.
CoinOslFactorization::operator=
CoinOslFactorization & operator=(const CoinOslFactorization &other)
= copy
_EKKfactinfo::rows_ok
bool rows_ok
Definition: CoinOslFactorization.hpp:93
CoinOslFactorization::wantsTableauColumn
virtual bool wantsTableauColumn() const
Returns true if wants tableauColumn in replaceColumn.
CoinOslFactorization::workArea
virtual CoinFactorizationDouble * workArea() const
Returns work area.
_EKKfactinfo::eta_size
int eta_size
Definition: CoinOslFactorization.hpp:101
_EKKfactinfo::nnentl
int nnentl
Definition: CoinOslFactorization.hpp:72
CoinOslFactorization
Definition: CoinOslFactorization.hpp:106
CoinOslFactorization::gutsOfInitialize
void gutsOfInitialize(bool zapFact=true)
The real work of constructor.
CoinOtherFactorization::numberPivots_
int numberPivots_
Number pivots since last factorization.
Definition: CoinDenseFactorization.hpp:253
_EKKfactinfo::areaFactor
double areaFactor
Definition: CoinOslFactorization.hpp:34
CoinOslFactorization::gutsOfDestructor
void gutsOfDestructor(bool clearFact=true)
The real work of desstructor.
_EKKfactinfo::kp1adr
EKKHlink * kp1adr
Definition: CoinOslFactorization.hpp:55
_EKKfactinfo::R_etas_element
double * R_etas_element
Definition: CoinOslFactorization.hpp:49
CoinOtherFactorization::numberRows_
int numberRows_
Number of Rows in factorization.
Definition: CoinDenseFactorization.hpp:245
_EKKfactinfo::maxNNetas
int maxNNetas
Definition: CoinOslFactorization.hpp:103
CoinOslFactorization::~CoinOslFactorization
virtual ~CoinOslFactorization()
Destructor.
_EKKfactinfo::kcpadr
int * kcpadr
Definition: CoinOslFactorization.hpp:40
_EKKfactinfo::kp2adr
EKKHlink * kp2adr
Definition: CoinOslFactorization.hpp:56
_EKKfactinfo::xrsadr
int * xrsadr
Definition: CoinOslFactorization.hpp:35
_EKKfactinfo::demark
double demark
Definition: CoinOslFactorization.hpp:31
_EKKfactinfo::xe2adr
double * xe2adr
Definition: CoinOslFactorization.hpp:54
_EKKfactinfo::iterno
int iterno
Definition: CoinOslFactorization.hpp:83
_EKKfactinfo::sortedEta
int sortedEta
Definition: CoinOslFactorization.hpp:98
_EKKfactinfo::nR_etas
int nR_etas
Definition: CoinOslFactorization.hpp:97
CoinOslFactorization::conditionNumber
double conditionNumber() const
Condition number - product of pivots after factorization.
_EKKfactinfo::back
int * back
Definition: CoinOslFactorization.hpp:43