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

- File List
- File Members

ClpGubMatrix.hpp
Go to the documentation of this file.
1 /* $Id: ClpGubMatrix.hpp 1665 2011-01-04 17:55:54Z lou $ */
2 // Copyright (C) 2003, 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 #ifndef ClpGubMatrix_H
7 #define ClpGubMatrix_H
8
9
10 #include "CoinPragma.hpp"
11
12 #include "ClpPackedMatrix.hpp"
13 class ClpSimplex;
22 class ClpGubMatrix : public ClpPackedMatrix {
23
24 public:
28 virtual ClpMatrixBase * reverseOrderedCopy() const;
30 virtual CoinBigIndex countBasis(const int * whichColumn,
31 int & numberColumnBasic);
33 virtual void fillBasis(ClpSimplex * model,
34 const int * whichColumn,
35 int & numberColumnBasic,
36 int * row, int * start,
37 int * rowCount, int * columnCount,
38 CoinFactorizationDouble * element);
41 virtual void unpack(const ClpSimplex * model, CoinIndexedVector * rowArray,
42 int column) const ;
47 virtual void unpackPacked(ClpSimplex * model,
48 CoinIndexedVector * rowArray,
49 int column) const;
52 virtual void add(const ClpSimplex * model, CoinIndexedVector * rowArray,
53 int column, double multiplier) const ;
55 virtual void add(const ClpSimplex * model, double * array,
56 int column, double multiplier) const;
58 virtual void partialPricing(ClpSimplex * model, double start, double end,
59 int & bestSequence, int & numberWanted);
61 virtual int hiddenRows() const;
63
66
67 using ClpPackedMatrix::transposeTimes ;
72 virtual void transposeTimes(const ClpSimplex * model, double scalar,
73 const CoinIndexedVector * x,
74 CoinIndexedVector * y,
75 CoinIndexedVector * z) const;
81 virtual void transposeTimesByRow(const ClpSimplex * model, double scalar,
82 const CoinIndexedVector * x,
83 CoinIndexedVector * y,
84 CoinIndexedVector * z) const;
88 virtual void subsetTransposeTimes(const ClpSimplex * model,
89 const CoinIndexedVector * x,
90 const CoinIndexedVector * y,
91 CoinIndexedVector * z) const;
98 virtual int extendUpdated(ClpSimplex * model, CoinIndexedVector * update, int mode);
104 virtual void primalExpanded(ClpSimplex * model, int mode);
113 virtual void dualExpanded(ClpSimplex * model, CoinIndexedVector * array,
114 double * other, int mode);
132 virtual int generalExpanded(ClpSimplex * model, int mode, int & number);
136 virtual int updatePivot(ClpSimplex * model, double oldInValue, double oldOutValue);
138 virtual void useEffectiveRhs(ClpSimplex * model, bool cheapest = true);
142 virtual double * rhsOffset(ClpSimplex * model, bool forceRefresh = false,
143 bool check = false);
156 virtual int synchronize(ClpSimplex * model, int mode);
158 virtual void correctSequence(const ClpSimplex * model, int & sequenceIn, int & sequenceOut) ;
160
161
162
166 ClpGubMatrix();
168 virtual ~ClpGubMatrix();
170
174 ClpGubMatrix(const ClpGubMatrix&);
176 ClpGubMatrix(const CoinPackedMatrix&);
179 ClpGubMatrix (const ClpGubMatrix & wholeModel,
180 int numberRows, const int * whichRows,
181 int numberColumns, const int * whichColumns);
182 ClpGubMatrix (const CoinPackedMatrix & wholeModel,
183 int numberRows, const int * whichRows,
184 int numberColumns, const int * whichColumns);
185
187 ClpGubMatrix(CoinPackedMatrix * matrix);
188
191 ClpGubMatrix(ClpPackedMatrix * matrix, int numberSets,
192 const int * start, const int * end,
193 const double * lower, const double * upper,
194 const unsigned char * status = NULL);
195
196 ClpGubMatrix& operator=(const ClpGubMatrix&);
198 virtual ClpMatrixBase * clone() const ;
201 virtual ClpMatrixBase * subsetClone (
202 int numberRows, const int * whichRows,
203 int numberColumns, const int * whichColumns) const ;
205 void redoSet(ClpSimplex * model, int newKey, int oldKey, int iSet);
207
209 inline ClpSimplex::Status getStatus(int sequence) const {
211 return static_cast<ClpSimplex::Status> (status_[sequence] & 7);
212 }
213 inline void setStatus(int sequence, ClpSimplex::Status status) {
214 unsigned char & st_byte = status_[sequence];
215 st_byte = static_cast<unsigned char>(st_byte & ~7);
216 st_byte = static_cast<unsigned char>(st_byte | status);
217 }
219 inline void setFlagged( int sequence) {
220 status_[sequence] = static_cast<unsigned char>(status_[sequence] | 64);
221 }
222 inline void clearFlagged( int sequence) {
223 status_[sequence] = static_cast<unsigned char>(status_[sequence] & ~64);
224 }
225 inline bool flagged(int sequence) const {
226 return ((status_[sequence] & 64) != 0);
227 }
229 inline void setAbove( int sequence) {
230 unsigned char iStat = status_[sequence];
231 iStat = static_cast<unsigned char>(iStat & ~24);
232 status_[sequence] = static_cast<unsigned char>(iStat | 16);
233 }
235 inline void setFeasible( int sequence) {
236 unsigned char iStat = status_[sequence];
237 iStat = static_cast<unsigned char>(iStat & ~24);
238 status_[sequence] = static_cast<unsigned char>(iStat | 8);
239 }
241 inline void setBelow( int sequence) {
242 unsigned char iStat = status_[sequence];
243 iStat = static_cast<unsigned char>(iStat & ~24);
244 status_[sequence] = iStat;
245 }
246 inline double weight( int sequence) const {
247 int iStat = status_[sequence] & 31;
248 iStat = iStat >> 3;
249 return static_cast<double> (iStat - 1);
250 }
252 inline int * start() const {
253 return start_;
254 }
256 inline int * end() const {
257 return end_;
258 }
260 inline double * lower() const {
261 return lower_;
262 }
264 inline double * upper() const {
265 return upper_;
266 }
268 inline int * keyVariable() const {
269 return keyVariable_;
270 }
272 inline int * backward() const {
273 return backward_;
274 }
276 inline int numberSets() const {
277 return numberSets_;
278 }
280 void switchOffCheck();
282
283
284 protected:
288 double sumDualInfeasibilities_;
291 double sumPrimalInfeasibilities_;
293 double sumOfRelaxedDualInfeasibilities_;
295 double sumOfRelaxedPrimalInfeasibilities_;
297 double infeasibilityWeight_;
299 int * start_;
301 int * end_;
303 double * lower_;
305 double * upper_;
307 mutable unsigned char * status_;
309 unsigned char * saveStatus_;
311 int * savedKeyVariable_;
313 int * backward_;
315 int * backToPivotRow_;
317 double * changeCost_;
319 mutable int * keyVariable_;
323 mutable int * next_;
325 int * toIndex_;
326 // Reverse pointer from index to set
327 int * fromIndex_;
329 ClpSimplex * model_;
331 int numberDualInfeasibilities_;
333 int numberPrimalInfeasibilities_;
339 int noCheck_;
341 int numberSets_;
343 int saveNumber_;
345 int possiblePivotKey_;
347 int gubSlackIn_;
349 int firstGub_;
351 int lastGub_;
354 int gubType_;
356 };
357
358 #endif
CoinBigIndex
int CoinBigIndex
Definition: Coin_C_defines.h:105
ClpGubMatrix::flagged
bool flagged(int sequence) const
Status.
Definition: ClpGubMatrix.hpp:225
ClpGubMatrix::countBasis
virtual CoinBigIndex countBasis(const int *whichColumn, int &numberColumnBasic)
Returns number of elements in column part of basis.
ClpGubMatrix::sumOfRelaxedPrimalInfeasibilities_
double sumOfRelaxedPrimalInfeasibilities_
Sum of Primal infeasibilities using tolerance based on error in primals.
Definition: ClpGubMatrix.hpp:295
ClpGubMatrix::numberDualInfeasibilities_
int numberDualInfeasibilities_
Number of dual infeasibilities.
Definition: ClpGubMatrix.hpp:331
ClpGubMatrix::gubSlackIn_
int gubSlackIn_
Gub slack in (set number or -1)
Definition: ClpGubMatrix.hpp:347
ClpGubMatrix::model_
ClpSimplex * model_
Pointer back to model.
Definition: ClpGubMatrix.hpp:329
ClpGubMatrix::redoSet
void redoSet(ClpSimplex *model, int newKey, int oldKey, int iSet)
redoes next_ for a set.
ClpGubMatrix
This implements Gub rows plus a ClpPackedMatrix.
Definition: ClpGubMatrix.hpp:22
ClpGubMatrix::sumDualInfeasibilities_
double sumDualInfeasibilities_
Sum of dual infeasibilities.
Definition: ClpGubMatrix.hpp:289
ClpGubMatrix::getStatus
ClpSimplex::Status getStatus(int sequence) const
Status.
Definition: ClpGubMatrix.hpp:210
ClpGubMatrix::rhsOffset
virtual double * rhsOffset(ClpSimplex *model, bool forceRefresh=false, bool check=false)
Returns effective RHS offset if it is being used.
ClpGubMatrix::noCheck_
int noCheck_
If pricing will declare victory (i.e.
Definition: ClpGubMatrix.hpp:339
ClpGubMatrix::lower_
double * lower_
Lower bounds on sets.
Definition: ClpGubMatrix.hpp:303
ClpGubMatrix::ClpGubMatrix
ClpGubMatrix()
Default constructor.
ClpGubMatrix::extendUpdated
virtual int extendUpdated(ClpSimplex *model, CoinIndexedVector *update, int mode)
expands an updated column to allow for extra rows which the main solver does not know about and retur...
ClpGubMatrix::fromIndex_
int * fromIndex_
Sum of dual infeasibilities.
Definition: ClpGubMatrix.hpp:327
ClpGubMatrix::setAbove
void setAbove(int sequence)
To say key is above ub.
Definition: ClpGubMatrix.hpp:229
ClpGubMatrix::sumPrimalInfeasibilities_
double sumPrimalInfeasibilities_
Sum of primal infeasibilities.
Definition: ClpGubMatrix.hpp:291
ClpGubMatrix::saveStatus_
unsigned char * saveStatus_
Saved status of slacks.
Definition: ClpGubMatrix.hpp:309
ClpGubMatrix::primalExpanded
virtual void primalExpanded(ClpSimplex *model, int mode)
mode=0 - Set up before &quot;update&quot; and &quot;times&quot; for primal solution using extended rows mode=1 - Cleanup ...
ClpGubMatrix::backward_
int * backward_
Backward pointer to set number.
Definition: ClpGubMatrix.hpp:313
ClpGubMatrix::lastGub_
int lastGub_
last gub variable (same as end_[numberSets_-1] at present)
Definition: ClpGubMatrix.hpp:351
CoinPackedMatrix
Sparse Matrix Base Class.
Definition: CoinPackedMatrix.hpp:79
ClpGubMatrix::end
int * end() const
End.
Definition: ClpGubMatrix.hpp:256
ClpGubMatrix::possiblePivotKey_
int possiblePivotKey_
Pivot row of possible next key.
Definition: ClpGubMatrix.hpp:345
ClpPackedMatrix::matrix
CoinPackedMatrix * matrix() const
Returns CoinPackedMatrix (non const)
Definition: ClpPackedMatrix.hpp:296
ClpGubMatrix::start
int * start() const
Starts.
Definition: ClpGubMatrix.hpp:252
ClpGubMatrix::upper
double * upper() const
Upper bounds on sets.
Definition: ClpGubMatrix.hpp:264
ClpGubMatrix::dualExpanded
virtual void dualExpanded(ClpSimplex *model, CoinIndexedVector *array, double *other, int mode)
mode=0 - Set up before &quot;updateTranspose&quot; and &quot;transposeTimes&quot; for duals using extended updates array ...
ClpGubMatrix::setFlagged
void setFlagged(int sequence)
To flag a variable.
Definition: ClpGubMatrix.hpp:219
ClpGubMatrix::transposeTimesByRow
virtual void transposeTimesByRow(const ClpSimplex *model, double scalar, const CoinIndexedVector *x, CoinIndexedVector *y, CoinIndexedVector *z) const
Return x * scalar * A + y in z.
ClpGubMatrix::setFeasible
void setFeasible(int sequence)
To say key is feasible.
Definition: ClpGubMatrix.hpp:235
ClpGubMatrix::saveNumber_
int saveNumber_
Number in vector without gub extension.
Definition: ClpGubMatrix.hpp:343
ClpGubMatrix::switchOffCheck
void switchOffCheck()
Switches off dj checking each factorization (for BIG models)
ClpGubMatrix::add
virtual void add(const ClpSimplex *model, CoinIndexedVector *rowArray, int column, double multiplier) const
Adds multiple of a column into an CoinIndexedvector You can use quickAdd to add to vector...
ClpGubMatrix::numberSets
int numberSets() const
Number of sets (gub rows)
Definition: ClpGubMatrix.hpp:276
ClpGubMatrix::correctSequence
virtual void correctSequence(const ClpSimplex *model, int &sequenceIn, int &sequenceOut)
Correct sequence in and out to give true value.
ClpGubMatrix::useEffectiveRhs
virtual void useEffectiveRhs(ClpSimplex *model, bool cheapest=true)
Sets up an effective RHS and does gub crash if needed.
ClpGubMatrix::clearFlagged
void clearFlagged(int sequence)
Status.
Definition: ClpGubMatrix.hpp:222
CoinFactorizationDouble
double CoinFactorizationDouble
Definition: CoinTypes.hpp:57
ClpGubMatrix::keyVariable_
int * keyVariable_
Key variable of set.
Definition: ClpGubMatrix.hpp:319
ClpSimplex::Status
Status
enums for status of various sorts.
Definition: ClpSimplex.hpp:78
ClpGubMatrix::unpack
virtual void unpack(const ClpSimplex *model, CoinIndexedVector *rowArray, int column) const
Unpacks a column into an CoinIndexedvector.
ClpGubMatrix::reverseOrderedCopy
virtual ClpMatrixBase * reverseOrderedCopy() const
Returns a new matrix in reverse order without gaps (GUB wants NULL)
ClpGubMatrix::clone
virtual ClpMatrixBase * clone() const
Clone.
ClpGubMatrix::setBelow
void setBelow(int sequence)
To say key is below lb.
Definition: ClpGubMatrix.hpp:241
ClpPackedMatrix::transposeTimes
virtual void transposeTimes(double scalar, const double *x, double *y) const
Return y + x * scalar * A in y.
ClpGubMatrix::generalExpanded
virtual int generalExpanded(ClpSimplex *model, int mode, int &number)
mode=0 - Create list of non-key basics in pivotVariable_ using number as numberBasic in and out mode=...
ClpGubMatrix::backward
int * backward() const
Backward pointer to set number.
Definition: ClpGubMatrix.hpp:272
ClpGubMatrix::changeCost_
double * changeCost_
Change in costs for keys.
Definition: ClpGubMatrix.hpp:317
CoinIndexedVector
Indexed Vector.
Definition: CoinIndexedVector.hpp:104
ClpGubMatrix::upper_
double * upper_
Upper bounds on sets.
Definition: ClpGubMatrix.hpp:305
ClpGubMatrix::numberSets_
int numberSets_
Number of sets (gub rows)
Definition: ClpGubMatrix.hpp:341
ClpGubMatrix::firstGub_
int firstGub_
First gub variables (same as start_[0] at present)
Definition: ClpGubMatrix.hpp:349
ClpGubMatrix::updatePivot
virtual int updatePivot(ClpSimplex *model, double oldInValue, double oldOutValue)
update information for a pivot (and effective rhs)
ClpSimplex
This solves LPs using the simplex method.
Definition: ClpSimplex.hpp:70
ClpGubMatrix::transposeTimes
virtual void transposeTimes(const ClpSimplex *model, double scalar, const CoinIndexedVector *x, CoinIndexedVector *y, CoinIndexedVector *z) const
Return x * scalar * A + y in z.
ClpPackedMatrix
Definition: ClpPackedMatrix.hpp:21
ClpGubMatrix::setStatus
void setStatus(int sequence, ClpSimplex::Status status)
Status.
Definition: ClpGubMatrix.hpp:213
ClpGubMatrix::status_
unsigned char * status_
Status of slacks.
Definition: ClpGubMatrix.hpp:307
ClpGubMatrix::backToPivotRow_
int * backToPivotRow_
Backward pointer to pivot row !!!
Definition: ClpGubMatrix.hpp:315
ClpMatrixBase
Abstract base class for Clp Matrices.
Definition: ClpMatrixBase.hpp:38
ClpGubMatrix::partialPricing
virtual void partialPricing(ClpSimplex *model, double start, double end, int &bestSequence, int &numberWanted)
Partial pricing.
ClpGubMatrix::next_
int * next_
Next basic variable in set - starts at key and end with -(set+1).
Definition: ClpGubMatrix.hpp:323
CoinPragma.hpp
ClpGubMatrix::~ClpGubMatrix
virtual ~ClpGubMatrix()
Destructor.
ClpPackedMatrix.hpp
ClpGubMatrix::start_
int * start_
Starts.
Definition: ClpGubMatrix.hpp:299
ClpGubMatrix::toIndex_
int * toIndex_
Backward pointer to index in CoinIndexedVector.
Definition: ClpGubMatrix.hpp:325
ClpGubMatrix::hiddenRows
virtual int hiddenRows() const
Returns number of hidden rows e.g. gub.
ClpGubMatrix::fillBasis
virtual void fillBasis(ClpSimplex *model, const int *whichColumn, int &numberColumnBasic, int *row, int *start, int *rowCount, int *columnCount, CoinFactorizationDouble *element)
Fills in column part of basis.
ClpGubMatrix::keyVariable
int * keyVariable() const
Key variable of set.
Definition: ClpGubMatrix.hpp:268
ClpGubMatrix::synchronize
virtual int synchronize(ClpSimplex *model, int mode)
This is local to Gub to allow synchronization: mode=0 when status of basis is good mode=1 when variab...
ClpGubMatrix::end_
int * end_
End.
Definition: ClpGubMatrix.hpp:301
ClpGubMatrix::weight
double weight(int sequence) const
Status.
Definition: ClpGubMatrix.hpp:246
ClpGubMatrix::subsetClone
virtual ClpMatrixBase * subsetClone(int numberRows, const int *whichRows, int numberColumns, const int *whichColumns) const
Subset clone (without gaps).
ClpGubMatrix::unpackPacked
virtual void unpackPacked(ClpSimplex *model, CoinIndexedVector *rowArray, int column) const
Unpacks a column into an CoinIndexedvector in packed foramt Note that model is NOT const...
ClpGubMatrix::operator=
ClpGubMatrix & operator=(const ClpGubMatrix &)
The copy constructor.
ClpGubMatrix::infeasibilityWeight_
double infeasibilityWeight_
Infeasibility weight when last full pass done.
Definition: ClpGubMatrix.hpp:297
ClpGubMatrix::lower
double * lower() const
Lower bounds on sets.
Definition: ClpGubMatrix.hpp:260
ClpGubMatrix::gubType_
int gubType_
type of gub - 0 not contiguous, 1 contiguous add 8 bit to say no ubs on individual variables ...
Definition: ClpGubMatrix.hpp:354
ClpGubMatrix::savedKeyVariable_
int * savedKeyVariable_
Saved key variables.
Definition: ClpGubMatrix.hpp:311
ClpGubMatrix::numberPrimalInfeasibilities_
int numberPrimalInfeasibilities_
Number of primal infeasibilities.
Definition: ClpGubMatrix.hpp:333
ClpGubMatrix::sumOfRelaxedDualInfeasibilities_
double sumOfRelaxedDualInfeasibilities_
Sum of Dual infeasibilities using tolerance based on error in duals.
Definition: ClpGubMatrix.hpp:293
ClpGubMatrix::subsetTransposeTimes
virtual void subsetTransposeTimes(const ClpSimplex *model, const CoinIndexedVector *x, const CoinIndexedVector *y, CoinIndexedVector *z) const
Return &lt;code&gt;x *A&lt;/code&gt; in &lt;code&gt;z&lt;/code&gt; but just for indices in y.