ClpDynamicMatrix.hpp
Go to the documentation of this file.
1 /* $Id: ClpDynamicMatrix.hpp 1525 2010-02-26 17:27:59Z mjs $ */
2 // Copyright (C) 2004, International Business Machines
3 // Corporation and others. All Rights Reserved.
4 #ifndef ClpDynamicMatrix_H
5 #define ClpDynamicMatrix_H
6 
7 
8 #include "CoinPragma.hpp"
9 
10 #include "ClpPackedMatrix.hpp"
11 class ClpSimplex;
19 
20 public:
23  soloKey = 0x00,
24  inSmall = 0x01,
25  atUpperBound = 0x02,
26  atLowerBound = 0x03
27  };
30 
31  virtual void partialPricing(ClpSimplex * model, double start, double end,
32  int & bestSequence, int & numberWanted);
33 
37  virtual int updatePivot(ClpSimplex * model, double oldInValue, double oldOutValue);
41  virtual double * rhsOffset(ClpSimplex * model, bool forceRefresh = false,
42  bool check = false);
43 
48  virtual void times(double scalar,
49  const double * x, double * y) const;
51  void modifyOffset(int sequence, double amount);
53  double keyValue(int iSet) const;
62  virtual void dualExpanded(ClpSimplex * model, CoinIndexedVector * array,
63  double * other, int mode);
81  virtual int generalExpanded(ClpSimplex * model, int mode, int & number);
86  virtual int refresh(ClpSimplex * model);
90  virtual void createVariable(ClpSimplex * model, int & bestSequence);
92  virtual double reducedCost( ClpSimplex * model, int sequence) const;
94  void gubCrash();
96  void initialProblem();
98  int addColumn(int numberEntries, const int * row, const double * element,
99  double cost, double lower, double upper, int iSet,
100  DynamicStatus status);
105  virtual void packDown(const int * , int ) {}
107  inline double columnLower(int sequence) const {
108  if (columnLower_) return columnLower_[sequence];
109  else return 0.0;
110  }
112  inline double columnUpper(int sequence) const {
113  if (columnUpper_) return columnUpper_[sequence];
114  else return COIN_DBL_MAX;
115  }
116 
118 
119 
120 
132  int numberColumns, const int * starts,
133  const double * lower, const double * upper,
134  const int * startColumn, const int * row,
135  const double * element, const double * cost,
136  const double * columnLower = NULL, const double * columnUpper = NULL,
137  const unsigned char * status = NULL,
138  const unsigned char * dynamicStatus = NULL);
139 
141  virtual ~ClpDynamicMatrix();
143 
149  ClpDynamicMatrix(const CoinPackedMatrix&);
150 
153  virtual ClpMatrixBase * clone() const ;
155 
157 
158  inline ClpSimplex::Status getStatus(int sequence) const {
159  return static_cast<ClpSimplex::Status> (status_[sequence] & 7);
160  }
161  inline void setStatus(int sequence, ClpSimplex::Status status) {
162  unsigned char & st_byte = status_[sequence];
163  st_byte = static_cast<unsigned char>(st_byte & ~7);
164  st_byte = static_cast<unsigned char>(st_byte | status);
165  }
167  inline int numberSets() const {
168  return numberSets_;
169  }
171  inline bool flagged(int i) const {
172  return (dynamicStatus_[i] & 8) != 0;
173  }
174  inline void setFlagged(int i) {
175  dynamicStatus_[i] = static_cast<unsigned char>(dynamicStatus_[i] | 8);
176  }
177  inline void unsetFlagged(int i) {
178  dynamicStatus_[i] = static_cast<unsigned char>(dynamicStatus_[i] & ~8);
179  }
180  inline void setDynamicStatus(int sequence, DynamicStatus status) {
181  unsigned char & st_byte = dynamicStatus_[sequence];
182  st_byte = static_cast<unsigned char>(st_byte & ~7);
183  st_byte = static_cast<unsigned char>(st_byte | status);
184  }
185  inline DynamicStatus getDynamicStatus(int sequence) const {
186  return static_cast<DynamicStatus> (dynamicStatus_[sequence] & 7);
187  }
189  inline double objectiveOffset() const {
190  return objectiveOffset_;
191  }
193  inline CoinBigIndex * startColumn() const {
194  return startColumn_;
195  }
197  inline int * row() const {
198  return row_;
199  }
201  inline double * element() const {
202  return element_;
203  }
205  inline double * cost() const {
206  return cost_;
207  }
209  inline int * id() const {
210  return id_;
211  }
213  inline double * columnLower() const {
214  return columnLower_;
215  }
217  inline double * columnUpper() const {
218  return columnUpper_;
219  }
221  inline double * lowerSet() const {
222  return lowerSet_;
223  }
225  inline double * upperSet() const {
226  return upperSet_;
227  }
229  inline int numberGubColumns() const {
230  return numberGubColumns_;
231  }
233  inline int firstAvailable() const {
234  return firstAvailable_;
235  }
237  inline int firstDynamic() const {
238  return firstDynamic_;
239  }
241  inline int lastDynamic() const {
242  return lastDynamic_;
243  }
245  inline int numberStaticRows() const {
246  return numberStaticRows_;
247  }
249  inline int numberElements() const {
250  return numberElements_;
251  }
252  inline int * keyVariable() const {
253  return keyVariable_;
254  }
256  void switchOffCheck();
258  inline unsigned char * gubRowStatus() const {
259  return status_;
260  }
262  inline unsigned char * dynamicStatus() const {
263  return dynamicStatus_;
264  }
266  int whichSet (int sequence) const;
268 
269 
270 protected:
274 
289  mutable int * keyVariable_;
291  int * toIndex_;
292  // Reverse pointer from index to set
293  int * fromIndex_;
301  double * lowerSet_;
303  double * upperSet_;
305  unsigned char * status_;
329  int noCheck_;
339  int * startSet_;
341  int * next_;
343  CoinBigIndex * startColumn_;
345  int * row_;
347  double * element_;
349  double * cost_;
351  int * id_;
353  unsigned char * dynamicStatus_;
355  double * columnLower_;
357  double * columnUpper_;
359 };
360 
361 #endif