Clp  1.17.6
ClpGubDynamicMatrix.hpp
Go to the documentation of this file.
1 /* $Id$ */
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 #include "CoinPragma.hpp"
10 
11 #include "ClpGubMatrix.hpp"
20 
21 public:
25  virtual void partialPricing(ClpSimplex *model, double start, double end,
26  int &bestSequence, int &numberWanted);
37  virtual int synchronize(ClpSimplex *model, int mode);
39  virtual void useEffectiveRhs(ClpSimplex *model, bool cheapest = true);
43  virtual int updatePivot(ClpSimplex *model, double oldInValue, double oldOutValue);
45  void insertNonBasic(int sequence, int iSet);
49  virtual double *rhsOffset(ClpSimplex *model, bool forceRefresh = false,
50  bool check = false);
51 
56  virtual void times(double scalar,
57  const double *x, double *y) const;
61  virtual int checkFeasible(ClpSimplex *model, double &sum) const;
63  void cleanData(ClpSimplex *model);
65 
73 
83  int numberColumns, const int *starts,
84  const double *lower, const double *upper,
85  const CoinBigIndex *startColumn, const int *row,
86  const double *element, const double *cost,
87  const double *lowerColumn = NULL, const double *upperColumn = NULL,
88  const unsigned char *status = NULL);
89 
92  virtual ClpMatrixBase *clone() const;
94 
98  inSmall = 0x01,
99  atUpperBound = 0x02,
100  atLowerBound = 0x03
101  };
103  inline bool flagged(int i) const
104  {
105  return (dynamicStatus_[i] & 8) != 0;
106  }
107  inline void setFlagged(int i)
108  {
109  dynamicStatus_[i] = static_cast< unsigned char >(dynamicStatus_[i] | 8);
110  }
111  inline void unsetFlagged(int i)
112  {
113  dynamicStatus_[i] = static_cast< unsigned char >(dynamicStatus_[i] & ~8);
114  }
115  inline void setDynamicStatus(int sequence, DynamicStatus status)
116  {
117  unsigned char &st_byte = dynamicStatus_[sequence];
118  st_byte = static_cast< unsigned char >(st_byte & ~7);
119  st_byte = static_cast< unsigned char >(st_byte | status);
120  }
121  inline DynamicStatus getDynamicStatus(int sequence) const
122  {
123  return static_cast< DynamicStatus >(dynamicStatus_[sequence] & 7);
124  }
126  inline double objectiveOffset() const
127  {
128  return objectiveOffset_;
129  }
131  inline CoinBigIndex *startColumn() const
132  {
133  return startColumn_;
134  }
136  inline int *row() const
137  {
138  return row_;
139  }
141  inline double *element() const
142  {
143  return element_;
144  }
146  inline double *cost() const
147  {
148  return cost_;
149  }
151  inline int *fullStart() const
152  {
153  return fullStart_;
154  }
156  inline int *id() const
157  {
158  return id_;
159  }
161  inline double *lowerColumn() const
162  {
163  return lowerColumn_;
164  }
166  inline double *upperColumn() const
167  {
168  return upperColumn_;
169  }
171  inline double *lowerSet() const
172  {
173  return lowerSet_;
174  }
176  inline double *upperSet() const
177  {
178  return upperSet_;
179  }
181  inline int numberGubColumns() const
182  {
183  return numberGubColumns_;
184  }
186  inline int firstAvailable() const
187  {
188  return firstAvailable_;
189  }
191  inline void setFirstAvailable(int value)
192  {
193  firstAvailable_ = value;
194  }
196  inline int firstDynamic() const
197  {
198  return firstDynamic_;
199  }
201  inline int lastDynamic() const
202  {
203  return lastDynamic_;
204  }
206  inline CoinBigIndex numberElements() const
207  {
208  return numberElements_;
209  }
211  inline unsigned char *gubRowStatus() const
212  {
213  return status_;
214  }
216  inline unsigned char *dynamicStatus() const
217  {
218  return dynamicStatus_;
219  }
221  int whichSet(int sequence) const;
223 
224 protected:
231  CoinBigIndex *startColumn_;
233  int *row_;
235  double *element_;
237  double *cost_;
241  int *id_;
243  unsigned char *dynamicStatus_;
245  double *lowerColumn_;
247  double *upperColumn_;
249  double *lowerSet_;
251  double *upperSet_;
263  CoinBigIndex numberElements_;
265 };
266 
267 #endif
268 
269 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
270 */
This implements Gub rows plus a ClpPackedMatrix.
double * element() const
elements
virtual int checkFeasible(ClpSimplex *model, double &sum) const
Just for debug Returns sum and number of primal infeasibilities.
double objectiveOffset() const
Saved value of objective offset.
virtual void useEffectiveRhs(ClpSimplex *model, bool cheapest=true)
Sets up an effective RHS and does gub crash if needed.
int * fullStart_
full starts
virtual ClpMatrixBase * clone() const
Clone.
double objectiveOffset_
Saved value of objective offset.
CoinBigIndex * startColumn() const
Starts of each column.
ClpGubDynamicMatrix()
Default constructor.
bool flagged(int i) const
Whether flagged.
double * upperSet() const
Optional true upper bounds on sets.
double * upperColumn() const
Optional upper bounds on columns.
unsigned char * dynamicStatus_
for status and which bound
CoinBigIndex numberElements_
size of working matrix (max)
virtual void partialPricing(ClpSimplex *model, double start, double end, int &bestSequence, int &numberWanted)
Partial pricing.
int firstDynamic_
first dynamic
double * lowerColumn_
Optional lower bounds on columns.
CoinBigIndex * startColumn_
Starts of each column.
unsigned char * dynamicStatus() const
Status region for gub variables.
double * cost() const
costs
int * id() const
ids of active columns (just index here)
double * upperSet_
Optional true upper bounds on sets.
int lastDynamic_
number of columns in dynamic model
int * fullStart() const
full starts
ClpGubDynamicMatrix(const ClpGubDynamicMatrix &)
The copy constructor.
void insertNonBasic(int sequence, int iSet)
Add a new variable to a set.
void cleanData(ClpSimplex *model)
Cleans data after setWarmStart.
void setDynamicStatus(int sequence, DynamicStatus status)
void setFirstAvailable(int value)
set first free
int lastDynamic() const
number of columns in dynamic model
int whichSet(int sequence) const
Returns which set a variable is in.
DynamicStatus
enums for status of various sorts
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...
virtual void times(double scalar, const double *x, double *y) const
Return y + A * scalar *x in y.
ClpGubDynamicMatrix & operator=(const ClpGubDynamicMatrix &)
int firstDynamic() const
first dynamic
int firstAvailable() const
first free
int * id_
ids of active columns (just index here)
DynamicStatus getDynamicStatus(int sequence) const
ClpGubDynamicMatrix(ClpSimplex *model, int numberSets, int numberColumns, const int *starts, const double *lower, const double *upper, const CoinBigIndex *startColumn, const int *row, const double *element, const double *cost, const double *lowerColumn=NULL, const double *upperColumn=NULL, const unsigned char *status=NULL)
This is the real constructor.
virtual int updatePivot(ClpSimplex *model, double oldInValue, double oldOutValue)
update information for a pivot (and effective rhs)
int savedFirstAvailable_
saved first free
double * upperColumn_
Optional upper bounds on columns.
unsigned char * gubRowStatus() const
Status region for gub slacks.
CoinBigIndex numberElements() const
size of working matrix (max)
virtual ~ClpGubDynamicMatrix()
Destructor.
int numberGubColumns() const
size
double * lowerColumn() const
Optional lower bounds on columns.
double * lowerSet() const
Optional true lower bounds on sets.
virtual double * rhsOffset(ClpSimplex *model, bool forceRefresh=false, bool check=false)
Returns effective RHS offset if it is being used.
double * lowerSet_
Optional true lower bounds on sets.
This implements Gub rows plus a ClpPackedMatrix.
int * start() const
Starts.
double * lower() const
Lower bounds on sets.
unsigned char * status_
Status of slacks.
double * upper() const
Upper bounds on sets.
int numberSets() const
Number of sets (gub rows)
int * end() const
End.
Abstract base class for Clp Matrices.
virtual void times(double scalar, const double *x, double *y) const
Return y + A * scalar *x in y.
This solves LPs using the simplex method.
Definition: ClpSimplex.hpp:106