1 | // Copyright (C) 2002, International Business Machines |
---|
2 | // Corporation and others. All Rights Reserved. |
---|
3 | #ifndef ClpFactorization_H |
---|
4 | #define ClpFactorization_H |
---|
5 | |
---|
6 | |
---|
7 | #include "CoinPragma.hpp" |
---|
8 | |
---|
9 | #include "CoinFactorization.hpp" |
---|
10 | |
---|
11 | /** This just implements CoinFactorization when an ClpMatrixBase object |
---|
12 | is passed. If a network then has a dummy CoinFactorization and |
---|
13 | a genuine ClpNetworkBasis object |
---|
14 | */ |
---|
15 | class ClpMatrixBase; |
---|
16 | class ClpSimplex; |
---|
17 | class ClpNetworkBasis; |
---|
18 | |
---|
19 | class ClpFactorization : public CoinFactorization { |
---|
20 | |
---|
21 | public: |
---|
22 | /**@name factorization */ |
---|
23 | //@{ |
---|
24 | /** When part of LP - given by basic variables. |
---|
25 | Actually does factorization. |
---|
26 | Arrays passed in have non negative value to say basic. |
---|
27 | If status is okay, basic variables have pivot row - this is only needed |
---|
28 | if increasingRows_ >1. |
---|
29 | Allows scaling |
---|
30 | If status is singular, then basic variables have pivot row |
---|
31 | and ones thrown out have -1 |
---|
32 | returns 0 -okay, -1 singular, -2 too many in basis, -99 memory */ |
---|
33 | int factorize (const ClpSimplex * model, |
---|
34 | const ClpMatrixBase * matrix, |
---|
35 | int numberRows, int numberColumns, |
---|
36 | int rowIsBasic[], int columnIsBasic[] , |
---|
37 | double areaFactor = 0.0); |
---|
38 | //@} |
---|
39 | |
---|
40 | |
---|
41 | /**@name Constructors, destructor */ |
---|
42 | //@{ |
---|
43 | /** Default constructor. */ |
---|
44 | ClpFactorization(); |
---|
45 | /** Destructor */ |
---|
46 | ~ClpFactorization(); |
---|
47 | //@} |
---|
48 | |
---|
49 | /**@name Copy method */ |
---|
50 | //@{ |
---|
51 | /** The copy constructor. */ |
---|
52 | ClpFactorization(const ClpFactorization&); |
---|
53 | /** The copy constructor from an CoinFactorization. */ |
---|
54 | ClpFactorization(const CoinFactorization&); |
---|
55 | |
---|
56 | ClpFactorization& operator=(const ClpFactorization&); |
---|
57 | //@} |
---|
58 | |
---|
59 | /* **** below here is so can use networkish basis */ |
---|
60 | /**@name rank one updates which do exist */ |
---|
61 | //@{ |
---|
62 | |
---|
63 | /** Replaces one Column to basis, |
---|
64 | returns 0=OK, 1=Probably OK, 2=singular, 3=no room |
---|
65 | If checkBeforeModifying is true will do all accuracy checks |
---|
66 | before modifying factorization. Whether to set this depends on |
---|
67 | speed considerations. You could just do this on first iteration |
---|
68 | after factorization and thereafter re-factorize |
---|
69 | partial update already in U */ |
---|
70 | int replaceColumn ( CoinIndexedVector * regionSparse, |
---|
71 | int pivotRow, |
---|
72 | double pivotCheck , |
---|
73 | bool checkBeforeModifying=false); |
---|
74 | //@} |
---|
75 | |
---|
76 | /**@name various uses of factorization (return code number elements) |
---|
77 | which user may want to know about */ |
---|
78 | //@{ |
---|
79 | /** Updates one column (FTRAN) from region2 |
---|
80 | number returned is negative if no room |
---|
81 | region1 starts as zero and is zero at end */ |
---|
82 | int updateColumn ( CoinIndexedVector * regionSparse, |
---|
83 | CoinIndexedVector * regionSparse2, |
---|
84 | bool FTUpdate = false ) ; |
---|
85 | /** Updates one column (FTRAN) to/from array |
---|
86 | number returned is negative if no room |
---|
87 | ** For large problems you should ALWAYS know where the nonzeros |
---|
88 | are, so please try and migrate to previous method after you |
---|
89 | have got code working using this simple method - thank you! |
---|
90 | (the only exception is if you know input is dense e.g. rhs) |
---|
91 | region starts as zero and is zero at end */ |
---|
92 | int updateColumn ( CoinIndexedVector * regionSparse, |
---|
93 | double array[] ) const; |
---|
94 | /** Updates one column transpose (BTRAN) |
---|
95 | ** For large problems you should ALWAYS know where the nonzeros |
---|
96 | are, so please try and migrate to previous method after you |
---|
97 | have got code working using this simple method - thank you! |
---|
98 | (the only exception is if you know input is dense e.g. dense objective) |
---|
99 | returns number of nonzeros */ |
---|
100 | int updateColumnTranspose ( CoinIndexedVector * regionSparse, |
---|
101 | double array[] ) const; |
---|
102 | /** Updates one column (BTRAN) from region2 |
---|
103 | region1 starts as zero and is zero at end */ |
---|
104 | int updateColumnTranspose ( CoinIndexedVector * regionSparse, |
---|
105 | CoinIndexedVector * regionSparse2) const; |
---|
106 | //@} |
---|
107 | |
---|
108 | ////////////////// data ////////////////// |
---|
109 | private: |
---|
110 | |
---|
111 | /**@name data */ |
---|
112 | //@{ |
---|
113 | /// Pointer to network basis |
---|
114 | ClpNetworkBasis * networkBasis_; |
---|
115 | //@} |
---|
116 | }; |
---|
117 | |
---|
118 | #endif |
---|