Cgl 0.59.7

- 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
ClpPlusMinusOneMatrix.hpp
Go to the documentation of this file.
1 /* $Id: ClpPlusMinusOneMatrix.hpp 2078 2015-01-05 12:39:49Z forrest $ */
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 ClpPlusMinusOneMatrix_H
7 #define ClpPlusMinusOneMatrix_H
8
9
10 #include "CoinPragma.hpp"
11
12 #include "ClpMatrixBase.hpp"
13
18 class ClpPlusMinusOneMatrix : public ClpMatrixBase {
19
20 public:
23 virtual CoinPackedMatrix * getPackedMatrix() const;
26 virtual bool isColOrdered() const ;
28 virtual CoinBigIndex getNumElements() const;
30 virtual int getNumCols() const {
31 return numberColumns_;
32 }
34 virtual int getNumRows() const {
35 return numberRows_;
36 }
37
42 virtual const double * getElements() const;
48 virtual const int * getIndices() const {
49 return indices_;
50 }
51 // and for advanced use
52 int * getMutableIndices() const {
53 return indices_;
54 }
55
56 virtual const CoinBigIndex * getVectorStarts() const;
58 virtual const int * getVectorLengths() const;
59
61 virtual void deleteCols(const int numDel, const int * indDel);
63 virtual void deleteRows(const int numDel, const int * indDel);
65 virtual void appendCols(int number, const CoinPackedVectorBase * const * columns);
67 virtual void appendRows(int number, const CoinPackedVectorBase * const * rows);
68 #ifndef SLIM_CLP
69
73 virtual int appendMatrix(int number, int type,
74 const CoinBigIndex * starts, const int * index,
75 const double * element, int numberOther = -1);
76 #endif
77
78 virtual ClpMatrixBase * reverseOrderedCopy() const;
80 virtual CoinBigIndex countBasis(
81 const int * whichColumn,
82 int & numberColumnBasic);
84 virtual void fillBasis(ClpSimplex * model,
85 const int * whichColumn,
86 int & numberColumnBasic,
87 int * row, int * start,
88 int * rowCount, int * columnCount,
89 CoinFactorizationDouble * element);
94 virtual CoinBigIndex * dubiousWeights(const ClpSimplex * model, int * inputWeights) const;
98 virtual void rangeOfElements(double & smallestNegative, double & largestNegative,
99 double & smallestPositive, double & largestPositive);
102 virtual void unpack(const ClpSimplex * model, CoinIndexedVector * rowArray,
103 int column) const ;
108 virtual void unpackPacked(ClpSimplex * model,
109 CoinIndexedVector * rowArray,
110 int column) const;
113 virtual void add(const ClpSimplex * model, CoinIndexedVector * rowArray,
114 int column, double multiplier) const ;
116 virtual void add(const ClpSimplex * model, double * array,
117 int column, double multiplier) const;
119 virtual void releasePackedMatrix() const;
125 virtual void setDimensions(int numrows, int numcols);
127 void checkValid(bool detail) const;
129
135 virtual void times(double scalar,
136 const double * x, double * y) const;
138 virtual void times(double scalar,
139 const double * x, double * y,
140 const double * rowScale,
141 const double * columnScale) const;
145 virtual void transposeTimes(double scalar,
146 const double * x, double * y) const;
148 virtual void transposeTimes(double scalar,
149 const double * x, double * y,
150 const double * rowScale,
151 const double * columnScale, double * spare = NULL) const;
156 virtual void transposeTimes(const ClpSimplex * model, double scalar,
157 const CoinIndexedVector * x,
158 CoinIndexedVector * y,
159 CoinIndexedVector * z) const;
165 virtual void transposeTimesByRow(const ClpSimplex * model, double scalar,
166 const CoinIndexedVector * x,
167 CoinIndexedVector * y,
168 CoinIndexedVector * z) const;
172 virtual void subsetTransposeTimes(const ClpSimplex * model,
173 const CoinIndexedVector * x,
174 const CoinIndexedVector * y,
175 CoinIndexedVector * z) const;
178 virtual bool canCombine(const ClpSimplex * model,
179 const CoinIndexedVector * pi) const;
181 virtual void transposeTimes2(const ClpSimplex * model,
182 const CoinIndexedVector * pi1, CoinIndexedVector * dj1,
183 const CoinIndexedVector * pi2,
184 CoinIndexedVector * spare,
185 double referenceIn, double devex,
186 // Array for exact devex to say what is in reference framework
187 unsigned int * reference,
188 double * weights, double scaleFactor);
190 virtual void subsetTimes2(const ClpSimplex * model,
191 CoinIndexedVector * dj1,
192 const CoinIndexedVector * pi2, CoinIndexedVector * dj2,
193 double referenceIn, double devex,
194 // Array for exact devex to say what is in reference framework
195 unsigned int * reference,
196 double * weights, double scaleFactor);
198
201 inline CoinBigIndex * startPositive() const {
203 return startPositive_;
204 }
206 inline CoinBigIndex * startNegative() const {
207 return startNegative_;
208 }
210
211
215 ClpPlusMinusOneMatrix();
217 virtual ~ClpPlusMinusOneMatrix();
219
223 ClpPlusMinusOneMatrix(const ClpPlusMinusOneMatrix&);
230 ClpPlusMinusOneMatrix(const CoinPackedMatrix&);
232 ClpPlusMinusOneMatrix(int numberRows, int numberColumns,
233 bool columnOrdered, const int * indices,
234 const CoinBigIndex * startPositive, const CoinBigIndex * startNegative);
237 ClpPlusMinusOneMatrix (const ClpPlusMinusOneMatrix & wholeModel,
238 int numberRows, const int * whichRows,
239 int numberColumns, const int * whichColumns);
240
241 ClpPlusMinusOneMatrix& operator=(const ClpPlusMinusOneMatrix&);
243 virtual ClpMatrixBase * clone() const ;
246 virtual ClpMatrixBase * subsetClone (
247 int numberRows, const int * whichRows,
248 int numberColumns, const int * whichColumns) const ;
250 void passInCopy(int numberRows, int numberColumns,
251 bool columnOrdered, int * indices,
252 CoinBigIndex * startPositive, CoinBigIndex * startNegative);
254 virtual bool canDoPartialPricing() const;
256 virtual void partialPricing(ClpSimplex * model, double start, double end,
257 int & bestSequence, int & numberWanted);
259
260
261 protected:
265 mutable CoinPackedMatrix * matrix_;
267 mutable int * lengths_;
269 CoinBigIndex * COIN_RESTRICT startPositive_;
271 CoinBigIndex * COIN_RESTRICT startNegative_;
273 int * COIN_RESTRICT indices_;
275 int numberRows_;
277 int numberColumns_;
278 #ifdef CLP_PLUS_ONE_MATRIX
279
282 mutable int otherFlags_;
283 #endif
284 bool columnOrdered_;
286
288 };
289
290 #endif
ClpPlusMinusOneMatrix::rangeOfElements
virtual void rangeOfElements(double &smallestNegative, double &largestNegative, double &smallestPositive, double &largestPositive)
Returns largest and smallest elements of both signs.
ClpMatrixBase::type
int type() const
Returns type.
Definition: ClpMatrixBase.hpp:370
ClpPlusMinusOneMatrix::partialPricing
virtual void partialPricing(ClpSimplex *model, double start, double end, int &bestSequence, int &numberWanted)
Partial pricing.
ClpPlusMinusOneMatrix::dubiousWeights
virtual CoinBigIndex * dubiousWeights(const ClpSimplex *model, int *inputWeights) const
Given positive integer weights for each row fills in sum of weights for each column (and slack)...
ClpPlusMinusOneMatrix::canDoPartialPricing
virtual bool canDoPartialPricing() const
Says whether it can do partial pricing.
ClpPlusMinusOneMatrix::getNumRows
virtual int getNumRows() const
Number of rows.
Definition: ClpPlusMinusOneMatrix.hpp:34
ClpMatrixBase
Abstract base class for Clp Matrices.
Definition: ClpMatrixBase.hpp:38
ClpPlusMinusOneMatrix::getNumElements
virtual CoinBigIndex getNumElements() const
Number of entries in the packed matrix.
ClpPlusMinusOneMatrix::deleteRows
virtual void deleteRows(const int numDel, const int *indDel)
Delete the rows whose indices are listed in indDel.
ClpPlusMinusOneMatrix::clone
virtual ClpMatrixBase * clone() const
Clone.
ClpPlusMinusOneMatrix::matrix_
CoinPackedMatrix * matrix_
For fake CoinPackedMatrix.
Definition: ClpPlusMinusOneMatrix.hpp:266
ClpPlusMinusOneMatrix::lengths_
int * lengths_
Definition: ClpPlusMinusOneMatrix.hpp:267
ClpPlusMinusOneMatrix::transposeTimesByRow
virtual void transposeTimesByRow(const ClpSimplex *model, double scalar, const CoinIndexedVector *x, CoinIndexedVector *y, CoinIndexedVector *z) const
Return x * scalar * A + y in z.
ClpPlusMinusOneMatrix::setDimensions
virtual void setDimensions(int numrows, int numcols)
Set the dimensions of the matrix.
ClpPlusMinusOneMatrix::getVectorLengths
virtual const int * getVectorLengths() const
The lengths of the major-dimension vectors.
ClpPlusMinusOneMatrix::deleteCols
virtual void deleteCols(const int numDel, const int *indDel)
Delete the columns whose indices are listed in indDel.
ClpMatrixBase.hpp
ClpPlusMinusOneMatrix::transposeTimes2
virtual void transposeTimes2(const ClpSimplex *model, const CoinIndexedVector *pi1, CoinIndexedVector *dj1, const CoinIndexedVector *pi2, CoinIndexedVector *spare, double referenceIn, double devex, unsigned int *reference, double *weights, double scaleFactor)
Updates two arrays for steepest.
COIN_RESTRICT
#define COIN_RESTRICT
Definition: ClpMatrixBase.hpp:21
CoinPackedVectorBase
Abstract base class for various sparse vectors.
Definition: CoinPackedVectorBase.hpp:23
ClpPlusMinusOneMatrix::getMutableIndices
int * getMutableIndices() const
Definition: ClpPlusMinusOneMatrix.hpp:52
ClpPlusMinusOneMatrix::reverseOrderedCopy
virtual ClpMatrixBase * reverseOrderedCopy() const
Returns a new matrix in reverse order without gaps.
CoinFactorizationDouble
double CoinFactorizationDouble
Definition: CoinTypes.hpp:57
ClpPlusMinusOneMatrix
This implements a simple +- one matrix as derived from ClpMatrixBase.
Definition: ClpPlusMinusOneMatrix.hpp:18
ClpPlusMinusOneMatrix::transposeTimes
virtual void transposeTimes(double scalar, const double *x, double *y) const
Return y + x * scalar * A in y.
ClpPlusMinusOneMatrix::times
virtual void times(double scalar, const double *x, double *y) const
Return y + A * scalar *x in y.
ClpSimplex
This solves LPs using the simplex method.
Definition: ClpSimplex.hpp:70
ClpPlusMinusOneMatrix::getIndices
virtual const int * getIndices() const
A vector containing the minor indices of the elements in the packed matrix.
Definition: ClpPlusMinusOneMatrix.hpp:48
ClpPlusMinusOneMatrix::checkValid
void checkValid(bool detail) const
Just checks matrix valid - will say if dimensions not quite right if detail.
CoinIndexedVector
Indexed Vector.
Definition: CoinIndexedVector.hpp:104
CoinPragma.hpp
ClpPlusMinusOneMatrix::ClpPlusMinusOneMatrix
ClpPlusMinusOneMatrix()
Default constructor.
ClpPlusMinusOneMatrix::indices_
int *COIN_RESTRICT indices_
Data -1, then +1 rows in pairs (row==-1 if one entry)
Definition: ClpPlusMinusOneMatrix.hpp:273
ClpPlusMinusOneMatrix::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...
ClpPlusMinusOneMatrix::numberRows_
int numberRows_
Number of rows.
Definition: ClpPlusMinusOneMatrix.hpp:275
ClpPlusMinusOneMatrix::canCombine
virtual bool canCombine(const ClpSimplex *model, const CoinIndexedVector *pi) const
Returns true if can combine transposeTimes and subsetTransposeTimes and if it would be faster...
ClpPlusMinusOneMatrix::numberColumns_
int numberColumns_
Number of columns.
Definition: ClpPlusMinusOneMatrix.hpp:277
ClpPlusMinusOneMatrix::getVectorStarts
virtual const CoinBigIndex * getVectorStarts() const
ClpPlusMinusOneMatrix::~ClpPlusMinusOneMatrix
virtual ~ClpPlusMinusOneMatrix()
Destructor.
ClpPlusMinusOneMatrix::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.
ClpPlusMinusOneMatrix::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...
ClpPlusMinusOneMatrix::startNegative_
CoinBigIndex *COIN_RESTRICT startNegative_
Start of -1&#39;s for each.
Definition: ClpPlusMinusOneMatrix.hpp:271
ClpPlusMinusOneMatrix::isColOrdered
virtual bool isColOrdered() const
Whether the packed matrix is column major ordered or not.
CoinPackedMatrix
Sparse Matrix Base Class.
Definition: CoinPackedMatrix.hpp:79
ClpPlusMinusOneMatrix::unpack
virtual void unpack(const ClpSimplex *model, CoinIndexedVector *rowArray, int column) const
Unpacks a column into an CoinIndexedvector.
ClpPlusMinusOneMatrix::appendRows
virtual void appendRows(int number, const CoinPackedVectorBase *const *rows)
Append Rows.
ClpPlusMinusOneMatrix::getElements
virtual const double * getElements() const
A vector containing the elements in the packed matrix.
ClpPlusMinusOneMatrix::startNegative
CoinBigIndex * startNegative() const
Return starts of -1s.
Definition: ClpPlusMinusOneMatrix.hpp:206
ClpPlusMinusOneMatrix::startPositive_
CoinBigIndex *COIN_RESTRICT startPositive_
Start of +1&#39;s for each.
Definition: ClpPlusMinusOneMatrix.hpp:269
CoinBigIndex
int CoinBigIndex
Definition: Coin_C_defines.h:105
ClpPlusMinusOneMatrix::subsetClone
virtual ClpMatrixBase * subsetClone(int numberRows, const int *whichRows, int numberColumns, const int *whichColumns) const
Subset clone (without gaps).
ClpPlusMinusOneMatrix::countBasis
virtual CoinBigIndex countBasis(const int *whichColumn, int &numberColumnBasic)
Returns number of elements in column part of basis.
ClpPlusMinusOneMatrix::getNumCols
virtual int getNumCols() const
Number of columns.
Definition: ClpPlusMinusOneMatrix.hpp:30
ClpPlusMinusOneMatrix::releasePackedMatrix
virtual void releasePackedMatrix() const
Allow any parts of a created CoinMatrix to be deleted.
ClpPlusMinusOneMatrix::appendCols
virtual void appendCols(int number, const CoinPackedVectorBase *const *columns)
Append Columns.
ClpPlusMinusOneMatrix::getPackedMatrix
virtual CoinPackedMatrix * getPackedMatrix() const
Return a complete CoinPackedMatrix.
ClpPlusMinusOneMatrix::startPositive
CoinBigIndex * startPositive() const
Return starts of +1s.
Definition: ClpPlusMinusOneMatrix.hpp:202
ClpPlusMinusOneMatrix::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.
ClpPlusMinusOneMatrix::subsetTimes2
virtual void subsetTimes2(const ClpSimplex *model, CoinIndexedVector *dj1, const CoinIndexedVector *pi2, CoinIndexedVector *dj2, double referenceIn, double devex, unsigned int *reference, double *weights, double scaleFactor)
Updates second array for steepest and does devex weights.
ClpPlusMinusOneMatrix::operator=
ClpPlusMinusOneMatrix & operator=(const ClpPlusMinusOneMatrix &)
ClpPlusMinusOneMatrix::columnOrdered_
bool columnOrdered_
True if column ordered.
Definition: ClpPlusMinusOneMatrix.hpp:285
ClpPlusMinusOneMatrix::appendMatrix
virtual int appendMatrix(int number, int type, const CoinBigIndex *starts, const int *index, const double *element, int numberOther=-1)
Append a set of rows/columns to the end of the matrix.
ClpPlusMinusOneMatrix::passInCopy
void passInCopy(int numberRows, int numberColumns, bool columnOrdered, int *indices, CoinBigIndex *startPositive, CoinBigIndex *startNegative)
pass in copy (object takes ownership)