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:
00021 virtual void partialPricing(ClpSimplex * model, double start, double end,
00022 int & bestSequence, int & numberWanted);
00033 virtual int synchronize(ClpSimplex * model,int mode);
00035 virtual void useEffectiveRhs(ClpSimplex * model,bool cheapest=true);
00039 virtual int updatePivot(ClpSimplex * model,double oldInValue, double oldOutValue);
00041 void insertNonBasic(int sequence, int iSet);
00045 virtual double * rhsOffset(ClpSimplex * model,bool forceRefresh=false,
00046 bool check=false);
00050 virtual void times(double scalar,
00051 const double * x, double * y) const;
00055 virtual int checkFeasible(ClpSimplex * model) const;
00057
00058
00059
00063 ClpGubDynamicMatrix();
00065 virtual ~ClpGubDynamicMatrix();
00067
00071 ClpGubDynamicMatrix(const ClpGubDynamicMatrix&);
00076 ClpGubDynamicMatrix(ClpSimplex * model, int numberSets,
00077 int numberColumns, const int * starts,
00078 const double * lower, const double * upper,
00079 const int * startColumn, const int * row,
00080 const double * element, const double * cost,
00081 const double * lowerColumn=NULL, const double * upperColumn=NULL,
00082 const unsigned char * status=NULL);
00083
00084 ClpGubDynamicMatrix& operator=(const ClpGubDynamicMatrix&);
00086 virtual ClpMatrixBase * clone() const ;
00088
00090
00091 enum DynamicStatus {
00092 inSmall = 0x01,
00093 atUpperBound = 0x02,
00094 atLowerBound = 0x03,
00095 };
00097 inline bool flagged(int i) const {
00098 return (dynamicStatus_[i]&8)!=0;
00099 };
00100 inline void setFlagged(int i) {
00101 dynamicStatus_[i] |= 8;
00102 };
00103 inline void unsetFlagged(int i) {
00104 dynamicStatus_[i] &= ~8;;
00105 };
00106 inline void setDynamicStatus(int sequence, DynamicStatus status)
00107 {
00108 unsigned char & st_byte = dynamicStatus_[sequence];
00109 st_byte &= ~7;
00110 st_byte |= status;
00111 };
00112 inline DynamicStatus getDynamicStatus(int sequence) const
00113 {return static_cast<DynamicStatus> (dynamicStatus_[sequence]&7);};
00115 inline double objectiveOffset() const
00116 { return objectiveOffset_;};
00118 inline CoinBigIndex * startColumn() const
00119 { return startColumn_;};
00121 inline int * row() const
00122 { return row_;};
00124 inline float * element() const
00125 { return element_;};
00127 inline float * cost() const
00128 { return cost_;};
00130 inline int * fullStart() const
00131 { return fullStart_;};
00133 inline int * id() const
00134 { return id_;};
00136 inline float * lowerColumn() const
00137 { return lowerColumn_;};
00139 inline float * upperColumn() const
00140 { return upperColumn_;};
00142 inline float * lowerSet() const
00143 { return lowerSet_;};
00145 inline float * upperSet() const
00146 { return upperSet_;};
00148 inline int numberGubColumns() const
00149 { return numberGubColumns_;};
00151 inline int firstAvailable() const
00152 { return firstAvailable_;};
00154 inline int firstDynamic() const
00155 { return firstDynamic_;};
00157 inline int lastDynamic() const
00158 { return lastDynamic_;};
00160 inline int numberElements() const
00161 { return numberElements_;};
00163 inline unsigned char * gubRowStatus() const
00164 { return status_;};
00166 inline unsigned char * dynamicStatus() const
00167 { return dynamicStatus_;};
00169 int whichSet (int sequence) const;
00171
00172
00173 protected:
00177
00178 double objectiveOffset_;
00180 CoinBigIndex * startColumn_;
00182 int * row_;
00184 float * element_;
00186 float * cost_;
00188 int * fullStart_;
00190 int * id_;
00192 unsigned char * dynamicStatus_;
00194 float * lowerColumn_;
00196 float * upperColumn_;
00198 float * lowerSet_;
00200 float * upperSet_;
00202 int numberGubColumns_;
00204 int firstAvailable_;
00206 int savedFirstAvailable_;
00208 int firstDynamic_;
00210 int lastDynamic_;
00212 int numberElements_;
00214 };
00215
00216 #endif