ClpGubMatrix.hpp
Go to the documentation of this file.
1 /* $Id: ClpGubMatrix.hpp 1525 2010-02-26 17:27:59Z mjs $ */
2 // Copyright (C) 2003, International Business Machines
3 // Corporation and others. All Rights Reserved.
4 #ifndef ClpGubMatrix_H
5 #define ClpGubMatrix_H
6 
7 
8 #include "CoinPragma.hpp"
9 
10 #include "ClpPackedMatrix.hpp"
11 class ClpSimplex;
20 class ClpGubMatrix : public ClpPackedMatrix {
21 
22 public:
26  virtual ClpMatrixBase * reverseOrderedCopy() const;
28  virtual CoinBigIndex countBasis(const int * whichColumn,
29  int & numberColumnBasic);
31  virtual void fillBasis(ClpSimplex * model,
32  const int * whichColumn,
33  int & numberColumnBasic,
34  int * row, int * start,
35  int * rowCount, int * columnCount,
36  CoinFactorizationDouble * element);
39  virtual void unpack(const ClpSimplex * model, CoinIndexedVector * rowArray,
40  int column) const ;
45  virtual void unpackPacked(ClpSimplex * model,
46  CoinIndexedVector * rowArray,
47  int column) const;
50  virtual void add(const ClpSimplex * model, CoinIndexedVector * rowArray,
51  int column, double multiplier) const ;
53  virtual void add(const ClpSimplex * model, double * array,
54  int column, double multiplier) const;
56  virtual void partialPricing(ClpSimplex * model, double start, double end,
57  int & bestSequence, int & numberWanted);
59  virtual int hiddenRows() const;
61 
64 
70  virtual void transposeTimes(const ClpSimplex * model, double scalar,
71  const CoinIndexedVector * x,
72  CoinIndexedVector * y,
73  CoinIndexedVector * z) const;
79  virtual void transposeTimesByRow(const ClpSimplex * model, double scalar,
80  const CoinIndexedVector * x,
81  CoinIndexedVector * y,
82  CoinIndexedVector * z) const;
86  virtual void subsetTransposeTimes(const ClpSimplex * model,
87  const CoinIndexedVector * x,
88  const CoinIndexedVector * y,
89  CoinIndexedVector * z) const;
96  virtual int extendUpdated(ClpSimplex * model, CoinIndexedVector * update, int mode);
102  virtual void primalExpanded(ClpSimplex * model, int mode);
111  virtual void dualExpanded(ClpSimplex * model, CoinIndexedVector * array,
112  double * other, int mode);
130  virtual int generalExpanded(ClpSimplex * model, int mode, int & number);
134  virtual int updatePivot(ClpSimplex * model, double oldInValue, double oldOutValue);
136  virtual void useEffectiveRhs(ClpSimplex * model, bool cheapest = true);
140  virtual double * rhsOffset(ClpSimplex * model, bool forceRefresh = false,
141  bool check = false);
154  virtual int synchronize(ClpSimplex * model, int mode);
156  virtual void correctSequence(const ClpSimplex * model, int & sequenceIn, int & sequenceOut) ;
158 
159 
160 
164  ClpGubMatrix();
166  virtual ~ClpGubMatrix();
168 
172  ClpGubMatrix(const ClpGubMatrix&);
174  ClpGubMatrix(const CoinPackedMatrix&);
177  ClpGubMatrix (const ClpGubMatrix & wholeModel,
178  int numberRows, const int * whichRows,
179  int numberColumns, const int * whichColumns);
180  ClpGubMatrix (const CoinPackedMatrix & wholeModel,
181  int numberRows, const int * whichRows,
182  int numberColumns, const int * whichColumns);
183 
185  ClpGubMatrix(CoinPackedMatrix * matrix);
186 
190  const int * start, const int * end,
191  const double * lower, const double * upper,
192  const unsigned char * status = NULL);
193 
196  virtual ClpMatrixBase * clone() const ;
199  virtual ClpMatrixBase * subsetClone (
200  int numberRows, const int * whichRows,
201  int numberColumns, const int * whichColumns) const ;
203  void redoSet(ClpSimplex * model, int newKey, int oldKey, int iSet);
205 
207 
208  inline ClpSimplex::Status getStatus(int sequence) const {
209  return static_cast<ClpSimplex::Status> (status_[sequence] & 7);
210  }
211  inline void setStatus(int sequence, ClpSimplex::Status status) {
212  unsigned char & st_byte = status_[sequence];
213  st_byte = static_cast<unsigned char>(st_byte & ~7);
214  st_byte = static_cast<unsigned char>(st_byte | status);
215  }
217  inline void setFlagged( int sequence) {
218  status_[sequence] = static_cast<unsigned char>(status_[sequence] | 64);
219  }
220  inline void clearFlagged( int sequence) {
221  status_[sequence] = static_cast<unsigned char>(status_[sequence] & ~64);
222  }
223  inline bool flagged(int sequence) const {
224  return ((status_[sequence] & 64) != 0);
225  }
227  inline void setAbove( int sequence) {
228  unsigned char iStat = status_[sequence];
229  iStat = static_cast<unsigned char>(iStat & ~24);
230  status_[sequence] = static_cast<unsigned char>(iStat | 16);
231  }
233  inline void setFeasible( int sequence) {
234  unsigned char iStat = status_[sequence];
235  iStat = static_cast<unsigned char>(iStat & ~24);
236  status_[sequence] = static_cast<unsigned char>(iStat | 8);
237  }
239  inline void setBelow( int sequence) {
240  unsigned char iStat = status_[sequence];
241  iStat = static_cast<unsigned char>(iStat & ~24);
242  status_[sequence] = iStat;
243  }
244  inline double weight( int sequence) const {
245  int iStat = status_[sequence] & 31;
246  iStat = iStat >> 3;
247  return static_cast<double> (iStat - 1);
248  }
250  inline int * start() const {
251  return start_;
252  }
254  inline int * end() const {
255  return end_;
256  }
258  inline double * lower() const {
259  return lower_;
260  }
262  inline double * upper() const {
263  return upper_;
264  }
266  inline int * keyVariable() const {
267  return keyVariable_;
268  }
270  inline int * backward() const {
271  return backward_;
272  }
274  inline int numberSets() const {
275  return numberSets_;
276  }
278  void switchOffCheck();
280 
281 
282 protected:
286 
297  int * start_;
299  int * end_;
301  double * lower_;
303  double * upper_;
305  mutable unsigned char * status_;
307  unsigned char * saveStatus_;
311  int * backward_;
315  double * changeCost_;
317  mutable int * keyVariable_;
321  mutable int * next_;
323  int * toIndex_;
324  // Reverse pointer from index to set
325  int * fromIndex_;
337  int noCheck_;
349  int lastGub_;
352  int gubType_;
354 };
355 
356 #endif