ClpGubDynamicMatrix.hpp
Go to the documentation of this file.
1 /* $Id: ClpGubDynamicMatrix.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 ClpGubDynamicMatrix_H
5 #define ClpGubDynamicMatrix_H
6 
7 
8 #include "CoinPragma.hpp"
9 
10 #include "ClpGubMatrix.hpp"
19 
20 public:
23  virtual void partialPricing(ClpSimplex * model, double start, double end,
25  int & bestSequence, int & numberWanted);
36  virtual int synchronize(ClpSimplex * model, int mode);
38  virtual void useEffectiveRhs(ClpSimplex * model, bool cheapest = true);
42  virtual int updatePivot(ClpSimplex * model, double oldInValue, double oldOutValue);
44  void insertNonBasic(int sequence, int iSet);
48  virtual double * rhsOffset(ClpSimplex * model, bool forceRefresh = false,
49  bool check = false);
50 
55  virtual void times(double scalar,
56  const double * x, double * y) const;
60  virtual int checkFeasible(ClpSimplex * model, double & sum) const;
62  void cleanData(ClpSimplex * model);
64 
65 
66 
72  virtual ~ClpGubDynamicMatrix();
74 
84  int numberColumns, const int * starts,
85  const double * lower, const double * upper,
86  const int * startColumn, const int * row,
87  const double * element, const double * cost,
88  const double * lowerColumn = NULL, const double * upperColumn = NULL,
89  const unsigned char * status = NULL);
90 
93  virtual ClpMatrixBase * clone() const ;
95 
97  enum DynamicStatus {
99  inSmall = 0x01,
100  atUpperBound = 0x02,
102  };
104  inline bool flagged(int i) const {
105  return (dynamicStatus_[i] & 8) != 0;
106  }
107  inline void setFlagged(int i) {
108  dynamicStatus_[i] = static_cast<unsigned char>(dynamicStatus_[i] | 8);
109  }
110  inline void unsetFlagged(int i) {
111  dynamicStatus_[i] = static_cast<unsigned char>(dynamicStatus_[i] & ~8);
112  }
113  inline void setDynamicStatus(int sequence, DynamicStatus status) {
114  unsigned char & st_byte = dynamicStatus_[sequence];
115  st_byte = static_cast<unsigned char>(st_byte & ~7);
116  st_byte = static_cast<unsigned char>(st_byte | status);
117  }
118  inline DynamicStatus getDynamicStatus(int sequence) const {
119  return static_cast<DynamicStatus> (dynamicStatus_[sequence] & 7);
120  }
122  inline double objectiveOffset() const {
123  return objectiveOffset_;
124  }
126  inline CoinBigIndex * startColumn() const {
127  return startColumn_;
128  }
130  inline int * row() const {
131  return row_;
132  }
134  inline double * element() const {
135  return element_;
136  }
138  inline double * cost() const {
139  return cost_;
140  }
142  inline int * fullStart() const {
143  return fullStart_;
144  }
146  inline int * id() const {
147  return id_;
148  }
150  inline double * lowerColumn() const {
151  return lowerColumn_;
152  }
154  inline double * upperColumn() const {
155  return upperColumn_;
156  }
158  inline double * lowerSet() const {
159  return lowerSet_;
160  }
162  inline double * upperSet() const {
163  return upperSet_;
164  }
166  inline int numberGubColumns() const {
167  return numberGubColumns_;
168  }
170  inline int firstAvailable() const {
171  return firstAvailable_;
172  }
174  inline void setFirstAvailable(int value) {
175  firstAvailable_ = value;
176  }
178  inline int firstDynamic() const {
179  return firstDynamic_;
180  }
182  inline int lastDynamic() const {
183  return lastDynamic_;
184  }
186  inline int numberElements() const {
187  return numberElements_;
188  }
190  inline unsigned char * gubRowStatus() const {
191  return status_;
192  }
194  inline unsigned char * dynamicStatus() const {
195  return dynamicStatus_;
196  }
198  int whichSet (int sequence) const;
200 
201 
202 protected:
206  double objectiveOffset_;
209  CoinBigIndex * startColumn_;
211  int * row_;
213  double * element_;
215  double * cost_;
217  int * fullStart_;
219  int * id_;
221  unsigned char * dynamicStatus_;
223  double * lowerColumn_;
225  double * upperColumn_;
227  double * lowerSet_;
229  double * upperSet_;
243 };
244 
245 #endif
double * lowerSet() const
Optional true lower bounds on sets.
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:49
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.