00001
00002
00003 #ifndef ClpGubDynamicMatrix_H
00004 #define ClpGubDynamicMatrix_H
00005
00006
00007 #include "CoinPragma.hpp"
00008
00009 #include "ClpGubMatrix.hpp"
00017 class ClpGubDynamicMatrix : public ClpGubMatrix {
00018
00019 public:
00022
00023 virtual void partialPricing(ClpSimplex * model, double start, double end,
00024 int & bestSequence, int & numberWanted);
00035 virtual int synchronize(ClpSimplex * model,int mode);
00037 virtual void useEffectiveRhs(ClpSimplex * model,bool cheapest=true);
00041 virtual int updatePivot(ClpSimplex * model,double oldInValue, double oldOutValue);
00043 void insertNonBasic(int sequence, int iSet);
00047 virtual double * rhsOffset(ClpSimplex * model,bool forceRefresh=false,
00048 bool check=false);
00052 virtual void times(double scalar,
00053 const double * x, double * y) const;
00057 virtual int checkFeasible(ClpSimplex * model,double & sum) const;
00059 void cleanData(ClpSimplex * model);
00061
00062
00063
00067 ClpGubDynamicMatrix();
00069 virtual ~ClpGubDynamicMatrix();
00071
00075 ClpGubDynamicMatrix(const ClpGubDynamicMatrix&);
00080 ClpGubDynamicMatrix(ClpSimplex * model, int numberSets,
00081 int numberColumns, const int * starts,
00082 const double * lower, const double * upper,
00083 const int * startColumn, const int * row,
00084 const double * element, const double * cost,
00085 const double * lowerColumn=NULL, const double * upperColumn=NULL,
00086 const unsigned char * status=NULL);
00087
00088 ClpGubDynamicMatrix& operator=(const ClpGubDynamicMatrix&);
00090 virtual ClpMatrixBase * clone() const ;
00092
00094
00095 enum DynamicStatus {
00096 inSmall = 0x01,
00097 atUpperBound = 0x02,
00098 atLowerBound = 0x03
00099 };
00101 inline bool flagged(int i) const {
00102 return (dynamicStatus_[i]&8)!=0;
00103 };
00104 inline void setFlagged(int i) {
00105 dynamicStatus_[i] |= 8;
00106 };
00107 inline void unsetFlagged(int i) {
00108 dynamicStatus_[i] &= ~8;;
00109 };
00110 inline void setDynamicStatus(int sequence, DynamicStatus status)
00111 {
00112 unsigned char & st_byte = dynamicStatus_[sequence];
00113 st_byte &= ~7;
00114 st_byte |= status;
00115 };
00116 inline DynamicStatus getDynamicStatus(int sequence) const
00117 {return static_cast<DynamicStatus> (dynamicStatus_[sequence]&7);};
00119 inline double objectiveOffset() const
00120 { return objectiveOffset_;};
00122 inline CoinBigIndex * startColumn() const
00123 { return startColumn_;};
00125 inline int * row() const
00126 { return row_;};
00128 inline float * element() const
00129 { return element_;};
00131 inline float * cost() const
00132 { return cost_;};
00134 inline int * fullStart() const
00135 { return fullStart_;};
00137 inline int * id() const
00138 { return id_;};
00140 inline float * lowerColumn() const
00141 { return lowerColumn_;};
00143 inline float * upperColumn() const
00144 { return upperColumn_;};
00146 inline float * lowerSet() const
00147 { return lowerSet_;};
00149 inline float * upperSet() const
00150 { return upperSet_;};
00152 inline int numberGubColumns() const
00153 { return numberGubColumns_;};
00155 inline int firstAvailable() const
00156 { return firstAvailable_;};
00158 inline void setFirstAvailable(int value)
00159 { firstAvailable_ = value;};
00161 inline int firstDynamic() const
00162 { return firstDynamic_;};
00164 inline int lastDynamic() const
00165 { return lastDynamic_;};
00167 inline int numberElements() const
00168 { return numberElements_;};
00170 inline unsigned char * gubRowStatus() const
00171 { return status_;};
00173 inline unsigned char * dynamicStatus() const
00174 { return dynamicStatus_;};
00176 int whichSet (int sequence) const;
00178
00179
00180 protected:
00184
00185 double objectiveOffset_;
00187 CoinBigIndex * startColumn_;
00189 int * row_;
00191 float * element_;
00193 float * cost_;
00195 int * fullStart_;
00197 int * id_;
00199 unsigned char * dynamicStatus_;
00201 float * lowerColumn_;
00203 float * upperColumn_;
00205 float * lowerSet_;
00207 float * upperSet_;
00209 int numberGubColumns_;
00211 int firstAvailable_;
00213 int savedFirstAvailable_;
00215 int firstDynamic_;
00217 int lastDynamic_;
00219 int numberElements_;
00221 };
00222
00223 #endif