00001
00002
00003 #ifndef ClpMatrixBase_H
00004 #define ClpMatrixBase_H
00005
00006 #include "CoinPragma.hpp"
00007
00008 #include "CoinPackedMatrix.hpp"
00009 class CoinIndexedVector;
00010 class ClpSimplex;
00011 class ClpModel;
00012
00026 class ClpMatrixBase {
00027
00028 public:
00031
00032 virtual CoinPackedMatrix * getPackedMatrix() const = 0;
00034 virtual bool isColOrdered() const = 0;
00036 virtual CoinBigIndex getNumElements() const = 0;
00038 virtual int getNumCols() const = 0;
00040 virtual int getNumRows() const = 0;
00041
00046 virtual const double * getElements() const = 0;
00052 virtual const int * getIndices() const = 0;
00053
00054 virtual const CoinBigIndex * getVectorStarts() const = 0;
00056 virtual const int * getVectorLengths() const = 0 ;
00058 virtual void deleteCols(const int numDel, const int * indDel) = 0;
00060 virtual void deleteRows(const int numDel, const int * indDel) = 0;
00062 virtual void appendCols(int number, const CoinPackedVectorBase * const * columns);
00064 virtual void appendRows(int number, const CoinPackedVectorBase * const * rows);
00065
00068 virtual ClpMatrixBase * reverseOrderedCopy() const {return NULL;};
00069
00072 virtual CoinBigIndex fillBasis(ClpSimplex * model,
00073 const int * whichColumn,
00074 int numberRowBasic,
00075 int & numberColumnBasic,
00076 int * row, int * column,
00077 double * element) = 0;
00081 virtual int scale(ClpModel * model) const
00082 { return 1;};
00085 virtual void scaleRowCopy(ClpModel * model) const
00086 { };
00090 inline virtual ClpMatrixBase * scaledColumnCopy(ClpModel * model) const
00091 { return this->clone();};
00092
00098 virtual bool allElementsInRange(ClpModel * model,
00099 double smallest, double largest)
00100 { return true;};
00104 virtual void rangeOfElements(double & smallestNegative, double & largestNegative,
00105 double & smallestPositive, double & largestPositive);
00106
00109 virtual void unpack(const ClpSimplex * model,CoinIndexedVector * rowArray,
00110 int column) const =0;
00115 virtual void unpackPacked(ClpSimplex * model,
00116 CoinIndexedVector * rowArray,
00117 int column) const =0;
00122 virtual int refresh(ClpSimplex * model)
00123 { return 0;};
00124
00125 virtual void reallyScale(const double * rowScale, const double * columnScale);
00131 virtual CoinBigIndex * dubiousWeights(const ClpSimplex * model,int * inputWeights) const;
00134 virtual void add(const ClpSimplex * model,CoinIndexedVector * rowArray,
00135 int column, double multiplier) const =0;
00137 virtual void add(const ClpSimplex * model,double * array,
00138 int column, double multiplier) const =0;
00140 virtual void releasePackedMatrix() const =0;
00142 virtual bool canDoPartialPricing() const;
00144 virtual int hiddenRows() const;
00146 virtual void partialPricing(ClpSimplex * model, double start, double end,
00147 int & bestSequence, int & numberWanted);
00157 virtual int extendUpdated(ClpSimplex * model,CoinIndexedVector * update,int mode);
00164 virtual void primalExpanded(ClpSimplex * model,int mode);
00174 virtual void dualExpanded(ClpSimplex * model,CoinIndexedVector * array,
00175 double * other,int mode);
00194 virtual int generalExpanded(ClpSimplex * model,int mode,int & number);
00198 virtual int updatePivot(ClpSimplex * model,double oldInValue, double oldOutValue);
00202 virtual void createVariable(ClpSimplex * model, int & bestSequence);
00205 virtual int checkFeasible(ClpSimplex * model) const ;
00207 double reducedCost(ClpSimplex * model,int sequence) const;
00209 virtual void correctSequence(int & sequenceIn, int & sequenceOut) const;
00211
00212
00220 virtual void times(double scalar,
00221 const double * x, double * y) const=0;
00225 virtual void times(double scalar,
00226 const double * x, double * y,
00227 const double * rowScale,
00228 const double * columnScale) const;
00232 virtual void transposeTimes(double scalar,
00233 const double * x, double * y) const = 0;
00237 virtual void transposeTimes(double scalar,
00238 const double * x, double * y,
00239 const double * rowScale,
00240 const double * columnScale) const;
00245 virtual void transposeTimes(const ClpSimplex * model, double scalar,
00246 const CoinIndexedVector * x,
00247 CoinIndexedVector * y,
00248 CoinIndexedVector * z) const = 0;
00254 virtual void subsetTransposeTimes(const ClpSimplex * model,
00255 const CoinIndexedVector * x,
00256 const CoinIndexedVector * y,
00257 CoinIndexedVector * z) const = 0;
00259
00260
00261
00262 virtual ClpMatrixBase * clone() const = 0;
00267 virtual ClpMatrixBase * subsetClone (
00268 int numberRows, const int * whichRows,
00269 int numberColumns, const int * whichColumns) const;
00270
00277 inline int type() const
00278 { return type_;};
00280 void setType(int type) {type_=type;};
00282 void useEffectiveRhs(ClpSimplex * model);
00286 virtual double * rhsOffset(ClpSimplex * model,bool forceRefresh=false,
00287 bool check=false);
00289 inline int lastRefresh() const
00290 { return lastRefresh_;};
00292 inline int refreshFrequency() const
00293 { return refreshFrequency_;};
00294 inline void setRefreshFrequency(int value)
00295 { refreshFrequency_=value;};
00297 inline bool skipDualCheck() const
00298 { return skipDualCheck_;};
00299 inline void setSkipDualCheck(bool yes)
00300 { skipDualCheck_=yes;};
00303 inline int minimumObjectsScan() const
00304 { return minimumObjectsScan_;};
00305 inline void setMinimumObjectsScan(int value)
00306 { minimumObjectsScan_=value;};
00308 inline int minimumGoodReducedCosts() const
00309 { return minimumGoodReducedCosts_;};
00310 inline void setMinimumGoodReducedCosts(int value)
00311 { minimumGoodReducedCosts_=value;};
00313 inline double startFraction() const
00314 { return startFraction_;};
00315 inline void setStartFraction(double value)
00316 { startFraction_ = value;};
00318 inline double endFraction() const
00319 { return endFraction_;};
00320 inline void setEndFraction(double value)
00321 { endFraction_ = value;};
00323 inline double savedBestDj() const
00324 { return savedBestDj_;};
00325 inline void setSavedBestDj(double value)
00326 { savedBestDj_ = value;};
00328 inline int originalWanted() const
00329 { return originalWanted_;};
00330 inline void setOriginalWanted(int value)
00331 { originalWanted_ = value;};
00333 inline int currentWanted() const
00334 { return currentWanted_;};
00335 inline void setCurrentWanted(int value)
00336 { currentWanted_ = value;};
00338 inline int savedBestSequence() const
00339 { return savedBestSequence_;};
00340 inline void setSavedBestSequence(int value)
00341 { savedBestSequence_ = value;};
00343
00344
00345 protected:
00346
00352 ClpMatrixBase();
00354 public:
00355 virtual ~ClpMatrixBase();
00356 protected:
00357
00358 ClpMatrixBase(const ClpMatrixBase&);
00359
00360 ClpMatrixBase& operator=(const ClpMatrixBase&);
00362
00363
00364 protected:
00371 double * rhsOffset_;
00373 double startFraction_;
00375 double endFraction_;
00377 double savedBestDj_;
00379 int originalWanted_;
00381 int currentWanted_;
00383 int savedBestSequence_;
00385 int type_;
00387 int lastRefresh_;
00389 int refreshFrequency_;
00391 int minimumObjectsScan_;
00393 int minimumGoodReducedCosts_;
00395 int trueSequenceIn_;
00397 int trueSequenceOut_;
00399 bool skipDualCheck_;
00401 };
00402
00403 #define FREE_BIAS 1.0e1
00404
00405 #define FREE_ACCEPT 1.0e2
00406
00407 #endif