Clp  1.17.8
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:
24  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 
71  virtual ~ClpGubDynamicMatrix();
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 
96  enum DynamicStatus {
98  inSmall = 0x01,
99  atUpperBound = 0x02,
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:
228  double objectiveOffset_;
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 */
ClpSimplex
This solves LPs using the simplex method.
Definition: ClpSimplex.hpp:106
ClpGubMatrix::status_
unsigned char * status_
Status of slacks.
Definition: ClpGubMatrix.hpp:319
ClpGubDynamicMatrix::inSmall
@ inSmall
Definition: ClpGubDynamicMatrix.hpp:98
ClpGubDynamicMatrix::fullStart
int * fullStart() const
full starts
Definition: ClpGubDynamicMatrix.hpp:151
ClpGubDynamicMatrix::operator=
ClpGubDynamicMatrix & operator=(const ClpGubDynamicMatrix &)
ClpGubDynamicMatrix::clone
virtual ClpMatrixBase * clone() const
Clone.
ClpGubDynamicMatrix::cost_
double * cost_
costs
Definition: ClpGubDynamicMatrix.hpp:237
ClpGubDynamicMatrix::setDynamicStatus
void setDynamicStatus(int sequence, DynamicStatus status)
Definition: ClpGubDynamicMatrix.hpp:115
ClpGubDynamicMatrix::dynamicStatus_
unsigned char * dynamicStatus_
for status and which bound
Definition: ClpGubDynamicMatrix.hpp:243
ClpGubDynamicMatrix::setFlagged
void setFlagged(int i)
Definition: ClpGubDynamicMatrix.hpp:107
ClpGubDynamicMatrix::firstDynamic_
int firstDynamic_
first dynamic
Definition: ClpGubDynamicMatrix.hpp:259
ClpGubDynamicMatrix::ClpGubDynamicMatrix
ClpGubDynamicMatrix()
Default constructor.
ClpGubDynamicMatrix::upperSet
double * upperSet() const
Optional true upper bounds on sets.
Definition: ClpGubDynamicMatrix.hpp:176
ClpGubDynamicMatrix::objectiveOffset
double objectiveOffset() const
Saved value of objective offset.
Definition: ClpGubDynamicMatrix.hpp:126
ClpGubDynamicMatrix::numberElements_
CoinBigIndex numberElements_
size of working matrix (max)
Definition: ClpGubDynamicMatrix.hpp:263
ClpGubDynamicMatrix::gubRowStatus
unsigned char * gubRowStatus() const
Status region for gub slacks.
Definition: ClpGubDynamicMatrix.hpp:211
ClpGubDynamicMatrix::firstDynamic
int firstDynamic() const
first dynamic
Definition: ClpGubDynamicMatrix.hpp:196
ClpGubMatrix
This implements Gub rows plus a ClpPackedMatrix.
Definition: ClpGubMatrix.hpp:21
ClpGubDynamicMatrix::lowerSet
double * lowerSet() const
Optional true lower bounds on sets.
Definition: ClpGubDynamicMatrix.hpp:171
ClpGubDynamicMatrix::row_
int * row_
rows
Definition: ClpGubDynamicMatrix.hpp:233
ClpGubDynamicMatrix::upperColumn
double * upperColumn() const
Optional upper bounds on columns.
Definition: ClpGubDynamicMatrix.hpp:166
ClpGubDynamicMatrix::savedFirstAvailable_
int savedFirstAvailable_
saved first free
Definition: ClpGubDynamicMatrix.hpp:257
ClpGubDynamicMatrix::upperSet_
double * upperSet_
Optional true upper bounds on sets.
Definition: ClpGubDynamicMatrix.hpp:251
ClpGubDynamicMatrix::startColumn_
CoinBigIndex * startColumn_
Starts of each column.
Definition: ClpGubDynamicMatrix.hpp:231
ClpGubDynamicMatrix::setFirstAvailable
void setFirstAvailable(int value)
set first free
Definition: ClpGubDynamicMatrix.hpp:191
ClpPackedMatrix::times
virtual void times(double scalar, const double *x, double *y) const
Return y + A * scalar *x in y.
ClpGubMatrix::start
int * start() const
Starts.
Definition: ClpGubMatrix.hpp:258
ClpGubMatrix::lower
double * lower() const
Lower bounds on sets.
Definition: ClpGubMatrix.hpp:268
ClpGubDynamicMatrix::lowerSet_
double * lowerSet_
Optional true lower bounds on sets.
Definition: ClpGubDynamicMatrix.hpp:249
ClpGubDynamicMatrix::lowerColumn_
double * lowerColumn_
Optional lower bounds on columns.
Definition: ClpGubDynamicMatrix.hpp:245
ClpGubMatrix.hpp
ClpGubDynamicMatrix::useEffectiveRhs
virtual void useEffectiveRhs(ClpSimplex *model, bool cheapest=true)
Sets up an effective RHS and does gub crash if needed.
ClpGubDynamicMatrix::flagged
bool flagged(int i) const
Whether flagged.
Definition: ClpGubDynamicMatrix.hpp:103
ClpGubDynamicMatrix::DynamicStatus
DynamicStatus
enums for status of various sorts
Definition: ClpGubDynamicMatrix.hpp:97
ClpGubDynamicMatrix::element_
double * element_
elements
Definition: ClpGubDynamicMatrix.hpp:235
ClpGubDynamicMatrix::id_
int * id_
ids of active columns (just index here)
Definition: ClpGubDynamicMatrix.hpp:241
ClpGubDynamicMatrix::checkFeasible
virtual int checkFeasible(ClpSimplex *model, double &sum) const
Just for debug Returns sum and number of primal infeasibilities.
ClpGubDynamicMatrix::id
int * id() const
ids of active columns (just index here)
Definition: ClpGubDynamicMatrix.hpp:156
ClpGubDynamicMatrix::cleanData
void cleanData(ClpSimplex *model)
Cleans data after setWarmStart.
ClpGubDynamicMatrix::partialPricing
virtual void partialPricing(ClpSimplex *model, double start, double end, int &bestSequence, int &numberWanted)
Partial pricing.
ClpGubDynamicMatrix::cost
double * cost() const
costs
Definition: ClpGubDynamicMatrix.hpp:146
ClpMatrixBase
Abstract base class for Clp Matrices.
Definition: ClpMatrixBase.hpp:38
ClpGubDynamicMatrix::fullStart_
int * fullStart_
full starts
Definition: ClpGubDynamicMatrix.hpp:239
ClpGubDynamicMatrix::numberGubColumns_
int numberGubColumns_
size
Definition: ClpGubDynamicMatrix.hpp:253
ClpGubDynamicMatrix::lastDynamic
int lastDynamic() const
number of columns in dynamic model
Definition: ClpGubDynamicMatrix.hpp:201
ClpGubDynamicMatrix::getDynamicStatus
DynamicStatus getDynamicStatus(int sequence) const
Definition: ClpGubDynamicMatrix.hpp:121
ClpGubDynamicMatrix::element
double * element() const
elements
Definition: ClpGubDynamicMatrix.hpp:141
ClpGubDynamicMatrix::startColumn
CoinBigIndex * startColumn() const
Starts of each column.
Definition: ClpGubDynamicMatrix.hpp:131
ClpGubMatrix::upper
double * upper() const
Upper bounds on sets.
Definition: ClpGubMatrix.hpp:273
ClpGubDynamicMatrix::synchronize
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...
ClpGubDynamicMatrix::~ClpGubDynamicMatrix
virtual ~ClpGubDynamicMatrix()
Destructor.
ClpGubDynamicMatrix::numberElements
CoinBigIndex numberElements() const
size of working matrix (max)
Definition: ClpGubDynamicMatrix.hpp:206
ClpGubDynamicMatrix::row
int * row() const
rows
Definition: ClpGubDynamicMatrix.hpp:136
ClpGubDynamicMatrix::atUpperBound
@ atUpperBound
Definition: ClpGubDynamicMatrix.hpp:99
ClpGubDynamicMatrix::atLowerBound
@ atLowerBound
Definition: ClpGubDynamicMatrix.hpp:100
ClpGubMatrix::numberSets
int numberSets() const
Number of sets (gub rows)
Definition: ClpGubMatrix.hpp:288
ClpGubDynamicMatrix::firstAvailable
int firstAvailable() const
first free
Definition: ClpGubDynamicMatrix.hpp:186
ClpGubDynamicMatrix::objectiveOffset_
double objectiveOffset_
Saved value of objective offset.
Definition: ClpGubDynamicMatrix.hpp:229
ClpGubDynamicMatrix::upperColumn_
double * upperColumn_
Optional upper bounds on columns.
Definition: ClpGubDynamicMatrix.hpp:247
ClpGubDynamicMatrix::dynamicStatus
unsigned char * dynamicStatus() const
Status region for gub variables.
Definition: ClpGubDynamicMatrix.hpp:216
ClpGubDynamicMatrix::whichSet
int whichSet(int sequence) const
Returns which set a variable is in.
ClpGubDynamicMatrix::unsetFlagged
void unsetFlagged(int i)
Definition: ClpGubDynamicMatrix.hpp:111
ClpGubMatrix::end
int * end() const
End.
Definition: ClpGubMatrix.hpp:263
ClpGubDynamicMatrix::lowerColumn
double * lowerColumn() const
Optional lower bounds on columns.
Definition: ClpGubDynamicMatrix.hpp:161
ClpGubDynamicMatrix::times
virtual void times(double scalar, const double *x, double *y) const
Return y + A * scalar *x in y.
ClpGubDynamicMatrix::lastDynamic_
int lastDynamic_
number of columns in dynamic model
Definition: ClpGubDynamicMatrix.hpp:261
ClpGubDynamicMatrix::rhsOffset
virtual double * rhsOffset(ClpSimplex *model, bool forceRefresh=false, bool check=false)
Returns effective RHS offset if it is being used.
ClpGubDynamicMatrix::firstAvailable_
int firstAvailable_
first free
Definition: ClpGubDynamicMatrix.hpp:255
ClpGubDynamicMatrix
This implements Gub rows plus a ClpPackedMatrix.
Definition: ClpGubDynamicMatrix.hpp:19
ClpGubDynamicMatrix::numberGubColumns
int numberGubColumns() const
size
Definition: ClpGubDynamicMatrix.hpp:181
ClpGubDynamicMatrix::updatePivot
virtual int updatePivot(ClpSimplex *model, double oldInValue, double oldOutValue)
update information for a pivot (and effective rhs)
ClpGubDynamicMatrix::insertNonBasic
void insertNonBasic(int sequence, int iSet)
Add a new variable to a set.