Cgl  0.60.3
 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 2385 2019-01-06 19:43:06Z unxusr $ */
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  }
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_;
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_;
265 };
266 
267 #endif
268 
269 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
270 */
double * upperColumn() const
Optional upper bounds on columns.
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.
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:106
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
CoinBigIndex numberElements() const
size of working matrix (max)
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.
CoinBigIndex numberElements_
size of working matrix (max)
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.