#include <ClpMatrixBase.hpp>
Inheritance diagram for ClpMatrixBase:
Constructors, destructor<br> | |
NOTE: All constructors are protected. There's no need to expose them, after all, this is an abstract class. | |
virtual | ~ClpMatrixBase () |
ClpMatrixBase () | |
ClpMatrixBase (const ClpMatrixBase &) | |
ClpMatrixBase & | operator= (const ClpMatrixBase &) |
Public Member Functions | |
Virtual methods that the derived classes must provide | |
virtual CoinPackedMatrix * | getPackedMatrix () const=0 |
Return a complete CoinPackedMatrix. | |
virtual bool | isColOrdered () const=0 |
virtual CoinBigIndex | getNumElements () const=0 |
virtual int | getNumCols () const=0 |
virtual int | getNumRows () const=0 |
virtual const double * | getElements () const=0 |
virtual const int * | getIndices () const=0 |
virtual const CoinBigIndex * | getVectorStarts () const=0 |
virtual const int * | getVectorLengths () const=0 |
virtual void | deleteCols (const int numDel, const int *indDel)=0 |
virtual void | deleteRows (const int numDel, const int *indDel)=0 |
virtual void | appendCols (int number, const CoinPackedVectorBase *const *columns) |
Append Columns. | |
virtual void | appendRows (int number, const CoinPackedVectorBase *const *rows) |
Append Rows. | |
virtual ClpMatrixBase * | reverseOrderedCopy () const |
virtual CoinBigIndex | numberInBasis (const int *columnIsBasic) const=0 |
virtual CoinBigIndex | fillBasis (const ClpSimplex *model, const int *columnIsBasic, int &numberBasic, int *row, int *column, double *element) const=0 |
Fills in basis (Returns number of elements and updates numberBasic). | |
virtual CoinBigIndex | fillBasis (const ClpSimplex *model, const int *whichColumn, int numberRowBasic, int numberColumnBasic, int *row, int *column, double *element) const=0 |
virtual int | scale (ClpSimplex *model) const |
virtual bool | allElementsInRange (ClpModel *model, double smallest, double largest) |
virtual void | rangeOfElements (double &smallestNegative, double &largestNegative, double &smallestPositive, double &largestPositive) |
virtual void | unpack (const ClpSimplex *model, CoinIndexedVector *rowArray, int column) const=0 |
virtual void | unpackPacked (ClpSimplex *model, CoinIndexedVector *rowArray, int column) const=0 |
int | refresh (ClpSimplex *model) |
virtual CoinBigIndex * | dubiousWeights (const ClpSimplex *model, int *inputWeights) const |
virtual void | add (const ClpSimplex *model, CoinIndexedVector *rowArray, int column, double multiplier) const=0 |
virtual void | releasePackedMatrix () const |
Allow any parts of a created CoinPackedMatrix to be deleted. | |
virtual bool | canDoPartialPricing () const |
Says whether it can do partial pricing. | |
virtual void | partialPricing (ClpSimplex *model, int start, int end, int &bestSequence, int &numberWanted) |
Partial pricing. | |
Matrix times vector methods | |
They can be faster if scalar is +- 1 Also for simplex I am not using basic/non-basic split | |
virtual void | times (double scalar, const double *x, double *y) const=0 |
virtual void | times (double scalar, const double *x, double *y, const double *rowScale, const double *columnScale) const |
virtual void | transposeTimes (double scalar, const double *x, double *y) const=0 |
virtual void | transposeTimes (double scalar, const double *x, double *y, const double *rowScale, const double *columnScale) const |
virtual void | transposeTimes (const ClpSimplex *model, double scalar, const CoinIndexedVector *x, CoinIndexedVector *y, CoinIndexedVector *z) const=0 |
virtual void | subsetTransposeTimes (const ClpSimplex *model, const CoinIndexedVector *x, const CoinIndexedVector *y, CoinIndexedVector *z) const=0 |
Other | |
Clone | |
virtual ClpMatrixBase * | clone () const=0 |
virtual ClpMatrixBase * | subsetClone (int numberRows, const int *whichRows, int numberColumns, const int *whichColumns) const |
int | type () const |
Returns type. | |
void | setType (int type) |
Sets type. | |
Protected Attributes | |
Data members | |
The data members are protected to allow access for derived classes. | |
int | type_ |
type (may be useful) |
Since this class is abstract, no object of this type can be created.
If a derived class provides all methods then all Clp algorithms should work. Some can be very inefficient e.g. getElements etc is only used for tightening bounds for dual and the copies are deleted. Many methods can just be dummy i.e. abort(); if not all features are being used. So if column generation was being done then it makes no sense to do steepest edge so there would be no point providing subsetTransposeTimes.
Definition at line 26 of file ClpMatrixBase.hpp.
|
Default constructor. Definition at line 18 of file ClpMatrixBase.cpp.
00018 : 00019 type_(-1) 00020 { 00021 00022 } |
|
Destructor (has to be public) Definition at line 36 of file ClpMatrixBase.cpp.
00037 { 00038 00039 } |
|
Adds multiple of a column into an CoinIndexedvector You can use quickAdd to add to vector Implemented in ClpDummyMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix. Referenced by ClpSimplexDual::changeBounds(), and ClpSimplexDual::updateDualsInDual(). |
|
Checks if all elements are in valid range. Can just return true if you are not paranoid. For Clp I will probably expect no zeros. Code can modify matrix to get rid of small elements. Reimplemented in ClpPackedMatrix. Definition at line 98 of file ClpMatrixBase.hpp. Referenced by ClpSimplex::createRim(), and ClpInterior::createWorkingData().
00100 { return true;}; |
|
Delete the columns whose indices are listed in Implemented in ClpDummyMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix. Referenced by ClpModel::deleteColumns(), and ClpModel::resize(). |
|
Delete the rows whose indices are listed in Implemented in ClpDummyMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix. Referenced by ClpModel::deleteRows(), and ClpModel::resize(). |
|
Given positive integer weights for each row fills in sum of weights for each column (and slack). Returns weights vector Default returns vector of ones Reimplemented in ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix. Definition at line 101 of file ClpMatrixBase.cpp. References ClpModel::numberColumns(), and ClpModel::numberRows(). Referenced by ClpSimplexDual::whileIterating().
00102 { 00103 int number = model->numberRows()+model->numberColumns(); 00104 CoinBigIndex * weights = new CoinBigIndex[number]; 00105 int i; 00106 for (i=0;i<number;i++) 00107 weights[i]=1; 00108 return weights; 00109 } |
|
If element NULL returns number of elements in column part of basis, If not NULL fills in as well Implemented in ClpDummyMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix. |
|
A vector containing the elements in the packed matrix. Note that there might be gaps in this list, entries that do not belong to any major-dimension vector. To get the actual elements one should look at this vector together with vectorStarts and vectorLengths. Implemented in ClpDummyMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix. Referenced by Idiot::crossOver(), ClpSimplexPrimalQuadratic::endQuadratic(), ClpSimplex::saveModel(), and Idiot::solve2(). |
|
A vector containing the minor indices of the elements in the packed matrix. Note that there might be gaps in this list, entries that do not belong to any major-dimension vector. To get the actual elements one should look at this vector together with vectorStarts and vectorLengths. Implemented in ClpDummyMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix. Referenced by Idiot::crossOver(), ClpSimplexPrimalQuadratic::endQuadratic(), ClpSimplex::saveModel(), and Idiot::solve2(). |
|
Number of columns. Implemented in ClpDummyMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix. Referenced by ClpModel::loadProblem(), and ClpSimplex::saveModel(). |
|
Number of entries in the packed matrix. Implemented in ClpDummyMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix. Referenced by ClpModel::getNumElements(), ClpSimplex::sanityCheck(), ClpInterior::sanityCheck(), and ClpSimplex::startup(). |
|
Number of rows. Implemented in ClpDummyMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix. Referenced by ClpModel::loadProblem(), and ClpSimplex::saveModel(). |
|
The lengths of the major-dimension vectors. Implemented in ClpDummyMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix. Referenced by Idiot::crossOver(), ClpSimplexPrimalQuadratic::endQuadratic(), ClpSimplexDual::perturb(), ClpSimplex::saveModel(), and Idiot::solve2(). |
|
Whether the packed matrix is column major ordered or not. Implemented in ClpDummyMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix. Referenced by ClpModel::loadProblem(). |
|
Returns number of elements in basis column is basic if entry >=0 Implemented in ClpDummyMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix. |
|
Returns largest and smallest elements of both signs. Largest refers to largest absolute value. If returns zeros then can't tell anything Reimplemented in ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix. Definition at line 128 of file ClpMatrixBase.cpp. Referenced by ClpSimplexDual::perturb().
00130 { 00131 smallestNegative=0.0; 00132 largestNegative=0.0; 00133 smallestPositive=0.0; 00134 largestPositive=0.0; 00135 } |
|
Purely for column generation and similar ideas. Allows matrix and any bounds or costs to be updated (sensibly). Returns non-zero if any changes. Definition at line 122 of file ClpMatrixBase.hpp. Referenced by ClpSimplexDual::dual(), ClpSimplexDual::fastDual(), ClpSimplexPrimal::primal(), and ClpSimplexPrimalQuadratic::primalQuadratic2().
00123 { return 0;};
|
|
Returns a new matrix in reverse order without gaps Is allowed to return NULL if doesn't want to have row copy Reimplemented in ClpDummyMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix. Definition at line 68 of file ClpMatrixBase.hpp. Referenced by ClpSimplex::createRim().
00068 {return NULL;};
|
|
Creates scales for column copy (rowCopy in model may be modified) default does not allow scaling returns non-zero if no scaling done Reimplemented in ClpPackedMatrix. Definition at line 90 of file ClpMatrixBase.hpp. Referenced by ClpSimplex::createRim().
00091 { return 1;};
|
|
Subset clone (without gaps). Duplicates are allowed and order is as given. Derived classes need not provide this as it may not always make sense Reimplemented in ClpPackedMatrix, and ClpPlusMinusOneMatrix. Definition at line 85 of file ClpMatrixBase.cpp. Referenced by ClpModel::ClpModel(), and ClpSimplex::ClpSimplex().
00090 { 00091 std::cerr<<"subsetClone not supported - ClpMatrixBase"<<std::endl; 00092 abort(); 00093 return NULL; 00094 } |
|
Return Implemented in ClpDummyMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix. |
|
And for scaling - default aborts for when scaling not supported (unless pointers NULL when as normal) Reimplemented in ClpDummyMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix. Definition at line 54 of file ClpMatrixBase.cpp. References times().
00058 { 00059 if (rowScale) { 00060 std::cerr<<"Scaling not supported - ClpMatrixBase"<<std::endl; 00061 abort(); 00062 } else { 00063 times(scalar,x,y); 00064 } 00065 } |
|
Return
Implemented in ClpDummyMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix. Referenced by ClpSimplex::ClpSimplex(), ClpSimplexPrimalQuadratic::createDjs(), ClpPredictorCorrector::createSolution(), ClpPredictorCorrector::findDirectionVector(), ClpSimplex::originalModel(), ClpPredictorCorrector::solve(), ClpSimplex::times(), times(), and ClpPredictorCorrector::updateSolution(). |
|
Return Implemented in ClpDummyMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix. |
|
And for scaling - default aborts for when scaling not supported (unless pointers NULL when as normal) Reimplemented in ClpDummyMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix. Definition at line 68 of file ClpMatrixBase.cpp. References transposeTimes().
00072 { 00073 if (rowScale) { 00074 std::cerr<<"Scaling not supported - ClpMatrixBase"<<std::endl; 00075 abort(); 00076 } else { 00077 transposeTimes(scalar,x,y); 00078 } 00079 } |
|
Return
Implemented in ClpDummyMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix. Referenced by ClpSimplexPrimalQuadratic::createDjs(), ClpPredictorCorrector::createSolution(), ClpPredictorCorrector::findDirectionVector(), ClpSimplex::pivot(), ClpPrimalColumnDantzig::pivotColumn(), ClpSimplexPrimal::pivotResult(), ClpPredictorCorrector::solve(), ClpSimplex::transposeTimes(), transposeTimes(), ClpPredictorCorrector::updateSolution(), and ClpSimplexDual::whileIterating(). |
|
Unpacks a column into an CoinIndexedvector Implemented in ClpDummyMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix. Referenced by ClpSimplex::unpack(). |
|
Unpacks a column into an CoinIndexedvector in packed foramt Note that model is NOT const. Bounds and objective could be modified if doing column generation (just for this variable) Implemented in ClpDummyMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix. Referenced by ClpSimplex::unpackPacked(). |