- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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"
20 class ClpGubDynamicMatrix : public ClpGubMatrix {
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
53 using ClpPackedMatrix::times ;
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
72 ClpGubDynamicMatrix();
74 virtual ~ClpGubDynamicMatrix();
76
80 ClpGubDynamicMatrix(const ClpGubDynamicMatrix&);
85 ClpGubDynamicMatrix(ClpSimplex * model, int numberSets,
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
93 ClpGubDynamicMatrix& operator=(const ClpGubDynamicMatrix&);
95 virtual ClpMatrixBase * clone() const ;
97
99 enum DynamicStatus {
101 inSmall = 0x01,
102 atUpperBound = 0x02,
103 atLowerBound = 0x03
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_;
211 CoinBigIndex * startColumn_;
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_;
233 int numberGubColumns_;
235 int firstAvailable_;
237 int savedFirstAvailable_;
239 int firstDynamic_;
241 int lastDynamic_;
243 int numberElements_;
245 };
246
247 #endif
ClpGubDynamicMatrix::lowerSet
double * lowerSet() const
Optional true lower bounds on sets.
Definition: ClpGubDynamicMatrix.hpp:160
CoinBigIndex
int CoinBigIndex
Definition: Coin_C_defines.h:105
ClpGubDynamicMatrix::flagged
bool flagged(int i) const
Whether flagged.
Definition: ClpGubDynamicMatrix.hpp:106
ClpGubDynamicMatrix::whichSet
int whichSet(int sequence) const
Returns which set a variable is in.
ClpGubDynamicMatrix::cost
double * cost() const
costs
Definition: ClpGubDynamicMatrix.hpp:140
ClpGubDynamicMatrix::setDynamicStatus
void setDynamicStatus(int sequence, DynamicStatus status)
enums for status of various sorts
Definition: ClpGubDynamicMatrix.hpp:115
ClpGubDynamicMatrix::useEffectiveRhs
virtual void useEffectiveRhs(ClpSimplex *model, bool cheapest=true)
Sets up an effective RHS and does gub crash if needed.
ClpGubMatrix
This implements Gub rows plus a ClpPackedMatrix.
Definition: ClpGubMatrix.hpp:22
ClpGubDynamicMatrix::firstAvailable_
int firstAvailable_
first free
Definition: ClpGubDynamicMatrix.hpp:235
ClpGubDynamicMatrix::lowerColumn_
double * lowerColumn_
Optional lower bounds on columns.
Definition: ClpGubDynamicMatrix.hpp:225
ClpGubDynamicMatrix::unsetFlagged
void unsetFlagged(int i)
enums for status of various sorts
Definition: ClpGubDynamicMatrix.hpp:112
ClpGubDynamicMatrix::element_
double * element_
elements
Definition: ClpGubDynamicMatrix.hpp:215
ClpGubDynamicMatrix::firstDynamic
int firstDynamic() const
first dynamic
Definition: ClpGubDynamicMatrix.hpp:180
ClpGubDynamicMatrix::partialPricing
virtual void partialPricing(ClpSimplex *model, double start, double end, int &bestSequence, int &numberWanted)
Partial pricing.
ClpGubDynamicMatrix::numberElements_
int numberElements_
size of working matrix (max)
Definition: ClpGubDynamicMatrix.hpp:243
ClpGubDynamicMatrix::ClpGubDynamicMatrix
ClpGubDynamicMatrix()
Default constructor.
ClpGubDynamicMatrix::numberGubColumns_
int numberGubColumns_
size
Definition: ClpGubDynamicMatrix.hpp:233
ClpGubDynamicMatrix::setFirstAvailable
void setFirstAvailable(int value)
set first free
Definition: ClpGubDynamicMatrix.hpp:176
ClpGubDynamicMatrix::upperSet_
double * upperSet_
Optional true upper bounds on sets.
Definition: ClpGubDynamicMatrix.hpp:231
ClpGubDynamicMatrix::getDynamicStatus
DynamicStatus getDynamicStatus(int sequence) const
enums for status of various sorts
Definition: ClpGubDynamicMatrix.hpp:120
ClpGubDynamicMatrix::lowerSet_
double * lowerSet_
Optional true lower bounds on sets.
Definition: ClpGubDynamicMatrix.hpp:229
ClpGubDynamicMatrix::upperColumn_
double * upperColumn_
Optional upper bounds on columns.
Definition: ClpGubDynamicMatrix.hpp:227
ClpGubDynamicMatrix::~ClpGubDynamicMatrix
virtual ~ClpGubDynamicMatrix()
Destructor.
ClpGubDynamicMatrix::upperColumn
double * upperColumn() const
Optional upper bounds on columns.
Definition: ClpGubDynamicMatrix.hpp:156
ClpGubDynamicMatrix::times
virtual void times(double scalar, const double *x, double *y) const
Return y + A * scalar *x in y.
ClpGubDynamicMatrix::setFlagged
void setFlagged(int i)
enums for status of various sorts
Definition: ClpGubDynamicMatrix.hpp:109
ClpGubDynamicMatrix::objectiveOffset_
double objectiveOffset_
Saved value of objective offset.
Definition: ClpGubDynamicMatrix.hpp:209
ClpGubDynamicMatrix::lowerColumn
double * lowerColumn() const
Optional lower bounds on columns.
Definition: ClpGubDynamicMatrix.hpp:152
ClpGubMatrix::end
int * end() const
End.
Definition: ClpGubMatrix.hpp:256
ClpGubDynamicMatrix::gubRowStatus
unsigned char * gubRowStatus() const
Status region for gub slacks.
Definition: ClpGubDynamicMatrix.hpp:192
ClpGubMatrix::start
int * start() const
Starts.
Definition: ClpGubMatrix.hpp:252
ClpGubDynamicMatrix::startColumn_
CoinBigIndex * startColumn_
Starts of each column.
Definition: ClpGubDynamicMatrix.hpp:211
ClpGubDynamicMatrix::rhsOffset
virtual double * rhsOffset(ClpSimplex *model, bool forceRefresh=false, bool check=false)
Returns effective RHS offset if it is being used.
ClpGubMatrix::upper
double * upper() const
Upper bounds on sets.
Definition: ClpGubMatrix.hpp:264
ClpGubDynamicMatrix::operator=
ClpGubDynamicMatrix & operator=(const ClpGubDynamicMatrix &)
The copy constructor.
ClpGubDynamicMatrix::cost_
double * cost_
costs
Definition: ClpGubDynamicMatrix.hpp:217
ClpGubDynamicMatrix::row
int * row() const
rows
Definition: ClpGubDynamicMatrix.hpp:132
ClpGubDynamicMatrix::startColumn
CoinBigIndex * startColumn() const
Starts of each column.
Definition: ClpGubDynamicMatrix.hpp:128
ClpGubMatrix::numberSets
int numberSets() const
Number of sets (gub rows)
Definition: ClpGubMatrix.hpp:276
ClpGubDynamicMatrix::row_
int * row_
rows
Definition: ClpGubDynamicMatrix.hpp:213
ClpGubDynamicMatrix::dynamicStatus
unsigned char * dynamicStatus() const
Status region for gub variables.
Definition: ClpGubDynamicMatrix.hpp:196
ClpGubDynamicMatrix::atUpperBound
Definition: ClpGubDynamicMatrix.hpp:102
ClpGubDynamicMatrix::inSmall
Definition: ClpGubDynamicMatrix.hpp:101
ClpGubDynamicMatrix::lastDynamic_
int lastDynamic_
number of columns in dynamic model
Definition: ClpGubDynamicMatrix.hpp:241
ClpGubDynamicMatrix::fullStart
int * fullStart() const
full starts
Definition: ClpGubDynamicMatrix.hpp:144
ClpGubDynamicMatrix::atLowerBound
Definition: ClpGubDynamicMatrix.hpp:103
ClpPackedMatrix::times
virtual void times(double scalar, const double *x, double *y) const
Return y + A * scalar *x in y.
ClpGubDynamicMatrix::objectiveOffset
double objectiveOffset() const
Saved value of objective offset.
Definition: ClpGubDynamicMatrix.hpp:124
ClpGubDynamicMatrix::updatePivot
virtual int updatePivot(ClpSimplex *model, double oldInValue, double oldOutValue)
update information for a pivot (and effective rhs)
ClpGubDynamicMatrix::firstDynamic_
int firstDynamic_
first dynamic
Definition: ClpGubDynamicMatrix.hpp:239
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::savedFirstAvailable_
int savedFirstAvailable_
saved first free
Definition: ClpGubDynamicMatrix.hpp:237
ClpSimplex
This solves LPs using the simplex method.
Definition: ClpSimplex.hpp:70
ClpGubMatrix::status_
unsigned char * status_
Status of slacks.
Definition: ClpGubMatrix.hpp:307
ClpMatrixBase
Abstract base class for Clp Matrices.
Definition: ClpMatrixBase.hpp:38
ClpGubMatrix.hpp
ClpGubDynamicMatrix::DynamicStatus
DynamicStatus
enums for status of various sorts
Definition: ClpGubDynamicMatrix.hpp:100
ClpGubDynamicMatrix::fullStart_
int * fullStart_
full starts
Definition: ClpGubDynamicMatrix.hpp:219
ClpGubDynamicMatrix::firstAvailable
int firstAvailable() const
first free
Definition: ClpGubDynamicMatrix.hpp:172
CoinPragma.hpp
ClpGubDynamicMatrix::insertNonBasic
void insertNonBasic(int sequence, int iSet)
Add a new variable to a set.
ClpGubDynamicMatrix::checkFeasible
virtual int checkFeasible(ClpSimplex *model, double &sum) const
Just for debug Returns sum and number of primal infeasibilities.
ClpGubDynamicMatrix::element
double * element() const
elements
Definition: ClpGubDynamicMatrix.hpp:136
ClpGubDynamicMatrix::numberGubColumns
int numberGubColumns() const
size
Definition: ClpGubDynamicMatrix.hpp:168
ClpGubDynamicMatrix::clone
virtual ClpMatrixBase * clone() const
Clone.
ClpGubDynamicMatrix::upperSet
double * upperSet() const
Optional true upper bounds on sets.
Definition: ClpGubDynamicMatrix.hpp:164
ClpGubDynamicMatrix::numberElements
int numberElements() const
size of working matrix (max)
Definition: ClpGubDynamicMatrix.hpp:188
ClpGubDynamicMatrix::dynamicStatus_
unsigned char * dynamicStatus_
for status and which bound
Definition: ClpGubDynamicMatrix.hpp:223
ClpGubDynamicMatrix
This implements Gub rows plus a ClpPackedMatrix.
Definition: ClpGubDynamicMatrix.hpp:20
ClpGubDynamicMatrix::lastDynamic
int lastDynamic() const
number of columns in dynamic model
Definition: ClpGubDynamicMatrix.hpp:184
ClpGubDynamicMatrix::id_
int * id_
ids of active columns (just index here)
Definition: ClpGubDynamicMatrix.hpp:221
ClpGubMatrix::lower
double * lower() const
Lower bounds on sets.
Definition: ClpGubMatrix.hpp:260
ClpGubDynamicMatrix::id
int * id() const
ids of active columns (just index here)
Definition: ClpGubDynamicMatrix.hpp:148
ClpGubDynamicMatrix::cleanData
void cleanData(ClpSimplex *model)
Cleans data after setWarmStart.