ClpNetworkMatrix.hpp
Go to the documentation of this file.
1 /* $Id: ClpNetworkMatrix.hpp 1525 2010-02-26 17:27:59Z mjs $ */
2 // Copyright (C) 2003, International Business Machines
3 // Corporation and others. All Rights Reserved.
4 #ifndef ClpNetworkMatrix_H
5 #define ClpNetworkMatrix_H
6 
7 
8 #include "CoinPragma.hpp"
9 
10 #include "ClpMatrixBase.hpp"
11 
18 
19 public:
22  virtual CoinPackedMatrix * getPackedMatrix() const;
25  virtual bool isColOrdered() const {
26  return true;
27  }
29  virtual CoinBigIndex getNumElements() const {
30  return 2 * numberColumns_;
31  }
33  virtual int getNumCols() const {
34  return numberColumns_;
35  }
37  virtual int getNumRows() const {
38  return numberRows_;
39  }
40 
45  virtual const double * getElements() const;
51  virtual const int * getIndices() const {
52  return indices_;
53  }
54 
55  virtual const CoinBigIndex * getVectorStarts() const;
57  virtual const int * getVectorLengths() const;
58 
60  virtual void deleteCols(const int numDel, const int * indDel);
62  virtual void deleteRows(const int numDel, const int * indDel);
64  virtual void appendCols(int number, const CoinPackedVectorBase * const * columns);
66  virtual void appendRows(int number, const CoinPackedVectorBase * const * rows);
67 #ifndef SLIM_CLP
68 
72  virtual int appendMatrix(int number, int type,
73  const CoinBigIndex * starts, const int * index,
74  const double * element, int numberOther = -1);
75 #endif
76 
77  virtual ClpMatrixBase * reverseOrderedCopy() const;
79  virtual CoinBigIndex countBasis(
80  const int * whichColumn,
81  int & numberColumnBasic);
83  virtual void fillBasis(ClpSimplex * model,
84  const int * whichColumn,
85  int & numberColumnBasic,
86  int * row, int * start,
87  int * rowCount, int * columnCount,
88  CoinFactorizationDouble * element);
93  virtual CoinBigIndex * dubiousWeights(const ClpSimplex * model, int * inputWeights) const;
97  virtual void rangeOfElements(double & smallestNegative, double & largestNegative,
98  double & smallestPositive, double & largestPositive);
101  virtual void unpack(const ClpSimplex * model, CoinIndexedVector * rowArray,
102  int column) const ;
107  virtual void unpackPacked(ClpSimplex * model,
108  CoinIndexedVector * rowArray,
109  int column) const;
112  virtual void add(const ClpSimplex * model, CoinIndexedVector * rowArray,
113  int column, double multiplier) const ;
115  virtual void add(const ClpSimplex * model, double * array,
116  int column, double multiplier) const;
118  virtual void releasePackedMatrix() const ;
120  virtual bool canDoPartialPricing() const;
122  virtual void partialPricing(ClpSimplex * model, double start, double end,
123  int & bestSequence, int & numberWanted);
125 
131  virtual void times(double scalar,
132  const double * x, double * y) const;
134  virtual void times(double scalar,
135  const double * x, double * y,
136  const double * rowScale,
137  const double * columnScale) const;
141  virtual void transposeTimes(double scalar,
142  const double * x, double * y) const;
144  virtual void transposeTimes(double scalar,
145  const double * x, double * y,
146  const double * rowScale,
147  const double * columnScale, double * spare = NULL) const;
152  virtual void transposeTimes(const ClpSimplex * model, double scalar,
153  const CoinIndexedVector * x,
154  CoinIndexedVector * y,
155  CoinIndexedVector * z) const;
159  virtual void subsetTransposeTimes(const ClpSimplex * model,
160  const CoinIndexedVector * x,
161  const CoinIndexedVector * y,
162  CoinIndexedVector * z) const;
164 
167  inline bool trueNetwork() const {
169  return trueNetwork_;
170  }
172 
173 
179  ClpNetworkMatrix(int numberColumns, const int * head,
180  const int * tail);
182  virtual ~ClpNetworkMatrix();
184 
190  ClpNetworkMatrix(const CoinPackedMatrix&);
191 
194  virtual ClpMatrixBase * clone() const ;
197  ClpNetworkMatrix (const ClpNetworkMatrix & wholeModel,
198  int numberRows, const int * whichRows,
199  int numberColumns, const int * whichColumns);
202  virtual ClpMatrixBase * subsetClone (
203  int numberRows, const int * whichRows,
204  int numberColumns, const int * whichColumns) const ;
206 
207 
208 protected:
212  mutable CoinPackedMatrix * matrix_;
214  mutable int * lengths_;
216  int * indices_;
223 
225 };
226 
227 #endif
virtual int getNumCols() const
Number of columns.
virtual CoinBigIndex getNumElements() const
Number of entries in the packed matrix.
virtual const double * getElements() const
A vector containing the elements in the packed matrix.
virtual const int * getIndices() const
A vector containing the minor indices of the elements in the packed matrix.
virtual void releasePackedMatrix() const
Allow any parts of a created CoinMatrix to be deleted.
virtual bool canDoPartialPricing() const
Says whether it can do partial pricing.
virtual const CoinBigIndex * getVectorStarts() const
Return a complete CoinPackedMatrix.
CoinPackedMatrix * matrix_
For fake CoinPackedMatrix.
int numberColumns_
Number of columns.
int * indices_
Data -1, then +1 rows in pairs (row==-1 if one entry)
virtual CoinBigIndex countBasis(const int *whichColumn, int &numberColumnBasic)
Returns number of elements in column part of basis.
virtual ~ClpNetworkMatrix()
Destructor.
virtual bool isColOrdered() const
Whether the packed matrix is column major ordered or not.
virtual void rangeOfElements(double &smallestNegative, double &largestNegative, double &smallestPositive, double &largestPositive)
Returns largest and smallest elements of both signs.
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)...
int type() const
Returns type.
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...
bool trueNetwork() const
Return true if really network, false if has slacks.
This implements a simple network matrix as derived from ClpMatrixBase.
virtual void deleteRows(const int numDel, const int *indDel)
Delete the rows whose indices are listed in indDel.
virtual ClpMatrixBase * clone() const
Clone.
virtual ClpMatrixBase * reverseOrderedCopy() const
Returns a new matrix in reverse order without gaps.
virtual void transposeTimes(double scalar, const double *x, double *y) const
Return y + x * scalar * A in y.
virtual void deleteCols(const int numDel, const int *indDel)
Delete the columns whose indices are listed in indDel.
virtual ClpMatrixBase * subsetClone(int numberRows, const int *whichRows, int numberColumns, const int *whichColumns) const
Subset clone (without gaps).
virtual void unpackPacked(ClpSimplex *model, CoinIndexedVector *rowArray, int column) const
Unpacks a column into an CoinIndexedvector in packed format Note that model is NOT const...
int numberRows_
Number of rows.
ClpNetworkMatrix()
Default constructor.
ClpNetworkMatrix & operator=(const ClpNetworkMatrix &)
The copy constructor.
int * lengths_
For fake CoinPackedMatrix.
This solves LPs using the simplex method.
Definition: ClpSimplex.hpp:49
virtual const int * getVectorLengths() const
The lengths of the major-dimension vectors.
Abstract base class for Clp Matrices.
virtual void unpack(const ClpSimplex *model, CoinIndexedVector *rowArray, int column) const
Unpacks a column into an CoinIndexedvector.
bool trueNetwork_
True if all entries have two elements.
virtual void subsetTransposeTimes(const ClpSimplex *model, const CoinIndexedVector *x, const CoinIndexedVector *y, CoinIndexedVector *z) const
Return x *A in z but just for indices in y.
virtual void appendCols(int number, const CoinPackedVectorBase *const *columns)
Append Columns.
virtual int getNumRows() const
Number of rows.
virtual void times(double scalar, const double *x, double *y) const
Return y + A * scalar *x in y.
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.
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.
virtual void partialPricing(ClpSimplex *model, double start, double end, int &bestSequence, int &numberWanted)
Partial pricing.
virtual void appendRows(int number, const CoinPackedVectorBase *const *rows)
Append Rows.
virtual CoinPackedMatrix * getPackedMatrix() const
Return a complete CoinPackedMatrix.