Clp trunk
|
00001 /* $Id$ */ 00002 // Copyright (C) 2004, International Business Machines 00003 // Corporation and others. All Rights Reserved. 00004 // This code is licensed under the terms of the Eclipse Public License (EPL). 00005 00006 #ifndef ClpDynamicExampleMatrix_H 00007 #define ClpDynamicExampleMatrix_H 00008 00009 00010 #include "CoinPragma.hpp" 00011 00012 #include "ClpDynamicMatrix.hpp" 00013 class ClpSimplex; 00033 class ClpDynamicExampleMatrix : public ClpDynamicMatrix { 00034 00035 public: 00038 00039 virtual void partialPricing(ClpSimplex * model, double start, double end, 00040 int & bestSequence, int & numberWanted); 00041 00045 virtual void createVariable(ClpSimplex * model, int & bestSequence); 00050 virtual void packDown(const int * in, int numberToPack); 00052 00053 00054 00058 ClpDynamicExampleMatrix(); 00065 ClpDynamicExampleMatrix(ClpSimplex * model, int numberSets, 00066 int numberColumns, const int * starts, 00067 const double * lower, const double * upper, 00068 const int * startColumn, const int * row, 00069 const double * element, const double * cost, 00070 const double * columnLower = NULL, const double * columnUpper = NULL, 00071 const unsigned char * status = NULL, 00072 const unsigned char * dynamicStatus = NULL, 00073 int numberIds = 0, const int *ids = NULL); 00075 ClpDynamicExampleMatrix(ClpSimplex * model, int numberSets, 00076 int numberColumns, int * starts, 00077 const double * lower, const double * upper, 00078 int * startColumn, int * row, 00079 double * element, double * cost, 00080 double * columnLower = NULL, double * columnUpper = NULL, 00081 const unsigned char * status = NULL, 00082 const unsigned char * dynamicStatus = NULL, 00083 int numberIds = 0, const int *ids = NULL); 00084 00086 virtual ~ClpDynamicExampleMatrix(); 00088 00092 ClpDynamicExampleMatrix(const ClpDynamicExampleMatrix&); 00093 ClpDynamicExampleMatrix& operator=(const ClpDynamicExampleMatrix&); 00095 virtual ClpMatrixBase * clone() const ; 00097 00099 00100 inline CoinBigIndex * startColumnGen() const { 00101 return startColumnGen_; 00102 } 00104 inline int * rowGen() const { 00105 return rowGen_; 00106 } 00108 inline double * elementGen() const { 00109 return elementGen_; 00110 } 00112 inline double * costGen() const { 00113 return costGen_; 00114 } 00116 inline int * fullStartGen() const { 00117 return fullStartGen_; 00118 } 00120 inline int * idGen() const { 00121 return idGen_; 00122 } 00124 inline double * columnLowerGen() const { 00125 return columnLowerGen_; 00126 } 00128 inline double * columnUpperGen() const { 00129 return columnUpperGen_; 00130 } 00132 inline int numberColumns() const { 00133 return numberColumns_; 00134 } 00135 inline void setDynamicStatusGen(int sequence, DynamicStatus status) { 00136 unsigned char & st_byte = dynamicStatusGen_[sequence]; 00137 st_byte = static_cast<unsigned char>(st_byte & ~7); 00138 st_byte = static_cast<unsigned char>(st_byte | status); 00139 } 00140 inline DynamicStatus getDynamicStatusGen(int sequence) const { 00141 return static_cast<DynamicStatus> (dynamicStatusGen_[sequence] & 7); 00142 } 00144 inline bool flaggedGen(int i) const { 00145 return (dynamicStatusGen_[i] & 8) != 0; 00146 } 00147 inline void setFlaggedGen(int i) { 00148 dynamicStatusGen_[i] = static_cast<unsigned char>(dynamicStatusGen_[i] | 8); 00149 } 00150 inline void unsetFlagged(int i) { 00151 dynamicStatusGen_[i] = static_cast<unsigned char>(dynamicStatusGen_[i] & ~8); 00152 } 00154 00155 00156 protected: 00160 00161 int numberColumns_; 00163 CoinBigIndex * startColumnGen_; 00165 int * rowGen_; 00167 double * elementGen_; 00169 double * costGen_; 00171 int * fullStartGen_; 00173 unsigned char * dynamicStatusGen_; 00177 int * idGen_; 00179 double * columnLowerGen_; 00181 double * columnUpperGen_; 00183 }; 00184 00185 #endif