Cbc  2.9.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 * upperColumn() const
Optional upper bounds on columns.
int numberElements_
size of working matrix (max)
virtual void partialPricing(ClpSimplex *model, double start, double end, int &bestSequence, int &numberWanted)
Partial pricing.
This implements Gub rows plus a ClpPackedMatrix.
int numberSets() const
Number of sets (gub rows)
virtual int checkFeasible(ClpSimplex *model, double &sum) const
Just for debug Returns sum and number of primal infeasibilities.
double * upper() const
Upper bounds on sets.
void setDynamicStatus(int sequence, DynamicStatus status)
double * lowerColumn_
Optional lower bounds on columns.
Abstract base class for Clp Matrices.
int * row() const
rows
ClpGubDynamicMatrix & operator=(const ClpGubDynamicMatrix &)
This implements Gub rows plus a ClpPackedMatrix.
unsigned char * status_
Status of slacks.
double * upperSet() const
Optional true upper bounds on sets.
int firstDynamic_
first dynamic
unsigned char * dynamicStatus() const
Status region for gub variables.
int * id_
ids of active columns (just index here)
double * upperSet_
Optional true upper bounds on sets.
int * fullStart() const
full starts
int lastDynamic_
number of columns in dynamic model
double objectiveOffset() const
Saved value of objective offset.
int * end() const
End.
int numberElements() const
size of working matrix (max)
virtual void useEffectiveRhs(ClpSimplex *model, bool cheapest=true)
Sets up an effective RHS and does gub crash if needed.
int * id() const
ids of active columns (just index here)
double * cost() const
costs
virtual void times(double scalar, const double *x, double *y) const
Return y + A * scalar *x in y.
void insertNonBasic(int sequence, int iSet)
Add a new variable to a set.
virtual ClpMatrixBase * clone() const
Clone.
void cleanData(ClpSimplex *model)
Cleans data after setWarmStart.
virtual double * rhsOffset(ClpSimplex *model, bool forceRefresh=false, bool check=false)
Returns effective RHS offset if it is being used.
double * lowerSet() const
Optional true lower bounds on sets.
DynamicStatus
enums for status of various sorts
double * element_
elements
unsigned char * gubRowStatus() const
Status region for gub slacks.
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...
This solves LPs using the simplex method.
Definition: ClpSimplex.hpp:70
double objectiveOffset_
Saved value of objective offset.
int firstDynamic() const
first dynamic
void setFirstAvailable(int value)
set first free
virtual int updatePivot(ClpSimplex *model, double oldInValue, double oldOutValue)
update information for a pivot (and effective rhs)
double * lower() const
Lower bounds on sets.
CoinBigIndex * startColumn_
Starts of each column.
int * fullStart_
full starts
int firstAvailable() const
first free
unsigned char * dynamicStatus_
for status and which bound
int numberGubColumns() const
size
virtual void times(double scalar, const double *x, double *y) const
Return y + A * scalar *x in y.
int * start() const
Starts.
int CoinBigIndex
int savedFirstAvailable_
saved first free
int lastDynamic() const
number of columns in dynamic model
virtual ~ClpGubDynamicMatrix()
Destructor.
ClpGubDynamicMatrix()
Default constructor.
CoinBigIndex * startColumn() const
Starts of each column.
double * lowerColumn() const
Optional lower bounds on columns.
bool flagged(int i) const
Whether flagged.
DynamicStatus getDynamicStatus(int sequence) const
int firstAvailable_
first free
double * upperColumn_
Optional upper bounds on columns.
double * element() const
elements
int whichSet(int sequence) const
Returns which set a variable is in.
double * lowerSet_
Optional true lower bounds on sets.