# ClpMatrixBase Class Reference

Abstract base class for Clp Matrices. More...

`#include <ClpMatrixBase.hpp>`

Inheritance diagram for ClpMatrixBase:
[legend]

List of all members.

## 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
| Whether the packed matrix is column major ordered or not.
virtual CoinBigIndex | getNumElements () const =0
| Number of entries in the packed matrix.
virtual int | getNumCols () const =0
| Number of columns.
virtual int | getNumRows () const =0
| Number of rows.
virtual const double * | getElements () const =0
| A vector containing the elements in the packed matrix.
virtual const int * | getIndices () const =0
| A vector containing the minor indices of the elements in the packed matrix.
virtual const CoinBigIndex * | getVectorStarts () const =0
| Return a complete CoinPackedMatrix.
virtual const int * | getVectorLengths () const =0
| The lengths of the major-dimension vectors.
virtual int | getVectorLength (int index) const
| The length of a single major-dimension vector.
virtual void | deleteCols (const int numDel, const int *indDel)=0
| Delete the columns whose indices are listed in `indDel`.
virtual void | deleteRows (const int numDel, const int *indDel)=0
| Delete the rows whose indices are listed in `indDel`.
virtual void | appendCols (int number, const CoinPackedVectorBase *const *columns)
| Append Columns.
virtual void | appendRows (int number, const CoinPackedVectorBase *const *rows)
| Append Rows.
virtual void | modifyCoefficient (int row, int column, double newElement, bool keepZero=false)
| Modify one element of packed matrix.
virtual int | appendMatrix (int number, int type, const CoinBigIndex *starts, const int *index, const double *element, int numberOther=-1)
| Append a set of rows/columns to the end of the matrix.
virtual ClpMatrixBase * | reverseOrderedCopy () const
| Returns a new matrix in reverse order without gaps Is allowed to return NULL if doesn't want to have row copy.
virtual CoinBigIndex | countBasis (const int *whichColumn, int &numberColumnBasic)=0
| Returns number of elements in column part of basis.
virtual void | fillBasis (ClpSimplex *model, const int *whichColumn, int &numberColumnBasic, int *row, int *start, int *rowCount, int *columnCount, CoinFactorizationDouble *element)=0
| Fills in column part of basis.
virtual int | scale (ClpModel *, const ClpSimplex *=NULL) const
| Creates scales for column copy (rowCopy in model may be modified) default does not allow scaling returns non-zero if no scaling done.
virtual void | scaleRowCopy (ClpModel *) const
| Scales rowCopy if column copy scaled Only called if scales already exist.
virtual bool | canGetRowCopy () const
| Returns true if can create row copy.
virtual ClpMatrixBase * | scaledColumnCopy (ClpModel *) const
| Realy really scales column copy Only called if scales already exist.
virtual bool | allElementsInRange (ClpModel *, double, double, int=15)
| Checks if all elements are in valid range.
virtual void | setDimensions (int numrows, int numcols)
| Set the dimensions of the matrix.
virtual void | rangeOfElements (double &smallestNegative, double &largestNegative, double &smallestPositive, double &largestPositive)
| Returns largest and smallest elements of both signs.
virtual void | unpack (const ClpSimplex *model, CoinIndexedVector *rowArray, int column) const =0
| Unpacks a column into an CoinIndexedvector.
virtual void | unpackPacked (ClpSimplex *model, CoinIndexedVector *rowArray, int column) const =0
| Unpacks a column into an CoinIndexedvector in packed format Note that model is NOT const.
virtual int | refresh (ClpSimplex *)
| Purely for column generation and similar ideas.
virtual void | reallyScale (const double *rowScale, const double *columnScale)
| Return a complete CoinPackedMatrix.
virtual CoinBigIndex * | dubiousWeights (const ClpSimplex *model, int *inputWeights) const
| Given positive integer weights for each row fills in sum of weights for each column (and slack).
virtual void | add (const ClpSimplex *model, CoinIndexedVector *rowArray, int column, double multiplier) const =0
| Adds multiple of a column into an CoinIndexedvector You can use quickAdd to add to vector.
virtual void | add (const ClpSimplex *model, double *array, int column, double multiplier) const =0
| Adds multiple of a column into an array.
virtual void | releasePackedMatrix () const =0
| Allow any parts of a created CoinPackedMatrix to be deleted.
virtual bool | canDoPartialPricing () const
| Says whether it can do partial pricing.
virtual int | hiddenRows () const
| Returns number of hidden rows e.g. gub.
virtual void | partialPricing (ClpSimplex *model, double start, double end, int &bestSequence, int &numberWanted)
| Partial pricing.
virtual int | extendUpdated (ClpSimplex *model, CoinIndexedVector *update, int mode)
| expands an updated column to allow for extra rows which the main solver does not know about and returns number added.
virtual void | primalExpanded (ClpSimplex *model, int mode)
| utility primal function for dealing with dynamic constraints mode=0 - Set up before "update" and "times" for primal solution using extended rows mode=1 - Cleanup primal solution after "times" using extended rows.
virtual void | dualExpanded (ClpSimplex *model, CoinIndexedVector *array, double *other, int mode)
| utility dual function for dealing with dynamic constraints mode=0 - Set up before "updateTranspose" and "transposeTimes" for duals using extended updates array (and may use other if dual values pass) mode=1 - Update dual solution after "transposeTimes" using extended rows.
virtual int | generalExpanded (ClpSimplex *model, int mode, int &number)
| general utility function for dealing with dynamic constraints mode=0 - Create list of non-key basics in pivotVariable_ using number as numberBasic in and out mode=1 - Set all key variables as basic mode=2 - return number extra rows needed, number gives maximum number basic mode=3 - before replaceColumn mode=4 - return 1 if can do primal, 2 if dual, 3 if both mode=5 - save any status stuff (when in good state) mode=6 - restore status stuff mode=7 - flag given variable (normally sequenceIn) mode=8 - unflag all variables mode=9 - synchronize costs and bounds mode=10 - return 1 if there may be changing bounds on variable (column generation) mode=11 - make sure set is clean (used when a variable rejected - but not flagged) mode=12 - after factorize but before permute stuff mode=13 - at end of simplex to delete stuff
virtual int | updatePivot (ClpSimplex *model, double oldInValue, double oldOutValue)
| update information for a pivot (and effective rhs)
virtual void | createVariable (ClpSimplex *model, int &bestSequence)
| Creates a variable.
virtual int | checkFeasible (ClpSimplex *model, double &sum) const
| Just for debug if odd type matrix.
double | reducedCost (ClpSimplex *model, int sequence) const
| Returns reduced cost of a variable.
virtual void | correctSequence (const ClpSimplex *model, int &sequenceIn, int &sequenceOut)
| Correct sequence in and out to give true value (if both -1 maybe do whole matrix).
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 *COIN_RESTRICT x, double *COIN_RESTRICT y) const =0
| Return `y + A * x * scalar` in `y`.
virtual void | times (double scalar, const double *COIN_RESTRICT x, double *COIN_RESTRICT y, const double *COIN_RESTRICT rowScale, const double *COIN_RESTRICT columnScale) const
| And for scaling - default aborts for when scaling not supported (unless pointers NULL when as normal).
virtual void | transposeTimes (double scalar, const double *COIN_RESTRICT x, double *COIN_RESTRICT y) const =0
| Return `y + x * scalar * A` in `y`.
virtual void | transposeTimes (double scalar, const double *COIN_RESTRICT x, double *COIN_RESTRICT y, const double *COIN_RESTRICT rowScale, const double *COIN_RESTRICT columnScale, double *COIN_RESTRICT spare=NULL) const
| And for scaling - default aborts for when scaling not supported (unless pointers NULL when as normal).
virtual void | transposeTimes (const ClpSimplex *model, double scalar, const CoinIndexedVector *x, CoinIndexedVector *y, CoinIndexedVector *z) const =0
| Return `x * scalar *A + y` in `z`.
virtual void | subsetTransposeTimes (const ClpSimplex *model, const CoinIndexedVector *x, const CoinIndexedVector *y, CoinIndexedVector *z) const =0
| Return `x *A` in `z` but just for indices in y.
virtual bool | canCombine (const ClpSimplex *, const CoinIndexedVector *) const
| Returns true if can combine transposeTimes and subsetTransposeTimes and if it would be faster.
virtual void | transposeTimes2 (const ClpSimplex *model, const CoinIndexedVector *pi1, CoinIndexedVector *dj1, const CoinIndexedVector *pi2, CoinIndexedVector *spare, double referenceIn, double devex, unsigned int *reference, double *weights, double scaleFactor)
| Updates two arrays for steepest and does devex weights (need not be coded).
virtual void | subsetTimes2 (const ClpSimplex *model, CoinIndexedVector *dj1, const CoinIndexedVector *pi2, CoinIndexedVector *dj2, double referenceIn, double devex, unsigned int *reference, double *weights, double scaleFactor)
| Updates second array for steepest and does devex weights (need not be coded).
virtual void | listTransposeTimes (const ClpSimplex *model, double *x, int *y, int number, double *z) const
| Return `x *A` in `z` but just for number indices in y.
Other
Clone
virtual ClpMatrixBase * | clone () const =0
| Subset clone (without gaps).
virtual ClpMatrixBase * | subsetClone (int numberRows, const int *whichRows, int numberColumns, const int *whichColumns) const
| Subset clone (without gaps).
virtual void | backToBasics ()
| Gets rid of any mutable by products.
int | type () const
| Returns type.
void | setType (int newtype)
| Sets type.
void | useEffectiveRhs (ClpSimplex *model)
| Sets up an effective RHS.
virtual double * | rhsOffset (ClpSimplex *model, bool forceRefresh=false, bool check=false)
| Returns effective RHS offset if it is being used.
int | lastRefresh () const
| If rhsOffset used this is iteration last refreshed.
int | refreshFrequency () const
| If rhsOffset used this is refresh frequency (0==off).
void | setRefreshFrequency (int value)
| Subset clone (without gaps).
bool | skipDualCheck () const
| whether to skip dual checks most of time
void | setSkipDualCheck (bool yes)
| Subset clone (without gaps).
int | minimumObjectsScan () const
| Partial pricing tuning parameter - minimum number of "objects" to scan.
void | setMinimumObjectsScan (int value)
| Subset clone (without gaps).
int | minimumGoodReducedCosts () const
| Partial pricing tuning parameter - minimum number of negative reduced costs to get.
void | setMinimumGoodReducedCosts (int value)
| Subset clone (without gaps).
double | startFraction () const
| Current start of search space in matrix (as fraction).
void | setStartFraction (double value)
| Subset clone (without gaps).
double | endFraction () const
| Current end of search space in matrix (as fraction).
void | setEndFraction (double value)
| Subset clone (without gaps).
double | savedBestDj () const
| Current best reduced cost.
void | setSavedBestDj (double value)
| Subset clone (without gaps).
int | originalWanted () const
| Initial number of negative reduced costs wanted.
void | setOriginalWanted (int value)
| Subset clone (without gaps).
int | currentWanted () const
| Current number of negative reduced costs which we still need.
void | setCurrentWanted (int value)
| Subset clone (without gaps).
int | savedBestSequence () const
| Current best sequence.
void | setSavedBestSequence (int value)
| Subset clone (without gaps).
## Protected Attributes
Data members
The data members are protected to allow access for derived classes.
double * | rhsOffset_
| Effective RHS offset if it is being used.
double | startFraction_
| Current start of search space in matrix (as fraction).
double | endFraction_
| Current end of search space in matrix (as fraction).
double | savedBestDj_
| Best reduced cost so far.
int | originalWanted_
| Initial number of negative reduced costs wanted.
int | currentWanted_
| Current number of negative reduced costs which we still need.
int | savedBestSequence_
| Saved best sequence in pricing.
int | type_
| type (may be useful)
int | lastRefresh_
| If rhsOffset used this is iteration last refreshed.
int | refreshFrequency_
| If rhsOffset used this is refresh frequency (0==off).
int | minimumObjectsScan_
| Partial pricing tuning parameter - minimum number of "objects" to scan.
int | minimumGoodReducedCosts_
| Partial pricing tuning parameter - minimum number of negative reduced costs to get.
int | trueSequenceIn_
| True sequence in (i.e. from larger problem).
int | trueSequenceOut_
| True sequence out (i.e. from larger problem).
bool | skipDualCheck_
| whether to skip dual checks most of time
## Constructors, destructor<br>
NOTE: All constructors are protected. There's no need to expose them, after all, this is an abstract class.
virtual | ~ClpMatrixBase ()
| Destructor (has to be public).
| ClpMatrixBase ()
| Default constructor.
| ClpMatrixBase (const ClpMatrixBase &)
| Destructor (has to be public).
ClpMatrixBase & | operator= (const ClpMatrixBase &)
| Destructor (has to be public).

## 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 38 of file ClpMatrixBase.hpp.

## Constructor & Destructor Documentation

ClpMatrixBase::ClpMatrixBase | ( |  | ) | `[protected]`

Default constructor.

virtual ClpMatrixBase::~ClpMatrixBase | ( |  | ) | `[virtual]`

Destructor (has to be public).

ClpMatrixBase::ClpMatrixBase | ( | const ClpMatrixBase & |  | ) | `[protected]`

Destructor (has to be public).

## Member Function Documentation

virtual CoinPackedMatrix* ClpMatrixBase::getPackedMatrix | ( |  | ) | const`[pure virtual]`

Return a complete CoinPackedMatrix.

Implemented in ClpDummyMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix.

virtual bool ClpMatrixBase::isColOrdered | ( |  | ) | const`[pure virtual]`

Whether the packed matrix is column major ordered or not.

Implemented in ClpDummyMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix.

virtual CoinBigIndex ClpMatrixBase::getNumElements | ( |  | ) | const`[pure virtual]`

Number of entries in the packed matrix.

Implemented in ClpDummyMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix.

virtual int ClpMatrixBase::getNumCols | ( |  | ) | const`[pure virtual]`

Number of columns.

Implemented in ClpDummyMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix.

virtual int ClpMatrixBase::getNumRows | ( |  | ) | const`[pure virtual]`

Number of rows.

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.

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.

virtual const CoinBigIndex* ClpMatrixBase::getVectorStarts | ( |  | ) | const`[pure virtual]`

Return a complete CoinPackedMatrix.

Implemented in ClpDummyMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix.

virtual const int* ClpMatrixBase::getVectorLengths | ( |  | ) | const`[pure virtual]`

The lengths of the major-dimension vectors.

Implemented in ClpDummyMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix.

virtual int ClpMatrixBase::getVectorLength | ( | int | index | ) | const`[virtual]`

The length of a single major-dimension vector.

Reimplemented in ClpPackedMatrix.

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.

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.

virtual void ClpMatrixBase::appendCols | ( | int | number,
|  | const CoinPackedVectorBase *const * | columns |
| ) |  |  | `[virtual]`

Append Columns.

Reimplemented in ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix.

virtual void ClpMatrixBase::appendRows | ( | int | number,
|  | const CoinPackedVectorBase *const * | rows |
| ) |  |  | `[virtual]`

Append Rows.

Reimplemented in ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix.

virtual void ClpMatrixBase::modifyCoefficient | ( | int | row,
|  | int | column,
|  | double | newElement,
|  | bool | keepZero = `false` |
| ) |  |  | `[virtual]`

Modify one element of packed matrix.

An element may be added. This works for either ordering If the new element is zero it will be deleted unless keepZero true

Reimplemented in ClpPackedMatrix.

virtual int ClpMatrixBase::appendMatrix | ( | int | number,
|  | int | type,
|  | const CoinBigIndex * | starts,
|  | const int * | index,
|  | const double * | element,
|  | int | numberOther = `-1` |
| ) |  |  | `[virtual]`

Append a set of rows/columns to the end of the matrix.

Returns number of errors i.e. if any of the new rows/columns contain an index that's larger than the number of columns-1/rows-1 (if numberOther>0) or duplicates If 0 then rows, 1 if columns

Reimplemented in ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix.

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, ClpGubMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix.

Definition at line 96 of file ClpMatrixBase.hpp.

virtual CoinBigIndex ClpMatrixBase::countBasis | ( | const int * | whichColumn,
|  | int & | numberColumnBasic |
| ) |  |  | `[pure virtual]`

Returns number of elements in column part of basis.

Implemented in ClpDummyMatrix, ClpGubMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix.

virtual void ClpMatrixBase::fillBasis | ( | ClpSimplex * | model,
|  | const int * | whichColumn,
|  | int & | numberColumnBasic,
|  | int * | row,
|  | int * | start,
|  | int * | rowCount,
|  | int * | columnCount,
|  | CoinFactorizationDouble * | element |
| ) |  |  | `[pure virtual]`

Fills in column part of basis.

Implemented in ClpDummyMatrix, ClpGubMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix.

virtual int ClpMatrixBase::scale | ( | ClpModel * | ,
|  | const ClpSimplex * | = `NULL` |
| ) |  |  | 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 113 of file ClpMatrixBase.hpp.

virtual void ClpMatrixBase::scaleRowCopy | ( | ClpModel * |  | ) | const`[inline, virtual]`

Scales rowCopy if column copy scaled Only called if scales already exist.

Reimplemented in ClpPackedMatrix.

Definition at line 118 of file ClpMatrixBase.hpp.

virtual bool ClpMatrixBase::canGetRowCopy | ( |  | ) | const`[inline, virtual]`

Returns true if can create row copy.

Definition at line 120 of file ClpMatrixBase.hpp.

virtual ClpMatrixBase* ClpMatrixBase::scaledColumnCopy | ( | ClpModel * |  | ) | const`[inline, virtual]`

Realy really scales column copy Only called if scales already exist.

Up to user to delete

Reimplemented in ClpPackedMatrix.

Definition at line 126 of file ClpMatrixBase.hpp.

virtual bool ClpMatrixBase::allElementsInRange | ( | ClpModel * | ,
|  | double | ,
|  | double | ,
|  | int | = `15` |
| ) |  |  | `[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. check bits (can be turned off to save time) : 1 - check if matrix has gaps 2 - check if zero elements 4 - check and compress duplicates 8 - report on large and small

Reimplemented in ClpPackedMatrix.

Definition at line 140 of file ClpMatrixBase.hpp.

virtual void ClpMatrixBase::setDimensions | ( | int | numrows,
|  | int | numcols |
| ) |  |  | `[virtual]`

Set the dimensions of the matrix.

In effect, append new empty columns/rows to the matrix. A negative number for either dimension means that that dimension doesn't change. Otherwise the new dimensions MUST be at least as large as the current ones otherwise an exception is thrown.

Reimplemented in ClpPackedMatrix, and ClpPlusMinusOneMatrix.

virtual 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.

virtual void ClpMatrixBase::unpack | ( | const ClpSimplex * | model,
|  | CoinIndexedVector * | rowArray,
|  | int | column |
| ) |  |  | const`[pure virtual]`

Unpacks a column into an CoinIndexedvector.

Implemented in ClpDummyMatrix, ClpGubMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix.

virtual void ClpMatrixBase::unpackPacked | ( | ClpSimplex * | model,
|  | CoinIndexedVector * | rowArray,
|  | int | column |
| ) |  |  | const`[pure virtual]`

Unpacks a column into an CoinIndexedvector in packed format Note that model is NOT const.

Bounds and objective could be modified if doing column generation (just for this variable)

Implemented in ClpDummyMatrix, ClpGubMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix.

virtual int ClpMatrixBase::refresh | ( | ClpSimplex * |  | ) | `[inline, virtual]`

Purely for column generation and similar ideas.

Allows matrix and any bounds or costs to be updated (sensibly). Returns non-zero if any changes.

Reimplemented in ClpDynamicMatrix, and ClpPackedMatrix.

Definition at line 172 of file ClpMatrixBase.hpp.

virtual void ClpMatrixBase::reallyScale | ( | const double * | rowScale,
|  | const double * | columnScale |
| ) |  |  | `[virtual]`

Return a complete CoinPackedMatrix.

Reimplemented in ClpPackedMatrix.

virtual 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.

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, ClpGubMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix.

virtual void ClpMatrixBase::add | ( | const ClpSimplex * | model,
|  | double * | array,
|  | int | column,
|  | double | multiplier |
| ) |  |  | const`[pure virtual]`

Adds multiple of a column into an array.

Implemented in ClpDummyMatrix, ClpGubMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix.

virtual void ClpMatrixBase::releasePackedMatrix | ( |  | ) | const`[pure virtual]`

Allow any parts of a created CoinPackedMatrix to be deleted.

Implemented in ClpDummyMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix.

virtual bool ClpMatrixBase::canDoPartialPricing | ( |  | ) | const`[virtual]`

Says whether it can do partial pricing.

Reimplemented in ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix.

virtual int ClpMatrixBase::hiddenRows | ( |  | ) | const`[virtual]`

Returns number of hidden rows e.g. gub.

Reimplemented in ClpGubMatrix.

virtual void ClpMatrixBase::partialPricing | ( | ClpSimplex * | model,
|  | double | start,
|  | double | end,
|  | int & | bestSequence,
|  | int & | numberWanted |
| ) |  |  | `[virtual]`

Partial pricing.

Reimplemented in ClpDynamicExampleMatrix, ClpDynamicMatrix, ClpGubDynamicMatrix, ClpGubMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix.

virtual int ClpMatrixBase::extendUpdated | ( | ClpSimplex * | model,
|  | CoinIndexedVector * | update,
|  | int | mode |
| ) |  |  | `[virtual]`

expands an updated column to allow for extra rows which the main solver does not know about and returns number added.

This will normally be a no-op - it is in for GUB but may get extended to general non-overlapping and embedded networks.

mode 0 - extend mode 1 - delete etc

Reimplemented in ClpGubMatrix.

virtual void ClpMatrixBase::primalExpanded | ( | ClpSimplex * | model,
|  | int | mode |
| ) |  |  | `[virtual]`

utility primal function for dealing with dynamic constraints mode=0 - Set up before "update" and "times" for primal solution using extended rows mode=1 - Cleanup primal solution after "times" using extended rows.

mode=2 - Check (or report on) primal infeasibilities

Reimplemented in ClpGubMatrix.

virtual void ClpMatrixBase::dualExpanded | ( | ClpSimplex * | model,
|  | CoinIndexedVector * | array,
|  | double * | other,
|  | int | mode |
| ) |  |  | `[virtual]`

utility dual function for dealing with dynamic constraints mode=0 - Set up before "updateTranspose" and "transposeTimes" for duals using extended updates array (and may use other if dual values pass) mode=1 - Update dual solution after "transposeTimes" using extended rows.

mode=2 - Compute all djs and compute key dual infeasibilities mode=3 - Report on key dual infeasibilities mode=4 - Modify before updateTranspose in partial pricing

Reimplemented in ClpDynamicMatrix, and ClpGubMatrix.

virtual int ClpMatrixBase::generalExpanded | ( | ClpSimplex * | model,
|  | int | mode,
|  | int & | number |
| ) |  |  | `[virtual]`

general utility function for dealing with dynamic constraints mode=0 - Create list of non-key basics in pivotVariable_ using number as numberBasic in and out mode=1 - Set all key variables as basic mode=2 - return number extra rows needed, number gives maximum number basic mode=3 - before replaceColumn mode=4 - return 1 if can do primal, 2 if dual, 3 if both mode=5 - save any status stuff (when in good state) mode=6 - restore status stuff mode=7 - flag given variable (normally sequenceIn) mode=8 - unflag all variables mode=9 - synchronize costs and bounds mode=10 - return 1 if there may be changing bounds on variable (column generation) mode=11 - make sure set is clean (used when a variable rejected - but not flagged) mode=12 - after factorize but before permute stuff mode=13 - at end of simplex to delete stuff

Reimplemented in ClpDynamicMatrix, and ClpGubMatrix.

virtual int ClpMatrixBase::updatePivot | ( | ClpSimplex * | model,
|  | double | oldInValue,
|  | double | oldOutValue |
| ) |  |  | `[virtual]`

update information for a pivot (and effective rhs)

Reimplemented in ClpDynamicMatrix, ClpGubDynamicMatrix, and ClpGubMatrix.

virtual void ClpMatrixBase::createVariable | ( | ClpSimplex * | model,
|  | int & | bestSequence |
| ) |  |  | `[virtual]`

Creates a variable.

This is called after partial pricing and may modify matrix. May update bestSequence.

Reimplemented in ClpDynamicExampleMatrix, and ClpDynamicMatrix.

virtual int ClpMatrixBase::checkFeasible | ( | ClpSimplex * | model,
|  | double & | sum |
| ) |  |  | const`[virtual]`

Just for debug if odd type matrix.

Returns number of primal infeasibilities.

Reimplemented in ClpGubDynamicMatrix.

double ClpMatrixBase::reducedCost | ( | ClpSimplex * | model,
|  | int | sequence |
| ) |  |  | const

Returns reduced cost of a variable.

Reimplemented in ClpDynamicMatrix.

virtual void ClpMatrixBase::correctSequence | ( | const ClpSimplex * | model,
|  | int & | sequenceIn,
|  | int & | sequenceOut |
| ) |  |  | `[virtual]`

Correct sequence in and out to give true value (if both -1 maybe do whole matrix).

Reimplemented in ClpGubMatrix, and ClpPackedMatrix.

virtual void ClpMatrixBase::times | ( | double | scalar,
|  | const double *COIN_RESTRICT | x,
|  | double *COIN_RESTRICT | y |
| ) |  |  | const`[pure virtual]`

Return `y + A * x * scalar` in `y`.

Precondition:
  `x` must be of size `numColumns()`
  `y` must be of size `numRows()`

virtual void ClpMatrixBase::times | ( | double | scalar,
|  | const double *COIN_RESTRICT | x,
|  | double *COIN_RESTRICT | y,
|  | const double *COIN_RESTRICT | rowScale,
|  | const double *COIN_RESTRICT | columnScale |
| ) |  |  | const`[virtual]`

And for scaling - default aborts for when scaling not supported (unless pointers NULL when as normal).

virtual void ClpMatrixBase::transposeTimes | ( | double | scalar,
|  | const double *COIN_RESTRICT | x,
|  | double *COIN_RESTRICT | y |
| ) |  |  | const`[pure virtual]`

Return `y + x * scalar * A` in `y`.

Precondition:
  `x` must be of size `numRows()`
  `y` must be of size `numColumns()`

virtual void ClpMatrixBase::transposeTimes | ( | double | scalar,
|  | const double *COIN_RESTRICT | x,
|  | double *COIN_RESTRICT | y,
|  | const double *COIN_RESTRICT | rowScale,
|  | const double *COIN_RESTRICT | columnScale,
|  | double *COIN_RESTRICT | spare = `NULL` |
| ) |  |  | const`[virtual]`

And for scaling - default aborts for when scaling not supported (unless pointers NULL when as normal).

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, ClpGubMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix.

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

Implemented in ClpDummyMatrix, ClpGubMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix.

virtual bool ClpMatrixBase::canCombine | ( | const ClpSimplex * | ,
|  | const CoinIndexedVector * |  |
| ) |  |  | const`[inline, virtual]`

Returns true if can combine transposeTimes and subsetTransposeTimes and if it would be faster.

Reimplemented in ClpPackedMatrix, and ClpPlusMinusOneMatrix.

Definition at line 320 of file ClpMatrixBase.hpp.

virtual void ClpMatrixBase::transposeTimes2 | ( | const ClpSimplex * | model,
|  | const CoinIndexedVector * | pi1,
|  | CoinIndexedVector * | dj1,
|  | const CoinIndexedVector * | pi2,
|  | CoinIndexedVector * | spare,
|  | double | referenceIn,
|  | double | devex,
|  | unsigned int * | reference,
|  | double * | weights,
|  | double | scaleFactor |
| ) |  |  | `[virtual]`

Updates two arrays for steepest and does devex weights (need not be coded).

Reimplemented in ClpPackedMatrix, and ClpPlusMinusOneMatrix.

virtual void ClpMatrixBase::subsetTimes2 | ( | const ClpSimplex * | model,
|  | CoinIndexedVector * | dj1,
|  | const CoinIndexedVector * | pi2,
|  | CoinIndexedVector * | dj2,
|  | double | referenceIn,
|  | double | devex,
|  | unsigned int * | reference,
|  | double * | weights,
|  | double | scaleFactor |
| ) |  |  | `[virtual]`

Updates second array for steepest and does devex weights (need not be coded).

Reimplemented in ClpPackedMatrix, and ClpPlusMinusOneMatrix.

virtual void ClpMatrixBase::listTransposeTimes | ( | const ClpSimplex * | model,
|  | double * | x,
|  | int * | y,
|  | int | number,
|  | double * | z |
| ) |  |  | const`[virtual]`

Return `x *A` in `z` but just for number indices in y.

Default cheats with fake CoinIndexedVector and then calls subsetTransposeTimes

virtual ClpMatrixBase* ClpMatrixBase::clone | ( |  | ) | const`[pure 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

Implemented in ClpDummyMatrix, ClpDynamicExampleMatrix, ClpDynamicMatrix, ClpGubDynamicMatrix, ClpGubMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix.

virtual 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 ClpGubMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix.

virtual void ClpMatrixBase::backToBasics | ( |  | ) | `[inline, virtual]`

Gets rid of any mutable by products.

Definition at line 363 of file ClpMatrixBase.hpp.

int ClpMatrixBase::type | ( |  | ) | const`[inline]`

Returns type.

The types which code may need to know about are: 1 - ClpPackedMatrix 11 - ClpNetworkMatrix 12 - ClpPlusMinusOneMatrix

Definition at line 370 of file ClpMatrixBase.hpp.

void ClpMatrixBase::setType | ( | int | newtype | ) | `[inline]`

Sets type.

Definition at line 374 of file ClpMatrixBase.hpp.

void ClpMatrixBase::useEffectiveRhs | ( | ClpSimplex * | model | ) |

Sets up an effective RHS.

Reimplemented in ClpPackedMatrix.

virtual double* ClpMatrixBase::rhsOffset | ( | ClpSimplex * | model,
|  | bool | forceRefresh = `false`,
|  | bool | check = `false` |
| ) |  |  | `[virtual]`

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

Reimplemented in ClpDynamicMatrix, ClpGubDynamicMatrix, and ClpGubMatrix.

int ClpMatrixBase::lastRefresh | ( |  | ) | const`[inline]`

If rhsOffset used this is iteration last refreshed.

Definition at line 385 of file ClpMatrixBase.hpp.

int ClpMatrixBase::refreshFrequency | ( |  | ) | const`[inline]`

If rhsOffset used this is refresh frequency (0==off).

Definition at line 389 of file ClpMatrixBase.hpp.

void ClpMatrixBase::setRefreshFrequency | ( | int | value | ) | `[inline]`

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

Definition at line 392 of file ClpMatrixBase.hpp.

bool ClpMatrixBase::skipDualCheck | ( |  | ) | const`[inline]`

whether to skip dual checks most of time

Definition at line 396 of file ClpMatrixBase.hpp.

void ClpMatrixBase::setSkipDualCheck | ( | bool | yes | ) | `[inline]`

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

Definition at line 399 of file ClpMatrixBase.hpp.

int ClpMatrixBase::minimumObjectsScan | ( |  | ) | const`[inline]`

Partial pricing tuning parameter - minimum number of "objects" to scan.

e.g. number of Gub sets but could be number of variables

Definition at line 404 of file ClpMatrixBase.hpp.

void ClpMatrixBase::setMinimumObjectsScan | ( | int | value | ) | `[inline]`

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

Definition at line 407 of file ClpMatrixBase.hpp.

int ClpMatrixBase::minimumGoodReducedCosts | ( |  | ) | const`[inline]`

Partial pricing tuning parameter - minimum number of negative reduced costs to get.

Definition at line 411 of file ClpMatrixBase.hpp.

void ClpMatrixBase::setMinimumGoodReducedCosts | ( | int | value | ) | `[inline]`

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

Definition at line 414 of file ClpMatrixBase.hpp.

double ClpMatrixBase::startFraction | ( |  | ) | const`[inline]`

Current start of search space in matrix (as fraction).

Definition at line 418 of file ClpMatrixBase.hpp.

void ClpMatrixBase::setStartFraction | ( | double | value | ) | `[inline]`

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

Definition at line 421 of file ClpMatrixBase.hpp.

double ClpMatrixBase::endFraction | ( |  | ) | const`[inline]`

Current end of search space in matrix (as fraction).

Definition at line 425 of file ClpMatrixBase.hpp.

void ClpMatrixBase::setEndFraction | ( | double | value | ) | `[inline]`

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

Definition at line 428 of file ClpMatrixBase.hpp.

double ClpMatrixBase::savedBestDj | ( |  | ) | const`[inline]`

Current best reduced cost.

Definition at line 432 of file ClpMatrixBase.hpp.

void ClpMatrixBase::setSavedBestDj | ( | double | value | ) | `[inline]`

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

Definition at line 435 of file ClpMatrixBase.hpp.

int ClpMatrixBase::originalWanted | ( |  | ) | const`[inline]`

Initial number of negative reduced costs wanted.

Definition at line 439 of file ClpMatrixBase.hpp.

void ClpMatrixBase::setOriginalWanted | ( | int | value | ) | `[inline]`

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

Definition at line 442 of file ClpMatrixBase.hpp.

int ClpMatrixBase::currentWanted | ( |  | ) | const`[inline]`

Current number of negative reduced costs which we still need.

Definition at line 446 of file ClpMatrixBase.hpp.

void ClpMatrixBase::setCurrentWanted | ( | int | value | ) | `[inline]`

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

Definition at line 449 of file ClpMatrixBase.hpp.

int ClpMatrixBase::savedBestSequence | ( |  | ) | const`[inline]`

Current best sequence.

Definition at line 453 of file ClpMatrixBase.hpp.

void ClpMatrixBase::setSavedBestSequence | ( | int | value | ) | `[inline]`

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

Definition at line 456 of file ClpMatrixBase.hpp.

ClpMatrixBase& ClpMatrixBase::operator= | ( | const ClpMatrixBase & |  | ) | `[protected]`

Destructor (has to be public).

Reimplemented in ClpDummyMatrix, ClpDynamicExampleMatrix, ClpDynamicMatrix, ClpGubDynamicMatrix, ClpGubMatrix, ClpNetworkMatrix, ClpPackedMatrix, and ClpPlusMinusOneMatrix.

## Member Data Documentation

double* ClpMatrixBase::rhsOffset_`[protected]`

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

Definition at line 488 of file ClpMatrixBase.hpp.

double ClpMatrixBase::startFraction_`[protected]`

Current start of search space in matrix (as fraction).

Definition at line 490 of file ClpMatrixBase.hpp.

double ClpMatrixBase::endFraction_`[protected]`

Current end of search space in matrix (as fraction).

Definition at line 492 of file ClpMatrixBase.hpp.

double ClpMatrixBase::savedBestDj_`[protected]`

Best reduced cost so far.

Definition at line 494 of file ClpMatrixBase.hpp.

int ClpMatrixBase::originalWanted_`[protected]`

Initial number of negative reduced costs wanted.

Definition at line 496 of file ClpMatrixBase.hpp.

int ClpMatrixBase::currentWanted_`[protected]`

Current number of negative reduced costs which we still need.

Definition at line 498 of file ClpMatrixBase.hpp.

int ClpMatrixBase::savedBestSequence_`[protected]`

Saved best sequence in pricing.

Definition at line 500 of file ClpMatrixBase.hpp.

int ClpMatrixBase::type_`[protected]`

type (may be useful)

Definition at line 502 of file ClpMatrixBase.hpp.

int ClpMatrixBase::lastRefresh_`[protected]`

If rhsOffset used this is iteration last refreshed.

Definition at line 504 of file ClpMatrixBase.hpp.

int ClpMatrixBase::refreshFrequency_`[protected]`

If rhsOffset used this is refresh frequency (0==off).

Definition at line 506 of file ClpMatrixBase.hpp.

int ClpMatrixBase::minimumObjectsScan_`[protected]`

Partial pricing tuning parameter - minimum number of "objects" to scan.

Definition at line 508 of file ClpMatrixBase.hpp.

int ClpMatrixBase::minimumGoodReducedCosts_`[protected]`

Partial pricing tuning parameter - minimum number of negative reduced costs to get.

Definition at line 510 of file ClpMatrixBase.hpp.

int ClpMatrixBase::trueSequenceIn_`[protected]`

True sequence in (i.e. from larger problem).

Definition at line 512 of file ClpMatrixBase.hpp.

int ClpMatrixBase::trueSequenceOut_`[protected]`

True sequence out (i.e. from larger problem).

Definition at line 514 of file ClpMatrixBase.hpp.

bool ClpMatrixBase::skipDualCheck_`[protected]`

whether to skip dual checks most of time

Definition at line 516 of file ClpMatrixBase.hpp.

The documentation for this class was generated from the following file:

- /home/coin/svn-release/Alps-1.5.0/Clp/src/ClpMatrixBase.hpp