Clp  1.17.8
ClpNetworkMatrix.hpp
Go to the documentation of this file.
1 /* $Id$ */
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 ClpNetworkMatrix_H
7 #define ClpNetworkMatrix_H
8 
9 #include "CoinPragma.hpp"
10 
11 #include "ClpMatrixBase.hpp"
12 
19 
20 public:
23  virtual CoinPackedMatrix *getPackedMatrix() const;
26  virtual bool isColOrdered() const
27  {
28  return true;
29  }
31  virtual CoinBigIndex getNumElements() const
32  {
33  return 2 * numberColumns_;
34  }
36  virtual int getNumCols() const
37  {
38  return numberColumns_;
39  }
41  virtual int getNumRows() const
42  {
43  return numberRows_;
44  }
45 
50  virtual const double *getElements() const;
56  virtual const int *getIndices() const
57  {
58  return indices_;
59  }
60 
61  virtual const CoinBigIndex *getVectorStarts() const;
63  virtual const int *getVectorLengths() const;
64 
66  virtual void deleteCols(const int numDel, const int *indDel);
68  virtual void deleteRows(const int numDel, const int *indDel);
70  virtual void appendCols(int number, const CoinPackedVectorBase *const *columns);
72  virtual void appendRows(int number, const CoinPackedVectorBase *const *rows);
73 #ifndef SLIM_CLP
74 
78  virtual int appendMatrix(int number, int type,
79  const CoinBigIndex *starts, const int *index,
80  const double *element, int numberOther = -1);
81 #endif
82 
83  virtual ClpMatrixBase *reverseOrderedCopy() const;
85  virtual int countBasis(
86  const int *whichColumn,
87  int &numberColumnBasic);
89  virtual void fillBasis(ClpSimplex *model,
90  const int *whichColumn,
91  int &numberColumnBasic,
92  int *row, int *start,
93  int *rowCount, int *columnCount,
94  CoinFactorizationDouble *element);
99  virtual CoinBigIndex *dubiousWeights(const ClpSimplex *model, int *inputWeights) const;
103  virtual void rangeOfElements(double &smallestNegative, double &largestNegative,
104  double &smallestPositive, double &largestPositive);
107  virtual void unpack(const ClpSimplex *model, CoinIndexedVector *rowArray,
108  int column) const;
113  virtual void unpackPacked(ClpSimplex *model,
114  CoinIndexedVector *rowArray,
115  int column) const;
118  virtual void add(const ClpSimplex *model, CoinIndexedVector *rowArray,
119  int column, double multiplier) const;
121  virtual void add(const ClpSimplex *model, double *array,
122  int column, double multiplier) const;
124  virtual void releasePackedMatrix() const;
126  virtual bool canDoPartialPricing() const;
128  virtual void partialPricing(ClpSimplex *model, double start, double end,
129  int &bestSequence, int &numberWanted);
131 
137  virtual void times(double scalar,
138  const double *x, double *y) const;
140  virtual void times(double scalar,
141  const double *x, double *y,
142  const double *rowScale,
143  const double *columnScale) const;
147  virtual void transposeTimes(double scalar,
148  const double *x, double *y) const;
150  virtual void transposeTimes(double scalar,
151  const double *x, double *y,
152  const double *rowScale,
153  const double *columnScale, double *spare = NULL) const;
158  virtual void transposeTimes(const ClpSimplex *model, double scalar,
159  const CoinIndexedVector *x,
160  CoinIndexedVector *y,
161  CoinIndexedVector *z) const;
165  virtual void subsetTransposeTimes(const ClpSimplex *model,
166  const CoinIndexedVector *x,
167  const CoinIndexedVector *y,
168  CoinIndexedVector *z) const;
170 
173  inline bool trueNetwork() const
175  {
176  return trueNetwork_;
177  }
179 
185  ClpNetworkMatrix(int numberColumns, const int *head,
186  const int *tail);
188  virtual ~ClpNetworkMatrix();
190 
196  ClpNetworkMatrix(const CoinPackedMatrix &);
197 
200  virtual ClpMatrixBase *clone() const;
203  ClpNetworkMatrix(const ClpNetworkMatrix &wholeModel,
204  int numberRows, const int *whichRows,
205  int numberColumns, const int *whichColumns);
208  virtual ClpMatrixBase *subsetClone(
209  int numberRows, const int *whichRows,
210  int numberColumns, const int *whichColumns) const;
212 
213 protected:
217  mutable CoinPackedMatrix *matrix_;
219  mutable int *lengths_;
221  int *indices_;
228 
230 };
231 
232 #endif
233 
234 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
235 */
ClpSimplex
This solves LPs using the simplex method.
Definition: ClpSimplex.hpp:106
ClpNetworkMatrix::ClpNetworkMatrix
ClpNetworkMatrix()
Default constructor.
ClpNetworkMatrix::getIndices
virtual const int * getIndices() const
A vector containing the minor indices of the elements in the packed matrix.
Definition: ClpNetworkMatrix.hpp:56
ClpNetworkMatrix::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.
ClpMatrixBase::type
int type() const
Returns type.
Definition: ClpMatrixBase.hpp:383
ClpNetworkMatrix::partialPricing
virtual void partialPricing(ClpSimplex *model, double start, double end, int &bestSequence, int &numberWanted)
Partial pricing.
ClpNetworkMatrix::operator=
ClpNetworkMatrix & operator=(const ClpNetworkMatrix &)
ClpNetworkMatrix::getElements
virtual const double * getElements() const
A vector containing the elements in the packed matrix.
ClpNetworkMatrix::getNumRows
virtual int getNumRows() const
Number of rows.
Definition: ClpNetworkMatrix.hpp:41
ClpNetworkMatrix::trueNetwork_
bool trueNetwork_
True if all entries have two elements.
Definition: ClpNetworkMatrix.hpp:227
ClpMatrixBase.hpp
ClpNetworkMatrix::getPackedMatrix
virtual CoinPackedMatrix * getPackedMatrix() const
Return a complete CoinPackedMatrix.
ClpNetworkMatrix::countBasis
virtual int countBasis(const int *whichColumn, int &numberColumnBasic)
Returns number of elements in column part of basis.
ClpNetworkMatrix::transposeTimes
virtual void transposeTimes(double scalar, const double *x, double *y) const
Return y + x * scalar * A in y.
ClpNetworkMatrix::indices_
int * indices_
Data -1, then +1 rows in pairs (row==-1 if one entry)
Definition: ClpNetworkMatrix.hpp:221
ClpNetworkMatrix::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.
ClpNetworkMatrix::isColOrdered
virtual bool isColOrdered() const
Whether the packed matrix is column major ordered or not.
Definition: ClpNetworkMatrix.hpp:26
ClpNetworkMatrix::deleteCols
virtual void deleteCols(const int numDel, const int *indDel)
Delete the columns whose indices are listed in indDel.
ClpNetworkMatrix::unpack
virtual void unpack(const ClpSimplex *model, CoinIndexedVector *rowArray, int column) const
Unpacks a column into an CoinIndexedvector.
ClpNetworkMatrix::unpackPacked
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.
ClpNetworkMatrix::trueNetwork
bool trueNetwork() const
Return true if really network, false if has slacks.
Definition: ClpNetworkMatrix.hpp:174
ClpNetworkMatrix::getVectorStarts
virtual const CoinBigIndex * getVectorStarts() const
ClpNetworkMatrix::appendRows
virtual void appendRows(int number, const CoinPackedVectorBase *const *rows)
Append Rows.
ClpNetworkMatrix
This implements a simple network matrix as derived from ClpMatrixBase.
Definition: ClpNetworkMatrix.hpp:18
ClpNetworkMatrix::appendCols
virtual void appendCols(int number, const CoinPackedVectorBase *const *columns)
Append Columns.
ClpMatrixBase
Abstract base class for Clp Matrices.
Definition: ClpMatrixBase.hpp:38
ClpNetworkMatrix::times
virtual void times(double scalar, const double *x, double *y) const
Return y + A * scalar *x in y.
ClpNetworkMatrix::numberRows_
int numberRows_
Number of rows.
Definition: ClpNetworkMatrix.hpp:223
ClpNetworkMatrix::lengths_
int * lengths_
Definition: ClpNetworkMatrix.hpp:219
ClpNetworkMatrix::clone
virtual ClpMatrixBase * clone() const
Clone.
ClpNetworkMatrix::reverseOrderedCopy
virtual ClpMatrixBase * reverseOrderedCopy() const
Returns a new matrix in reverse order without gaps.
ClpNetworkMatrix::subsetTransposeTimes
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.
ClpNetworkMatrix::getVectorLengths
virtual const int * getVectorLengths() const
The lengths of the major-dimension vectors.
ClpNetworkMatrix::deleteRows
virtual void deleteRows(const int numDel, const int *indDel)
Delete the rows whose indices are listed in indDel.
ClpNetworkMatrix::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.
ClpNetworkMatrix::getNumElements
virtual CoinBigIndex getNumElements() const
Number of entries in the packed matrix.
Definition: ClpNetworkMatrix.hpp:31
ClpNetworkMatrix::subsetClone
virtual ClpMatrixBase * subsetClone(int numberRows, const int *whichRows, int numberColumns, const int *whichColumns) const
Subset clone (without gaps).
ClpNetworkMatrix::numberColumns_
int numberColumns_
Number of columns.
Definition: ClpNetworkMatrix.hpp:225
ClpNetworkMatrix::~ClpNetworkMatrix
virtual ~ClpNetworkMatrix()
Destructor.
ClpNetworkMatrix::releasePackedMatrix
virtual void releasePackedMatrix() const
Allow any parts of a created CoinMatrix to be deleted.
ClpNetworkMatrix::getNumCols
virtual int getNumCols() const
Number of columns.
Definition: ClpNetworkMatrix.hpp:36
ClpNetworkMatrix::matrix_
CoinPackedMatrix * matrix_
For fake CoinPackedMatrix.
Definition: ClpNetworkMatrix.hpp:218
ClpNetworkMatrix::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).
ClpNetworkMatrix::rangeOfElements
virtual void rangeOfElements(double &smallestNegative, double &largestNegative, double &smallestPositive, double &largestPositive)
Returns largest and smallest elements of both signs.
ClpNetworkMatrix::canDoPartialPricing
virtual bool canDoPartialPricing() const
Says whether it can do partial pricing.