00001
00002
00003
00004
00005
00006 #ifndef ClpNetworkMatrix_H
00007 #define ClpNetworkMatrix_H
00008
00009
00010 #include "CoinPragma.hpp"
00011
00012 #include "ClpMatrixBase.hpp"
00013
00019 class ClpNetworkMatrix : public ClpMatrixBase {
00020
00021 public:
00024
00025 virtual CoinPackedMatrix * getPackedMatrix() const;
00027 virtual bool isColOrdered() const {
00028 return true;
00029 }
00031 virtual CoinBigIndex getNumElements() const {
00032 return 2 * numberColumns_;
00033 }
00035 virtual int getNumCols() const {
00036 return numberColumns_;
00037 }
00039 virtual int getNumRows() const {
00040 return numberRows_;
00041 }
00042
00047 virtual const double * getElements() const;
00053 virtual const int * getIndices() const {
00054 return indices_;
00055 }
00056
00057 virtual const CoinBigIndex * getVectorStarts() const;
00059 virtual const int * getVectorLengths() const;
00060
00062 virtual void deleteCols(const int numDel, const int * indDel);
00064 virtual void deleteRows(const int numDel, const int * indDel);
00066 virtual void appendCols(int number, const CoinPackedVectorBase * const * columns);
00068 virtual void appendRows(int number, const CoinPackedVectorBase * const * rows);
00069 #ifndef SLIM_CLP
00070
00074 virtual int appendMatrix(int number, int type,
00075 const CoinBigIndex * starts, const int * index,
00076 const double * element, int numberOther = -1);
00077 #endif
00078
00079 virtual ClpMatrixBase * reverseOrderedCopy() const;
00081 virtual CoinBigIndex countBasis(
00082 const int * whichColumn,
00083 int & numberColumnBasic);
00085 virtual void fillBasis(ClpSimplex * model,
00086 const int * whichColumn,
00087 int & numberColumnBasic,
00088 int * row, int * start,
00089 int * rowCount, int * columnCount,
00090 CoinFactorizationDouble * element);
00095 virtual CoinBigIndex * dubiousWeights(const ClpSimplex * model, int * inputWeights) const;
00099 virtual void rangeOfElements(double & smallestNegative, double & largestNegative,
00100 double & smallestPositive, double & largestPositive);
00103 virtual void unpack(const ClpSimplex * model, CoinIndexedVector * rowArray,
00104 int column) const ;
00109 virtual void unpackPacked(ClpSimplex * model,
00110 CoinIndexedVector * rowArray,
00111 int column) const;
00114 virtual void add(const ClpSimplex * model, CoinIndexedVector * rowArray,
00115 int column, double multiplier) const ;
00117 virtual void add(const ClpSimplex * model, double * array,
00118 int column, double multiplier) const;
00120 virtual void releasePackedMatrix() const ;
00122 virtual bool canDoPartialPricing() const;
00124 virtual void partialPricing(ClpSimplex * model, double start, double end,
00125 int & bestSequence, int & numberWanted);
00127
00133 virtual void times(double scalar,
00134 const double * x, double * y) const;
00136 virtual void times(double scalar,
00137 const double * x, double * y,
00138 const double * rowScale,
00139 const double * columnScale) const;
00143 virtual void transposeTimes(double scalar,
00144 const double * x, double * y) const;
00146 virtual void transposeTimes(double scalar,
00147 const double * x, double * y,
00148 const double * rowScale,
00149 const double * columnScale, double * spare = NULL) const;
00154 virtual void transposeTimes(const ClpSimplex * model, double scalar,
00155 const CoinIndexedVector * x,
00156 CoinIndexedVector * y,
00157 CoinIndexedVector * z) const;
00161 virtual void subsetTransposeTimes(const ClpSimplex * model,
00162 const CoinIndexedVector * x,
00163 const CoinIndexedVector * y,
00164 CoinIndexedVector * z) const;
00166
00169
00170 inline bool trueNetwork() const {
00171 return trueNetwork_;
00172 }
00174
00175
00179 ClpNetworkMatrix();
00181 ClpNetworkMatrix(int numberColumns, const int * head,
00182 const int * tail);
00184 virtual ~ClpNetworkMatrix();
00186
00190 ClpNetworkMatrix(const ClpNetworkMatrix&);
00192 ClpNetworkMatrix(const CoinPackedMatrix&);
00193
00194 ClpNetworkMatrix& operator=(const ClpNetworkMatrix&);
00196 virtual ClpMatrixBase * clone() const ;
00199 ClpNetworkMatrix (const ClpNetworkMatrix & wholeModel,
00200 int numberRows, const int * whichRows,
00201 int numberColumns, const int * whichColumns);
00204 virtual ClpMatrixBase * subsetClone (
00205 int numberRows, const int * whichRows,
00206 int numberColumns, const int * whichColumns) const ;
00208
00209
00210 protected:
00214
00215 mutable CoinPackedMatrix * matrix_;
00216 mutable int * lengths_;
00218 int * indices_;
00220 int numberRows_;
00222 int numberColumns_;
00224 bool trueNetwork_;
00225
00227 };
00228
00229 #endif