/usr/include/coin/ClpGubDynamicMatrix.hpp is in coinor-libclp-dev 1.15.10-1build2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | /* $Id: ClpGubDynamicMatrix.hpp 1665 2011-01-04 17:55:54Z lou $ */
// Copyright (C) 2003, International Business Machines
// Corporation and others. All Rights Reserved.
// This code is licensed under the terms of the Eclipse Public License (EPL).
#ifndef ClpGubDynamicMatrix_H
#define ClpGubDynamicMatrix_H
#include "CoinPragma.hpp"
#include "ClpGubMatrix.hpp"
/** This implements Gub rows plus a ClpPackedMatrix.
This a dynamic version which stores the gub part and dynamically creates matrix.
All bounds are assumed to be zero and infinity
This is just a simple example for real column generation
*/
class ClpGubDynamicMatrix : public ClpGubMatrix {
public:
/**@name Main functions provided */
//@{
/// Partial pricing
virtual void partialPricing(ClpSimplex * model, double start, double end,
int & bestSequence, int & numberWanted);
/** This is local to Gub to allow synchronization:
mode=0 when status of basis is good
mode=1 when variable is flagged
mode=2 when all variables unflagged (returns number flagged)
mode=3 just reset costs (primal)
mode=4 correct number of dual infeasibilities
mode=5 return 4 if time to re-factorize
mode=8 - make sure set is clean
mode=9 - adjust lower, upper on set by incoming
*/
virtual int synchronize(ClpSimplex * model, int mode);
/// Sets up an effective RHS and does gub crash if needed
virtual void useEffectiveRhs(ClpSimplex * model, bool cheapest = true);
/**
update information for a pivot (and effective rhs)
*/
virtual int updatePivot(ClpSimplex * model, double oldInValue, double oldOutValue);
/// Add a new variable to a set
void insertNonBasic(int sequence, int iSet);
/** Returns effective RHS offset if it is being used. This is used for long problems
or big gub or anywhere where going through full columns is
expensive. This may re-compute */
virtual double * rhsOffset(ClpSimplex * model, bool forceRefresh = false,
bool check = false);
using ClpPackedMatrix::times ;
/** Return <code>y + A * scalar *x</code> in <code>y</code>.
@pre <code>x</code> must be of size <code>numColumns()</code>
@pre <code>y</code> must be of size <code>numRows()</code> */
virtual void times(double scalar,
const double * x, double * y) const;
/** Just for debug
Returns sum and number of primal infeasibilities. Recomputes keys
*/
virtual int checkFeasible(ClpSimplex * model, double & sum) const;
/// Cleans data after setWarmStart
void cleanData(ClpSimplex * model);
//@}
/**@name Constructors, destructor */
//@{
/** Default constructor. */
ClpGubDynamicMatrix();
/** Destructor */
virtual ~ClpGubDynamicMatrix();
//@}
/**@name Copy method */
//@{
/** The copy constructor. */
ClpGubDynamicMatrix(const ClpGubDynamicMatrix&);
/** This is the real constructor.
It assumes factorization frequency will not be changed.
This resizes model !!!!
*/
ClpGubDynamicMatrix(ClpSimplex * model, int numberSets,
int numberColumns, const int * starts,
const double * lower, const double * upper,
const int * startColumn, const int * row,
const double * element, const double * cost,
const double * lowerColumn = NULL, const double * upperColumn = NULL,
const unsigned char * status = NULL);
ClpGubDynamicMatrix& operator=(const ClpGubDynamicMatrix&);
/// Clone
virtual ClpMatrixBase * clone() const ;
//@}
/**@name gets and sets */
//@{
/// enums for status of various sorts
enum DynamicStatus {
inSmall = 0x01,
atUpperBound = 0x02,
atLowerBound = 0x03
};
/// Whether flagged
inline bool flagged(int i) const {
return (dynamicStatus_[i] & 8) != 0;
}
inline void setFlagged(int i) {
dynamicStatus_[i] = static_cast<unsigned char>(dynamicStatus_[i] | 8);
}
inline void unsetFlagged(int i) {
dynamicStatus_[i] = static_cast<unsigned char>(dynamicStatus_[i] & ~8);
}
inline void setDynamicStatus(int sequence, DynamicStatus status) {
unsigned char & st_byte = dynamicStatus_[sequence];
st_byte = static_cast<unsigned char>(st_byte & ~7);
st_byte = static_cast<unsigned char>(st_byte | status);
}
inline DynamicStatus getDynamicStatus(int sequence) const {
return static_cast<DynamicStatus> (dynamicStatus_[sequence] & 7);
}
/// Saved value of objective offset
inline double objectiveOffset() const {
return objectiveOffset_;
}
/// Starts of each column
inline CoinBigIndex * startColumn() const {
return startColumn_;
}
/// rows
inline int * row() const {
return row_;
}
/// elements
inline double * element() const {
return element_;
}
/// costs
inline double * cost() const {
return cost_;
}
/// full starts
inline int * fullStart() const {
return fullStart_;
}
/// ids of active columns (just index here)
inline int * id() const {
return id_;
}
/// Optional lower bounds on columns
inline double * lowerColumn() const {
return lowerColumn_;
}
/// Optional upper bounds on columns
inline double * upperColumn() const {
return upperColumn_;
}
/// Optional true lower bounds on sets
inline double * lowerSet() const {
return lowerSet_;
}
/// Optional true upper bounds on sets
inline double * upperSet() const {
return upperSet_;
}
/// size
inline int numberGubColumns() const {
return numberGubColumns_;
}
/// first free
inline int firstAvailable() const {
return firstAvailable_;
}
/// set first free
inline void setFirstAvailable(int value) {
firstAvailable_ = value;
}
/// first dynamic
inline int firstDynamic() const {
return firstDynamic_;
}
/// number of columns in dynamic model
inline int lastDynamic() const {
return lastDynamic_;
}
/// size of working matrix (max)
inline int numberElements() const {
return numberElements_;
}
/// Status region for gub slacks
inline unsigned char * gubRowStatus() const {
return status_;
}
/// Status region for gub variables
inline unsigned char * dynamicStatus() const {
return dynamicStatus_;
}
/// Returns which set a variable is in
int whichSet (int sequence) const;
//@}
protected:
/**@name Data members
The data members are protected to allow access for derived classes. */
//@{
/// Saved value of objective offset
double objectiveOffset_;
/// Starts of each column
CoinBigIndex * startColumn_;
/// rows
int * row_;
/// elements
double * element_;
/// costs
double * cost_;
/// full starts
int * fullStart_;
/// ids of active columns (just index here)
int * id_;
/// for status and which bound
unsigned char * dynamicStatus_;
/// Optional lower bounds on columns
double * lowerColumn_;
/// Optional upper bounds on columns
double * upperColumn_;
/// Optional true lower bounds on sets
double * lowerSet_;
/// Optional true upper bounds on sets
double * upperSet_;
/// size
int numberGubColumns_;
/// first free
int firstAvailable_;
/// saved first free
int savedFirstAvailable_;
/// first dynamic
int firstDynamic_;
/// number of columns in dynamic model
int lastDynamic_;
/// size of working matrix (max)
int numberElements_;
//@}
};
#endif
|