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);
00049
00050 using ClpPackedMatrix::times ;
00054 virtual void times(double scalar,
00055 const double * x, double * y) const;
00059 virtual int checkFeasible(ClpSimplex * model,double & sum) const;
00061 void cleanData(ClpSimplex * model);
00063
00064
00065
00069 ClpGubDynamicMatrix();
00071 virtual ~ClpGubDynamicMatrix();
00073
00077 ClpGubDynamicMatrix(const ClpGubDynamicMatrix&);
00082 ClpGubDynamicMatrix(ClpSimplex * model, int numberSets,
00083 int numberColumns, const int * starts,
00084 const double * lower, const double * upper,
00085 const int * startColumn, const int * row,
00086 const double * element, const double * cost,
00087 const double * lowerColumn=NULL, const double * upperColumn=NULL,
00088 const unsigned char * status=NULL);
00089
00090 ClpGubDynamicMatrix& operator=(const ClpGubDynamicMatrix&);
00092 virtual ClpMatrixBase * clone() const ;
00094
00096
00097 enum DynamicStatus {
00098 inSmall = 0x01,
00099 atUpperBound = 0x02,
00100 atLowerBound = 0x03
00101 };
00103 inline bool flagged(int i) const {
00104 return (dynamicStatus_[i]&8)!=0;
00105 }
00106 inline void setFlagged(int i) {
00107 dynamicStatus_[i] |= 8;
00108 }
00109 inline void unsetFlagged(int i) {
00110 dynamicStatus_[i] &= ~8;;
00111 }
00112 inline void setDynamicStatus(int sequence, DynamicStatus status)
00113 {
00114 unsigned char & st_byte = dynamicStatus_[sequence];
00115 st_byte &= ~7;
00116 st_byte |= status;
00117 }
00118 inline DynamicStatus getDynamicStatus(int sequence) const
00119 {return static_cast<DynamicStatus> (dynamicStatus_[sequence]&7);}
00121 inline double objectiveOffset() const
00122 { return objectiveOffset_;}
00124 inline CoinBigIndex * startColumn() const
00125 { return startColumn_;}
00127 inline int * row() const
00128 { return row_;}
00130 inline double * element() const
00131 { return element_;}
00133 inline double * cost() const
00134 { return cost_;}
00136 inline int * fullStart() const
00137 { return fullStart_;}
00139 inline int * id() const
00140 { return id_;}
00142 inline double * lowerColumn() const
00143 { return lowerColumn_;}
00145 inline double * upperColumn() const
00146 { return upperColumn_;}
00148 inline double * lowerSet() const
00149 { return lowerSet_;}
00151 inline double * upperSet() const
00152 { return upperSet_;}
00154 inline int numberGubColumns() const
00155 { return numberGubColumns_;}
00157 inline int firstAvailable() const
00158 { return firstAvailable_;}
00160 inline void setFirstAvailable(int value)
00161 { firstAvailable_ = value;}
00163 inline int firstDynamic() const
00164 { return firstDynamic_;}
00166 inline int lastDynamic() const
00167 { return lastDynamic_;}
00169 inline int numberElements() const
00170 { return numberElements_;}
00172 inline unsigned char * gubRowStatus() const
00173 { return status_;}
00175 inline unsigned char * dynamicStatus() const
00176 { return dynamicStatus_;}
00178 int whichSet (int sequence) const;
00180
00181
00182 protected:
00186
00187 double objectiveOffset_;
00189 CoinBigIndex * startColumn_;
00191 int * row_;
00193 double * element_;
00195 double * cost_;
00197 int * fullStart_;
00199 int * id_;
00201 unsigned char * dynamicStatus_;
00203 double * lowerColumn_;
00205 double * upperColumn_;
00207 double * lowerSet_;
00209 double * upperSet_;
00211 int numberGubColumns_;
00213 int firstAvailable_;
00215 int savedFirstAvailable_;
00217 int firstDynamic_;
00219 int lastDynamic_;
00221 int numberElements_;
00223 };
00224
00225 #endif