ClpGubDynamicMatrix.hpp
Go to the documentation of this file.
1 /* $Id: ClpGubDynamicMatrix.hpp 1665 2011-01-04 17:55:54Z lou $ */
2 // Copyright (C) 2003, International Business Machines
3 // Corporation and others. All Rights Reserved.
4 // This code is licensed under the terms of the Eclipse Public License (EPL).
5 
6 #ifndef ClpGubDynamicMatrix_H
7 #define ClpGubDynamicMatrix_H
8 
9 
10 #include "CoinPragma.hpp"
11 
12 #include "ClpGubMatrix.hpp"
21 
22 public:
25  virtual void partialPricing(ClpSimplex * model, double start, double end,
27  int & bestSequence, int & numberWanted);
38  virtual int synchronize(ClpSimplex * model, int mode);
40  virtual void useEffectiveRhs(ClpSimplex * model, bool cheapest = true);
44  virtual int updatePivot(ClpSimplex * model, double oldInValue, double oldOutValue);
46  void insertNonBasic(int sequence, int iSet);
50  virtual double * rhsOffset(ClpSimplex * model, bool forceRefresh = false,
51  bool check = false);
52 
57  virtual void times(double scalar,
58  const double * x, double * y) const;
62  virtual int checkFeasible(ClpSimplex * model, double & sum) const;
64  void cleanData(ClpSimplex * model);
66 
67 
68 
74  virtual ~ClpGubDynamicMatrix();
76 
86  int numberColumns, const int * starts,
87  const double * lower, const double * upper,
88  const int * startColumn, const int * row,
89  const double * element, const double * cost,
90  const double * lowerColumn = NULL, const double * upperColumn = NULL,
91  const unsigned char * status = NULL);
92 
95  virtual ClpMatrixBase * clone() const ;
97 
99  enum DynamicStatus {
101  inSmall = 0x01,
102  atUpperBound = 0x02,
104  };
106  inline bool flagged(int i) const {
107  return (dynamicStatus_[i] & 8) != 0;
108  }
109  inline void setFlagged(int i) {
110  dynamicStatus_[i] = static_cast<unsigned char>(dynamicStatus_[i] | 8);
111  }
112  inline void unsetFlagged(int i) {
113  dynamicStatus_[i] = static_cast<unsigned char>(dynamicStatus_[i] & ~8);
114  }
115  inline void setDynamicStatus(int sequence, DynamicStatus status) {
116  unsigned char & st_byte = dynamicStatus_[sequence];
117  st_byte = static_cast<unsigned char>(st_byte & ~7);
118  st_byte = static_cast<unsigned char>(st_byte | status);
119  }
120  inline DynamicStatus getDynamicStatus(int sequence) const {
121  return static_cast<DynamicStatus> (dynamicStatus_[sequence] & 7);
122  }
124  inline double objectiveOffset() const {
125  return objectiveOffset_;
126  }
128  inline CoinBigIndex * startColumn() const {
129  return startColumn_;
130  }
132  inline int * row() const {
133  return row_;
134  }
136  inline double * element() const {
137  return element_;
138  }
140  inline double * cost() const {
141  return cost_;
142  }
144  inline int * fullStart() const {
145  return fullStart_;
146  }
148  inline int * id() const {
149  return id_;
150  }
152  inline double * lowerColumn() const {
153  return lowerColumn_;
154  }
156  inline double * upperColumn() const {
157  return upperColumn_;
158  }
160  inline double * lowerSet() const {
161  return lowerSet_;
162  }
164  inline double * upperSet() const {
165  return upperSet_;
166  }
168  inline int numberGubColumns() const {
169  return numberGubColumns_;
170  }
172  inline int firstAvailable() const {
173  return firstAvailable_;
174  }
176  inline void setFirstAvailable(int value) {
177  firstAvailable_ = value;
178  }
180  inline int firstDynamic() const {
181  return firstDynamic_;
182  }
184  inline int lastDynamic() const {
185  return lastDynamic_;
186  }
188  inline int numberElements() const {
189  return numberElements_;
190  }
192  inline unsigned char * gubRowStatus() const {
193  return status_;
194  }
196  inline unsigned char * dynamicStatus() const {
197  return dynamicStatus_;
198  }
200  int whichSet (int sequence) const;
202 
203 
204 protected:
208  double objectiveOffset_;
213  int * row_;
215  double * element_;
217  double * cost_;
219  int * fullStart_;
221  int * id_;
223  unsigned char * dynamicStatus_;
225  double * lowerColumn_;
227  double * upperColumn_;
229  double * lowerSet_;
231  double * upperSet_;
245 };
246 
247 #endif
double * lowerSet() const
Optional true lower bounds on sets.
int CoinBigIndex
bool flagged(int i) const
Whether flagged.
int whichSet(int sequence) const
Returns which set a variable is in.
double * cost() const
costs
void setDynamicStatus(int sequence, DynamicStatus status)
enums for status of various sorts
virtual void useEffectiveRhs(ClpSimplex *model, bool cheapest=true)
Sets up an effective RHS and does gub crash if needed.
This implements Gub rows plus a ClpPackedMatrix.
int firstAvailable_
first free
double * lowerColumn_
Optional lower bounds on columns.
void unsetFlagged(int i)
enums for status of various sorts
double * element_
elements
int firstDynamic() const
first dynamic
virtual void partialPricing(ClpSimplex *model, double start, double end, int &bestSequence, int &numberWanted)
Partial pricing.
int numberElements_
size of working matrix (max)
ClpGubDynamicMatrix()
Default constructor.
void setFirstAvailable(int value)
set first free
double * upperSet_
Optional true upper bounds on sets.
DynamicStatus getDynamicStatus(int sequence) const
enums for status of various sorts
double * lowerSet_
Optional true lower bounds on sets.
double * upperColumn_
Optional upper bounds on columns.
virtual ~ClpGubDynamicMatrix()
Destructor.
double * upperColumn() const
Optional upper bounds on columns.
virtual void times(double scalar, const double *x, double *y) const
Return y + A * scalar *x in y.
void setFlagged(int i)
enums for status of various sorts
double objectiveOffset_
Saved value of objective offset.
double * lowerColumn() const
Optional lower bounds on columns.
int * end() const
End.
unsigned char * gubRowStatus() const
Status region for gub slacks.
int * start() const
Starts.
CoinBigIndex * startColumn_
Starts of each column.
virtual double * rhsOffset(ClpSimplex *model, bool forceRefresh=false, bool check=false)
Returns effective RHS offset if it is being used.
double * upper() const
Upper bounds on sets.
ClpGubDynamicMatrix & operator=(const ClpGubDynamicMatrix &)
The copy constructor.
int * row() const
rows
CoinBigIndex * startColumn() const
Starts of each column.
int numberSets() const
Number of sets (gub rows)
unsigned char * dynamicStatus() const
Status region for gub variables.
int lastDynamic_
number of columns in dynamic model
int * fullStart() const
full starts
virtual void times(double scalar, const double *x, double *y) const
Return y + A * scalar *x in y.
double objectiveOffset() const
Saved value of objective offset.
virtual int updatePivot(ClpSimplex *model, double oldInValue, double oldOutValue)
update information for a pivot (and effective rhs)
int firstDynamic_
first dynamic
virtual int synchronize(ClpSimplex *model, int mode)
This is local to Gub to allow synchronization: mode=0 when status of basis is good mode=1 when variab...
int savedFirstAvailable_
saved first free
This solves LPs using the simplex method.
Definition: ClpSimplex.hpp:70
unsigned char * status_
Status of slacks.
Abstract base class for Clp Matrices.
DynamicStatus
enums for status of various sorts
int * fullStart_
full starts
int firstAvailable() const
first free
void insertNonBasic(int sequence, int iSet)
Add a new variable to a set.
virtual int checkFeasible(ClpSimplex *model, double &sum) const
Just for debug Returns sum and number of primal infeasibilities.
double * element() const
elements
int numberGubColumns() const
size
virtual ClpMatrixBase * clone() const
Clone.
double * upperSet() const
Optional true upper bounds on sets.
int numberElements() const
size of working matrix (max)
unsigned char * dynamicStatus_
for status and which bound
This implements Gub rows plus a ClpPackedMatrix.
int lastDynamic() const
number of columns in dynamic model
int * id_
ids of active columns (just index here)
double * lower() const
Lower bounds on sets.
int * id() const
ids of active columns (just index here)
void cleanData(ClpSimplex *model)
Cleans data after setWarmStart.