Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

ClpMatrixBase Class Reference

#include <ClpMatrixBase.hpp>

Inheritance diagram for ClpMatrixBase:

ClpDummyMatrix ClpNetworkMatrix ClpPackedMatrix ClpPlusMinusOneMatrix List of all members.

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 &)
ClpMatrixBaseoperator= (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 ClpMatrixBasereverseOrderedCopy () 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 ClpMatrixBaseclone () const=0
virtual ClpMatrixBasesubsetClone (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)


Detailed Description

Abstract base class for Clp Matrices

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.


Constructor & Destructor Documentation

ClpMatrixBase::ClpMatrixBase  )  [protected]
 

Default constructor.

Definition at line 18 of file ClpMatrixBase.cpp.

00018                               :
00019   type_(-1)
00020 {
00021 
00022 }

ClpMatrixBase::~ClpMatrixBase  )  [virtual]
 

Destructor (has to be public)

Definition at line 36 of file ClpMatrixBase.cpp.

00037 {
00038 
00039 }


Member Function Documentation

virtual void ClpMatrixBase::add const ClpSimplex model,
CoinIndexedVector rowArray,
int  column,
double  multiplier
const [pure virtual]
 

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().

virtual bool ClpMatrixBase::allElementsInRange ClpModel model,
double  smallest,
double  largest
[inline, virtual]
 

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;};

virtual void ClpMatrixBase::deleteCols const int  numDel,
const int *  indDel
[pure virtual]
 

Delete the columns whose indices are listed in indDel.

Implemented in ClpDummyMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix.

Referenced by ClpModel::deleteColumns(), and ClpModel::resize().

virtual void ClpMatrixBase::deleteRows const int  numDel,
const int *  indDel
[pure virtual]
 

Delete the rows whose indices are listed in indDel.

Implemented in ClpDummyMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix.

Referenced by ClpModel::deleteRows(), and ClpModel::resize().

CoinBigIndex * ClpMatrixBase::dubiousWeights const ClpSimplex model,
int *  inputWeights
const [virtual]
 

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 }

virtual CoinBigIndex ClpMatrixBase::fillBasis const ClpSimplex model,
const int *  whichColumn,
int  numberRowBasic,
int  numberColumnBasic,
int *  row,
int *  column,
double *  element
const [pure virtual]
 

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.

virtual const double* ClpMatrixBase::getElements  )  const [pure virtual]
 

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().

virtual const int* ClpMatrixBase::getIndices  )  const [pure virtual]
 

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().

virtual int ClpMatrixBase::getNumCols  )  const [pure virtual]
 

Number of columns.

Implemented in ClpDummyMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix.

Referenced by ClpModel::loadProblem(), and ClpSimplex::saveModel().

virtual CoinBigIndex ClpMatrixBase::getNumElements  )  const [pure virtual]
 

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().

virtual int ClpMatrixBase::getNumRows  )  const [pure virtual]
 

Number of rows.

Implemented in ClpDummyMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix.

Referenced by ClpModel::loadProblem(), and ClpSimplex::saveModel().

virtual const int* ClpMatrixBase::getVectorLengths  )  const [pure virtual]
 

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().

virtual bool ClpMatrixBase::isColOrdered  )  const [pure virtual]
 

Whether the packed matrix is column major ordered or not.

Implemented in ClpDummyMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix.

Referenced by ClpModel::loadProblem().

virtual CoinBigIndex ClpMatrixBase::numberInBasis const int *  columnIsBasic  )  const [pure virtual]
 

Returns number of elements in basis column is basic if entry >=0

Implemented in ClpDummyMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix.

void ClpMatrixBase::rangeOfElements double &  smallestNegative,
double &  largestNegative,
double &  smallestPositive,
double &  largestPositive
[virtual]
 

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 }

int ClpMatrixBase::refresh ClpSimplex model  )  [inline]
 

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;};

virtual ClpMatrixBase* ClpMatrixBase::reverseOrderedCopy  )  const [inline, virtual]
 

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;};

virtual int ClpMatrixBase::scale ClpSimplex model  )  const [inline, virtual]
 

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;};

ClpMatrixBase * ClpMatrixBase::subsetClone int  numberRows,
const int *  whichRows,
int  numberColumns,
const int *  whichColumns
const [virtual]
 

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 }

virtual void ClpMatrixBase::subsetTransposeTimes const ClpSimplex model,
const CoinIndexedVector x,
const CoinIndexedVector y,
CoinIndexedVector z
const [pure virtual]
 

Return x *A in z but just for indices in y. This is only needed for primal steepest edge. Note - z always packed mode Squashes small elements and knows about ClpSimplex

Implemented in ClpDummyMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix.

void ClpMatrixBase::times double  scalar,
const double *  x,
double *  y,
const double *  rowScale,
const double *  columnScale
const [virtual]
 

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 }

virtual void ClpMatrixBase::times double  scalar,
const double *  x,
double *  y
const [pure virtual]
 

Return y + A * x * scalar in y.

Precondition:
x must be of size numColumns()

y must be of size numRows()

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().

virtual void ClpMatrixBase::transposeTimes const ClpSimplex model,
double  scalar,
const CoinIndexedVector x,
CoinIndexedVector y,
CoinIndexedVector z
const [pure virtual]
 

Return x * scalar *A + y in z. Can use y as temporary array (will be empty at end) Note - If x packed mode - then z packed mode Squashes small elements and knows about ClpSimplex

Implemented in ClpDummyMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix.

void ClpMatrixBase::transposeTimes double  scalar,
const double *  x,
double *  y,
const double *  rowScale,
const double *  columnScale
const [virtual]
 

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 }

virtual void ClpMatrixBase::transposeTimes double  scalar,
const double *  x,
double *  y
const [pure virtual]
 

Return y + x * scalar * A in y.

Precondition:
x must be of size numRows()

y must be of size numColumns()

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().

virtual void ClpMatrixBase::unpack const ClpSimplex model,
CoinIndexedVector rowArray,
int  column
const [pure virtual]
 

Unpacks a column into an CoinIndexedvector

Implemented in ClpDummyMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix.

Referenced by ClpSimplex::unpack().

virtual void ClpMatrixBase::unpackPacked ClpSimplex model,
CoinIndexedVector rowArray,
int  column
const [pure virtual]
 

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().


The documentation for this class was generated from the following files:
Generated on Wed Dec 3 14:37:38 2003 for CLP by doxygen 1.3.5