Clp 1.17.6

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

- File List
- File Members

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 2083 2019-01-06 19:38:09Z unxusr $ */
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 Authors
8
9 John Forrest
10
11 */
12 #ifndef CoinDenseFactorization_H
13 #define CoinDenseFactorization_H
14
15 #include <iostream>
16 #include <string>
17 #include <cassert>
18 #include "CoinTypes.hpp"
19 #include "CoinIndexedVector.hpp"
20 #include "CoinFactorization.hpp"
21 #if COIN_FACTORIZATION_DENSE_CODE == 2
22 #undef COIN_FACTORIZATION_DENSE_CODE
23 #endif
24 class CoinPackedMatrix;
26 class CoinOtherFactorization {
27
28 public:
31 CoinOtherFactorization();
34 CoinOtherFactorization(const CoinOtherFactorization &other);
35
37 virtual ~CoinOtherFactorization();
39 CoinOtherFactorization &operator=(const CoinOtherFactorization &other);
40
42 virtual CoinOtherFactorization *clone() const = 0;
44
47 inline int status() const
49 {
50 return status_;
51 }
53 inline void setStatus(int value)
54 {
55 status_ = value;
56 }
58 inline int pivots() const
59 {
60 return numberPivots_;
61 }
63 inline void setPivots(int value)
64 {
65 numberPivots_ = value;
66 }
68 inline void setNumberRows(int value)
69 {
70 numberRows_ = value;
71 }
73 inline int numberRows() const
74 {
75 return numberRows_;
76 }
78 inline int numberColumns() const
79 {
80 return numberColumns_;
81 }
83 inline int numberGoodColumns() const
84 {
85 return numberGoodU_;
86 }
88 inline void relaxAccuracyCheck(double value)
89 {
90 relaxCheck_ = value;
91 }
92 inline double getAccuracyCheck() const
93 {
94 return relaxCheck_;
95 }
97 inline int maximumPivots() const
98 {
99 return maximumPivots_;
100 }
102 virtual void maximumPivots(int value);
103
105 inline double pivotTolerance() const
106 {
107 return pivotTolerance_;
108 }
109 void pivotTolerance(double value);
111 inline double zeroTolerance() const
112 {
113 return zeroTolerance_;
114 }
115 void zeroTolerance(double value);
116 #ifndef COIN_FAST_CODE
117 inline double slackValue() const
119 {
120 return slackValue_;
121 }
122 void slackValue(double value);
123 #endif
124 virtual CoinFactorizationDouble *elements() const;
127 virtual int *pivotRow() const;
129 virtual CoinFactorizationDouble *workArea() const;
131 virtual int *intWorkArea() const;
133 virtual int *numberInRow() const;
135 virtual int *numberInColumn() const;
137 virtual int *starts() const;
139 virtual int *permuteBack() const;
144 inline int solveMode() const
145 {
146 return solveMode_;
147 }
152 inline void setSolveMode(int value)
153 {
154 solveMode_ = value;
155 }
157 virtual bool wantsTableauColumn() const;
162 virtual void setUsefulInformation(const int *info, int whereFrom);
164 virtual void clearArrays() {}
166
168 virtual int *indices() const = 0;
171 virtual int *permute() const = 0;
173 virtual int numberElements() const = 0;
175
177 virtual void getAreas(int numberRows,
179 int numberColumns,
180 int maximumL,
181 int maximumU)
182 = 0;
183
185 virtual void preProcess() = 0;
191 virtual int factor() = 0;
193 virtual void postProcess(const int *sequence, int *pivotVariable) = 0;
195 virtual void makeNonSingular(int *sequence, int numberColumns) = 0;
197
200
208 virtual int replaceColumn(CoinIndexedVector *regionSparse,
209 int pivotRow,
210 double pivotCheck,
211 bool checkBeforeModifying = false,
212 double acceptablePivot = 1.0e-8)
213 = 0;
215
225 virtual int updateColumnFT(CoinIndexedVector *regionSparse,
226 CoinIndexedVector *regionSparse2,
227 bool noPermute = false)
228 = 0;
231 virtual int updateColumn(CoinIndexedVector *regionSparse,
232 CoinIndexedVector *regionSparse2,
233 bool noPermute = false) const = 0;
235 virtual int updateTwoColumnsFT(CoinIndexedVector *regionSparse1,
236 CoinIndexedVector *regionSparse2,
237 CoinIndexedVector *regionSparse3,
238 bool noPermute = false)
239 = 0;
244 virtual int updateColumnTranspose(CoinIndexedVector *regionSparse,
245 CoinIndexedVector *regionSparse2) const = 0;
247
249 protected:
252 double pivotTolerance_;
255 double zeroTolerance_;
256 #ifndef COIN_FAST_CODE
257 double slackValue_;
259 #else
260 #ifndef slackValue_
261 #define slackValue_ -1.0
262 #endif
263 #endif
264 double relaxCheck_;
267 int factorElements_;
269 int numberRows_;
271 int numberColumns_;
273 int numberGoodU_;
275 int maximumPivots_;
277 int numberPivots_;
279 int status_;
281 int maximumRows_;
283 int maximumSpace_;
285 int *pivotRow_;
290 CoinFactorizationDouble *elements_;
292 CoinFactorizationDouble *workArea_;
297 int solveMode_;
299 };
307 class CoinDenseFactorization : public CoinOtherFactorization {
308 friend void CoinDenseFactorizationUnitTest(const std::string &mpsDir);
309
310 public:
313 CoinDenseFactorization();
316 CoinDenseFactorization(const CoinDenseFactorization &other);
317
319 virtual ~CoinDenseFactorization();
321 CoinDenseFactorization &operator=(const CoinDenseFactorization &other);
323 virtual CoinOtherFactorization *clone() const;
325
328 virtual void getAreas(int numberRows,
330 int numberColumns,
331 int maximumL,
332 int maximumU);
333
335 virtual void preProcess();
341 virtual int factor();
343 virtual void postProcess(const int *sequence, int *pivotVariable);
345 virtual void makeNonSingular(int *sequence, int numberColumns);
347
350 virtual inline int numberElements() const
352 {
353 return numberRows_ * (numberColumns_ + numberPivots_);
354 }
356 double maximumCoefficient() const;
358
361
369 virtual int replaceColumn(CoinIndexedVector *regionSparse,
370 int pivotRow,
371 double pivotCheck,
372 bool checkBeforeModifying = false,
373 double acceptablePivot = 1.0e-8);
375
385 virtual inline int updateColumnFT(CoinIndexedVector *regionSparse,
386 CoinIndexedVector *regionSparse2,
387 bool = false)
388 {
389 return updateColumn(regionSparse, regionSparse2);
390 }
393 virtual int updateColumn(CoinIndexedVector *regionSparse,
394 CoinIndexedVector *regionSparse2,
395 bool noPermute = false) const;
397 virtual int updateTwoColumnsFT(CoinIndexedVector *regionSparse1,
398 CoinIndexedVector *regionSparse2,
399 CoinIndexedVector *regionSparse3,
400 bool noPermute = false);
405 virtual int updateColumnTranspose(CoinIndexedVector *regionSparse,
406 CoinIndexedVector *regionSparse2) const;
408
413 inline void clearArrays()
415 {
416 gutsOfDestructor();
417 }
419 virtual inline int *indices() const
420 {
421 return reinterpret_cast< int * >(elements_ + numberRows_ * numberRows_);
422 }
424 virtual inline int *permute() const
425 {
426 return NULL; /*pivotRow_*/
427 ;
428 }
430
432 void gutsOfDestructor();
434 void gutsOfInitialize();
436 void gutsOfCopy(const CoinDenseFactorization &other);
437
439 protected:
442 int checkPivot(double saveFromU, double oldPivot) const;
444 protected:
447
448 };
449 #endif
450
451 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
452 */
CoinOtherFactorization::updateColumn
virtual int updateColumn(CoinIndexedVector *regionSparse, CoinIndexedVector *regionSparse2, bool noPermute=false) const =0
This version has same effect as above with FTUpdate==false so number returned is always &gt;=0...
CoinDenseFactorization::postProcess
virtual void postProcess(const int *sequence, int *pivotVariable)
Does post processing on valid factorization - putting variables on correct rows.
CoinOtherFactorization::intWorkArea
virtual int * intWorkArea() const
Returns int work area.
CoinOtherFactorization::updateColumnFT
virtual int updateColumnFT(CoinIndexedVector *regionSparse, CoinIndexedVector *regionSparse2, bool noPermute=false)=0
Updates one column (FTRAN) from regionSparse2 Tries to do FT update number returned is negative if no...
CoinOtherFactorization::setNumberRows
void setNumberRows(int value)
Set number of Rows after factorization.
Definition: CoinDenseFactorization.hpp:68
CoinTypes.hpp
CoinDenseFactorization::CoinDenseFactorization
CoinDenseFactorization()
Default constructor.
CoinOtherFactorization
Abstract base class which also has some scalars so can be used from Dense or Simp.
Definition: CoinDenseFactorization.hpp:26
CoinOtherFactorization::numberPivots_
int numberPivots_
Number pivots since last factorization.
Definition: CoinDenseFactorization.hpp:277
CoinDenseFactorization::indices
virtual int * indices() const
Returns array to put basis indices in.
Definition: CoinDenseFactorization.hpp:419
CoinOtherFactorization::status_
int status_
Status of factorization.
Definition: CoinDenseFactorization.hpp:279
CoinOtherFactorization::numberRows_
int numberRows_
Number of Rows in factorization.
Definition: CoinDenseFactorization.hpp:269
CoinDenseFactorization::updateColumnFT
virtual int updateColumnFT(CoinIndexedVector *regionSparse, CoinIndexedVector *regionSparse2, bool=false)
Updates one column (FTRAN) from regionSparse2 Tries to do FT update number returned is negative if no...
Definition: CoinDenseFactorization.hpp:385
CoinOtherFactorization::postProcess
virtual void postProcess(const int *sequence, int *pivotVariable)=0
Does post processing on valid factorization - putting variables on correct rows.
CoinDenseFactorization::CoinDenseFactorizationUnitTest
friend void CoinDenseFactorizationUnitTest(const std::string &mpsDir)
CoinOtherFactorization::numberRows
int numberRows() const
Number of Rows after factorization.
Definition: CoinDenseFactorization.hpp:73
CoinDenseFactorization::maximumCoefficient
double maximumCoefficient() const
Returns maximum absolute value in factorization.
CoinOtherFactorization::updateColumnTranspose
virtual int updateColumnTranspose(CoinIndexedVector *regionSparse, CoinIndexedVector *regionSparse2) const =0
Updates one column (BTRAN) from regionSparse2 regionSparse starts as zero and is zero at end Note - i...
CoinOtherFactorization::numberGoodU_
int numberGoodU_
Number factorized in U (not row singletons)
Definition: CoinDenseFactorization.hpp:273
CoinOtherFactorization::maximumSpace_
int maximumSpace_
Maximum length of iterating area.
Definition: CoinDenseFactorization.hpp:283
CoinOtherFactorization::numberGoodColumns
int numberGoodColumns() const
Number of good columns in factorization.
Definition: CoinDenseFactorization.hpp:83
CoinOtherFactorization::slackValue
double slackValue() const
Whether slack value is +1 or -1.
Definition: CoinDenseFactorization.hpp:118
CoinOtherFactorization::preProcess
virtual void preProcess()=0
PreProcesses column ordered copy of basis.
CoinOtherFactorization::maximumPivots_
int maximumPivots_
Maximum number of pivots before factorization.
Definition: CoinDenseFactorization.hpp:275
CoinFactorization.hpp
CoinDenseFactorization::getAreas
virtual void getAreas(int numberRows, int numberColumns, int maximumL, int maximumU)
Gets space for a factorization.
CoinOtherFactorization::slackValue_
double slackValue_
Whether slack value is +1 or -1.
Definition: CoinDenseFactorization.hpp:258
CoinOtherFactorization::clearArrays
virtual void clearArrays()
Get rid of all memory.
Definition: CoinDenseFactorization.hpp:164
CoinOtherFactorization::makeNonSingular
virtual void makeNonSingular(int *sequence, int numberColumns)=0
Makes a non-singular basis by replacing variables.
CoinOtherFactorization::getAccuracyCheck
double getAccuracyCheck() const
Definition: CoinDenseFactorization.hpp:92
CoinOtherFactorization::maximumRows_
int maximumRows_
Maximum rows ever (i.e. use to copy arrays etc)
Definition: CoinDenseFactorization.hpp:281
CoinOtherFactorization::maximumPivots
int maximumPivots() const
Maximum number of pivots between factorizations.
Definition: CoinDenseFactorization.hpp:97
CoinOtherFactorization::elements_
CoinFactorizationDouble * elements_
Elements of factorization and updates length is maxR*maxR+maxSpace will always be long enough so can ...
Definition: CoinDenseFactorization.hpp:290
CoinFactorizationDouble
double CoinFactorizationDouble
Definition: CoinTypes.hpp:57
CoinOtherFactorization::numberInColumn
virtual int * numberInColumn() const
Number of entries in each column.
CoinOtherFactorization::zeroTolerance_
double zeroTolerance_
Zero tolerance.
Definition: CoinDenseFactorization.hpp:255
CoinOtherFactorization::permuteBack
virtual int * permuteBack() const
Returns permute back.
CoinOtherFactorization::elements
virtual CoinFactorizationDouble * elements() const
Returns array to put basis elements in.
CoinOtherFactorization::numberColumns
int numberColumns() const
Total number of columns in factorization.
Definition: CoinDenseFactorization.hpp:78
CoinOtherFactorization::zeroTolerance
double zeroTolerance() const
Zero tolerance.
Definition: CoinDenseFactorization.hpp:111
CoinOtherFactorization::setSolveMode
void setSolveMode(int value)
Set solve mode e.g.
Definition: CoinDenseFactorization.hpp:152
CoinDenseFactorization::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...
CoinDenseFactorization::checkPivot
int checkPivot(double saveFromU, double oldPivot) const
Returns accuracy status of replaceColumn returns 0=OK, 1=Probably OK, 2=singular. ...
CoinIndexedVector
Indexed Vector.
Definition: CoinIndexedVector.hpp:104
CoinDenseFactorization::clone
virtual CoinOtherFactorization * clone() const
Clone.
CoinOtherFactorization::wantsTableauColumn
virtual bool wantsTableauColumn() const
Returns true if wants tableauColumn in replaceColumn.
CoinDenseFactorization::factor
virtual int factor()
Does most of factorization returning status 0 - OK -99 - needs more memory -1 - singular - use number...
CoinOtherFactorization::workArea_
CoinFactorizationDouble * workArea_
Work area of numberRows_.
Definition: CoinDenseFactorization.hpp:292
CoinDenseFactorization::operator=
CoinDenseFactorization & operator=(const CoinDenseFactorization &other)
= copy
CoinOtherFactorization::starts
virtual int * starts() const
Returns array to put basis starts in.
CoinDenseFactorization::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...
CoinOtherFactorization::solveMode
int solveMode() const
Get solve mode e.g.
Definition: CoinDenseFactorization.hpp:144
CoinDenseFactorization::numberElements
virtual int numberElements() const
Total number of elements in factorization.
Definition: CoinDenseFactorization.hpp:351
CoinDenseFactorization::makeNonSingular
virtual void makeNonSingular(int *sequence, int numberColumns)
Makes a non-singular basis by replacing variables.
CoinDenseFactorization::clearArrays
void clearArrays()
Get rid of all memory.
Definition: CoinDenseFactorization.hpp:414
CoinOtherFactorization::setStatus
void setStatus(int value)
Sets status.
Definition: CoinDenseFactorization.hpp:53
CoinOtherFactorization::numberInRow
virtual int * numberInRow() const
Number of entries in each row.
CoinDenseFactorization::~CoinDenseFactorization
virtual ~CoinDenseFactorization()
Destructor.
CoinDenseFactorization::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...
CoinOtherFactorization::CoinOtherFactorization
CoinOtherFactorization()
Default constructor.
CoinDenseFactorization
This deals with Factorization and Updates This is a simple dense version so other people can write a ...
Definition: CoinDenseFactorization.hpp:307
CoinOtherFactorization::status
int status() const
Returns status.
Definition: CoinDenseFactorization.hpp:48
CoinDenseFactorization::gutsOfInitialize
void gutsOfInitialize()
The real work of constructor.
CoinPackedMatrix
Sparse Matrix Base Class.
Definition: CoinPackedMatrix.hpp:79
CoinOtherFactorization::factor
virtual int factor()=0
Does most of factorization returning status 0 - OK -99 - needs more memory -1 - singular - use number...
CoinOtherFactorization::replaceColumn
virtual int replaceColumn(CoinIndexedVector *regionSparse, int pivotRow, double pivotCheck, bool checkBeforeModifying=false, double acceptablePivot=1.0e-8)=0
Replaces one Column to basis, returns 0=OK, 1=Probably OK, 2=singular, 3=no room If checkBeforeModify...
CoinOtherFactorization::pivotTolerance
double pivotTolerance() const
Pivot tolerance.
Definition: CoinDenseFactorization.hpp:105
CoinOtherFactorization::indices
virtual int * indices() const =0
Returns array to put basis indices in.
CoinDenseFactorization::preProcess
virtual void preProcess()
PreProcesses column ordered copy of basis.
CoinOtherFactorization::relaxCheck_
double relaxCheck_
Relax check on accuracy in replaceColumn.
Definition: CoinDenseFactorization.hpp:265
CoinOtherFactorization::updateTwoColumnsFT
virtual int updateTwoColumnsFT(CoinIndexedVector *regionSparse1, CoinIndexedVector *regionSparse2, CoinIndexedVector *regionSparse3, bool noPermute=false)=0
does FTRAN on two columns
CoinOtherFactorization::factorElements_
int factorElements_
Number of elements after factorization.
Definition: CoinDenseFactorization.hpp:267
CoinOtherFactorization::~CoinOtherFactorization
virtual ~CoinOtherFactorization()
Destructor.
CoinOtherFactorization::setPivots
void setPivots(int value)
Sets number of pivots since factorization.
Definition: CoinDenseFactorization.hpp:63
CoinDenseFactorization::gutsOfCopy
void gutsOfCopy(const CoinDenseFactorization &other)
The real work of copy.
CoinOtherFactorization::workArea
virtual CoinFactorizationDouble * workArea() const
Returns work area.
CoinOtherFactorization::pivotTolerance_
double pivotTolerance_
Pivot tolerance.
Definition: CoinDenseFactorization.hpp:253
CoinOtherFactorization::pivotRow_
int * pivotRow_
Pivot row.
Definition: CoinDenseFactorization.hpp:285
CoinIndexedVector.hpp
CoinOtherFactorization::pivotRow
virtual int * pivotRow() const
Returns pivot row.
CoinDenseFactorization::gutsOfDestructor
void gutsOfDestructor()
The real work of desstructor.
CoinOtherFactorization::solveMode_
int solveMode_
Solve mode e.g.
Definition: CoinDenseFactorization.hpp:297
CoinDenseFactorization::permute
virtual int * permute() const
Returns permute in.
Definition: CoinDenseFactorization.hpp:424
CoinOtherFactorization::pivots
int pivots() const
Returns number of pivots since factorization.
Definition: CoinDenseFactorization.hpp:58
CoinOtherFactorization::clone
virtual CoinOtherFactorization * clone() const =0
Clone.
CoinOtherFactorization::permute
virtual int * permute() const =0
Returns permute in.
CoinOtherFactorization::numberColumns_
int numberColumns_
Number of Columns in factorization.
Definition: CoinDenseFactorization.hpp:271
CoinOtherFactorization::relaxAccuracyCheck
void relaxAccuracyCheck(double value)
Allows change of pivot accuracy check 1.0 == none &gt;1.0 relaxed.
Definition: CoinDenseFactorization.hpp:88
CoinDenseFactorization::updateTwoColumnsFT
virtual int updateTwoColumnsFT(CoinIndexedVector *regionSparse1, CoinIndexedVector *regionSparse2, CoinIndexedVector *regionSparse3, bool noPermute=false)
does FTRAN on two columns
CoinOtherFactorization::getAreas
virtual void getAreas(int numberRows, int numberColumns, int maximumL, int maximumU)=0
Gets space for a factorization.
CoinOtherFactorization::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...
CoinOtherFactorization::numberElements
virtual int numberElements() const =0
Total number of elements in factorization.
CoinOtherFactorization::operator=
CoinOtherFactorization & operator=(const CoinOtherFactorization &other)
= copy