Clp trunk
|
This implements a dynamic matrix when we have a limit on the number of "interesting rows". More...
#include <ClpDynamicExampleMatrix.hpp>
Public Member Functions | |
Main functions provided | |
virtual void | partialPricing (ClpSimplex *model, double start, double end, int &bestSequence, int &numberWanted) |
Partial pricing. | |
virtual void | createVariable (ClpSimplex *model, int &bestSequence) |
Creates a variable. | |
virtual void | packDown (const int *in, int numberToPack) |
If addColumn forces compression then this allows descendant to know what to do. | |
Constructors, destructor | |
ClpDynamicExampleMatrix () | |
Default constructor. | |
ClpDynamicExampleMatrix (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 *columnLower=NULL, const double *columnUpper=NULL, const unsigned char *status=NULL, const unsigned char *dynamicStatus=NULL, int numberIds=0, const int *ids=NULL) | |
This is the real constructor. | |
ClpDynamicExampleMatrix (ClpSimplex *model, int numberSets, int numberColumns, int *starts, const double *lower, const double *upper, int *startColumn, int *row, double *element, double *cost, double *columnLower=NULL, double *columnUpper=NULL, const unsigned char *status=NULL, const unsigned char *dynamicStatus=NULL, int numberIds=0, const int *ids=NULL) | |
This constructor just takes over ownership (except for lower, upper) | |
virtual | ~ClpDynamicExampleMatrix () |
Destructor. | |
Copy method | |
ClpDynamicExampleMatrix (const ClpDynamicExampleMatrix &) | |
The copy constructor. | |
ClpDynamicExampleMatrix & | operator= (const ClpDynamicExampleMatrix &) |
virtual ClpMatrixBase * | clone () const |
Clone. | |
gets and sets | |
CoinBigIndex * | startColumnGen () const |
Starts of each column. | |
int * | rowGen () const |
rows | |
double * | elementGen () const |
elements | |
double * | costGen () const |
costs | |
int * | fullStartGen () const |
full starts | |
int * | idGen () const |
ids in next level matrix | |
double * | columnLowerGen () const |
Optional lower bounds on columns. | |
double * | columnUpperGen () const |
Optional upper bounds on columns. | |
int | numberColumns () const |
size | |
void | setDynamicStatusGen (int sequence, DynamicStatus status) |
DynamicStatus | getDynamicStatusGen (int sequence) const |
bool | flaggedGen (int i) const |
Whether flagged. | |
void | setFlaggedGen (int i) |
void | unsetFlagged (int i) |
Protected Attributes | |
Data members | |
The data members are protected to allow access for derived classes. | |
int | numberColumns_ |
size | |
CoinBigIndex * | startColumnGen_ |
Starts of each column. | |
int * | rowGen_ |
rows | |
double * | elementGen_ |
elements | |
double * | costGen_ |
costs | |
int * | fullStartGen_ |
start of each set | |
unsigned char * | dynamicStatusGen_ |
for status and which bound | |
int * | idGen_ |
identifier for each variable up one level (startColumn_, etc). | |
double * | columnLowerGen_ |
Optional lower bounds on columns. | |
double * | columnUpperGen_ |
Optional upper bounds on columns. |
This implements a dynamic matrix when we have a limit on the number of "interesting rows".
This version inherits from ClpDynamicMatrix and knows that the real matrix is gub. This acts just like ClpDynamicMatrix but generates columns. This "generates" columns by choosing from stored set. It is maent as a starting point as to how you could use shortest path to generate columns.
So it has its own copy of all data needed. It populates ClpDynamicWatrix with enough to allow for gub keys and active variables. In turn ClpDynamicMatrix populates a CoinPackedMatrix with active columns and rows.
As there is one copy here and one in ClpDynamicmatrix these names end in Gen_
It is obviously more efficient to just use ClpDynamicMatrix but the ideas is to show how much code a user would have to write.
This does not work very well with bounds
Definition at line 33 of file ClpDynamicExampleMatrix.hpp.
ClpDynamicExampleMatrix::ClpDynamicExampleMatrix | ( | ) |
Default constructor.
ClpDynamicExampleMatrix::ClpDynamicExampleMatrix | ( | 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 * | columnLower = NULL , |
||
const double * | columnUpper = NULL , |
||
const unsigned char * | status = NULL , |
||
const unsigned char * | dynamicStatus = NULL , |
||
int | numberIds = 0 , |
||
const int * | ids = NULL |
||
) |
This is the real constructor.
It assumes factorization frequency will not be changed. This resizes model !!!! The contents of original matrix in model will be taken over and original matrix will be sanitized so can be deleted (to avoid a very small memory leak)
ClpDynamicExampleMatrix::ClpDynamicExampleMatrix | ( | ClpSimplex * | model, |
int | numberSets, | ||
int | numberColumns, | ||
int * | starts, | ||
const double * | lower, | ||
const double * | upper, | ||
int * | startColumn, | ||
int * | row, | ||
double * | element, | ||
double * | cost, | ||
double * | columnLower = NULL , |
||
double * | columnUpper = NULL , |
||
const unsigned char * | status = NULL , |
||
const unsigned char * | dynamicStatus = NULL , |
||
int | numberIds = 0 , |
||
const int * | ids = NULL |
||
) |
This constructor just takes over ownership (except for lower, upper)
virtual ClpDynamicExampleMatrix::~ClpDynamicExampleMatrix | ( | ) | [virtual] |
Destructor.
ClpDynamicExampleMatrix::ClpDynamicExampleMatrix | ( | const ClpDynamicExampleMatrix & | ) |
The copy constructor.
virtual void ClpDynamicExampleMatrix::partialPricing | ( | ClpSimplex * | model, |
double | start, | ||
double | end, | ||
int & | bestSequence, | ||
int & | numberWanted | ||
) | [virtual] |
Partial pricing.
Reimplemented from ClpDynamicMatrix.
virtual void ClpDynamicExampleMatrix::createVariable | ( | ClpSimplex * | model, |
int & | bestSequence | ||
) | [virtual] |
Creates a variable.
This is called after partial pricing and will modify matrix. Will update bestSequence.
Reimplemented from ClpDynamicMatrix.
virtual void ClpDynamicExampleMatrix::packDown | ( | const int * | in, |
int | numberToPack | ||
) | [virtual] |
If addColumn forces compression then this allows descendant to know what to do.
If >= then entry stayed in, if -1 then entry went out to lower bound.of zero. Entries at upper bound (really nonzero) never go out (at present).
Reimplemented from ClpDynamicMatrix.
ClpDynamicExampleMatrix& ClpDynamicExampleMatrix::operator= | ( | const ClpDynamicExampleMatrix & | ) |
virtual ClpMatrixBase* ClpDynamicExampleMatrix::clone | ( | ) | const [virtual] |
Clone.
Reimplemented from ClpDynamicMatrix.
CoinBigIndex* ClpDynamicExampleMatrix::startColumnGen | ( | ) | const [inline] |
Starts of each column.
Definition at line 100 of file ClpDynamicExampleMatrix.hpp.
int* ClpDynamicExampleMatrix::rowGen | ( | ) | const [inline] |
rows
Definition at line 104 of file ClpDynamicExampleMatrix.hpp.
double* ClpDynamicExampleMatrix::elementGen | ( | ) | const [inline] |
elements
Definition at line 108 of file ClpDynamicExampleMatrix.hpp.
double* ClpDynamicExampleMatrix::costGen | ( | ) | const [inline] |
costs
Definition at line 112 of file ClpDynamicExampleMatrix.hpp.
int* ClpDynamicExampleMatrix::fullStartGen | ( | ) | const [inline] |
full starts
Definition at line 116 of file ClpDynamicExampleMatrix.hpp.
int* ClpDynamicExampleMatrix::idGen | ( | ) | const [inline] |
ids in next level matrix
Definition at line 120 of file ClpDynamicExampleMatrix.hpp.
double* ClpDynamicExampleMatrix::columnLowerGen | ( | ) | const [inline] |
Optional lower bounds on columns.
Definition at line 124 of file ClpDynamicExampleMatrix.hpp.
double* ClpDynamicExampleMatrix::columnUpperGen | ( | ) | const [inline] |
Optional upper bounds on columns.
Definition at line 128 of file ClpDynamicExampleMatrix.hpp.
int ClpDynamicExampleMatrix::numberColumns | ( | ) | const [inline] |
size
Definition at line 132 of file ClpDynamicExampleMatrix.hpp.
void ClpDynamicExampleMatrix::setDynamicStatusGen | ( | int | sequence, |
DynamicStatus | status | ||
) | [inline] |
Definition at line 135 of file ClpDynamicExampleMatrix.hpp.
DynamicStatus ClpDynamicExampleMatrix::getDynamicStatusGen | ( | int | sequence | ) | const [inline] |
Definition at line 140 of file ClpDynamicExampleMatrix.hpp.
bool ClpDynamicExampleMatrix::flaggedGen | ( | int | i | ) | const [inline] |
Whether flagged.
Definition at line 144 of file ClpDynamicExampleMatrix.hpp.
void ClpDynamicExampleMatrix::setFlaggedGen | ( | int | i | ) | [inline] |
Definition at line 147 of file ClpDynamicExampleMatrix.hpp.
void ClpDynamicExampleMatrix::unsetFlagged | ( | int | i | ) | [inline] |
Reimplemented from ClpDynamicMatrix.
Definition at line 150 of file ClpDynamicExampleMatrix.hpp.
int ClpDynamicExampleMatrix::numberColumns_ [protected] |
size
Definition at line 161 of file ClpDynamicExampleMatrix.hpp.
CoinBigIndex* ClpDynamicExampleMatrix::startColumnGen_ [protected] |
Starts of each column.
Definition at line 163 of file ClpDynamicExampleMatrix.hpp.
int* ClpDynamicExampleMatrix::rowGen_ [protected] |
rows
Definition at line 165 of file ClpDynamicExampleMatrix.hpp.
double* ClpDynamicExampleMatrix::elementGen_ [protected] |
elements
Definition at line 167 of file ClpDynamicExampleMatrix.hpp.
double* ClpDynamicExampleMatrix::costGen_ [protected] |
costs
Definition at line 169 of file ClpDynamicExampleMatrix.hpp.
int* ClpDynamicExampleMatrix::fullStartGen_ [protected] |
start of each set
Definition at line 171 of file ClpDynamicExampleMatrix.hpp.
unsigned char* ClpDynamicExampleMatrix::dynamicStatusGen_ [protected] |
for status and which bound
Definition at line 173 of file ClpDynamicExampleMatrix.hpp.
int* ClpDynamicExampleMatrix::idGen_ [protected] |
identifier for each variable up one level (startColumn_, etc).
This is of length maximumGubColumns_. For this version it is just sequence number at this level
Definition at line 177 of file ClpDynamicExampleMatrix.hpp.
double* ClpDynamicExampleMatrix::columnLowerGen_ [protected] |
Optional lower bounds on columns.
Definition at line 179 of file ClpDynamicExampleMatrix.hpp.
double* ClpDynamicExampleMatrix::columnUpperGen_ [protected] |
Optional upper bounds on columns.
Definition at line 181 of file ClpDynamicExampleMatrix.hpp.