6 #ifndef ClpMatrixBase_H 7 #define ClpMatrixBase_H 9 #include "CoinPragma.hpp" 10 #include "CoinTypes.hpp" 12 #include "CoinPackedMatrix.hpp" 13 class CoinIndexedVector;
64 virtual void deleteCols(
const int numDel,
const int * indDel) = 0;
66 virtual void deleteRows(
const int numDel,
const int * indDel) = 0;
68 virtual void appendCols(
int number,
const CoinPackedVectorBase *
const * columns);
71 virtual void appendRows(
int number,
const CoinPackedVectorBase *
const * rows);
77 bool keepZero =
false);
83 const CoinBigIndex * starts,
const int * index,
84 const double * element,
int numberOther = -1);
93 virtual CoinBigIndex
countBasis(
const int * whichColumn,
94 int & numberColumnBasic) = 0;
97 const int * whichColumn,
98 int & numberColumnBasic,
99 int * row,
int * start,
100 int * rowCount,
int * columnCount,
101 CoinFactorizationDouble * element) = 0;
119 return this->
clone();
146 virtual void rangeOfElements(
double & smallestNegative,
double & largestNegative,
147 double & smallestPositive,
double & largestPositive);
152 int column)
const = 0;
158 CoinIndexedVector * rowArray,
159 int column)
const = 0;
169 virtual void reallyScale(
const double * rowScale,
const double * columnScale);
178 virtual void add(
const ClpSimplex * model, CoinIndexedVector * rowArray,
179 int column,
double multiplier)
const = 0;
182 int column,
double multiplier)
const = 0;
191 int & bestSequence,
int & numberWanted);
219 double * other,
int mode);
265 virtual void times(
double scalar,
266 const double * x,
double * y)
const = 0;
270 virtual void times(
double scalar,
271 const double * x,
double * y,
272 const double * rowScale,
273 const double * columnScale)
const;
278 const double * x,
double * y)
const = 0;
283 const double * x,
double * y,
284 const double * rowScale,
285 const double * columnScale,
286 double * spare = NULL)
const;
289 virtual void times(CoinWorkDouble scalar,
290 const CoinWorkDouble * x, CoinWorkDouble * y)
const ;
292 const CoinWorkDouble * x, CoinWorkDouble * y)
const ;
299 const CoinIndexedVector * x,
300 CoinIndexedVector * y,
301 CoinIndexedVector * z)
const = 0;
307 const CoinIndexedVector * x,
308 const CoinIndexedVector * y,
309 CoinIndexedVector * z)
const = 0;
313 const CoinIndexedVector * )
const {
318 const CoinIndexedVector * pi1, CoinIndexedVector * dj1,
319 const CoinIndexedVector * pi2,
320 CoinIndexedVector * spare,
321 double referenceIn,
double devex,
323 unsigned int * reference,
324 double * weights,
double scaleFactor);
327 CoinIndexedVector * dj1,
328 const CoinIndexedVector * pi2, CoinIndexedVector * dj2,
329 double referenceIn,
double devex,
331 unsigned int * reference,
332 double * weights,
double scaleFactor);
352 int numberRows,
const int * whichRows,
353 int numberColumns,
const int * whichColumns)
const;
512 #define FREE_BIAS 1.0e1 514 #define FREE_ACCEPT 1.0e2 virtual const double * getElements() const =0
A vector containing the elements in the packed matrix.
int lastRefresh() const
If rhsOffset used this is iteration last refreshed.
virtual void appendRows(int number, const CoinPackedVectorBase *const *rows)
Append Rows.
void setCurrentWanted(int value)
virtual void scaleRowCopy(ClpModel *) const
Scales rowCopy if column copy scaled Only called if scales already exist.
virtual const CoinBigIndex * getVectorStarts() const =0
virtual void rangeOfElements(double &smallestNegative, double &largestNegative, double &smallestPositive, double &largestPositive)
Returns largest and smallest elements of both signs.
virtual int getNumRows() const =0
Number of rows.
virtual bool isColOrdered() const =0
Whether the packed matrix is column major ordered or not.
Abstract base class for Clp Matrices.
virtual void deleteRows(const int numDel, const int *indDel)=0
Delete the rows whose indices are listed in indDel.
virtual bool canDoPartialPricing() const
Says whether it can do partial pricing.
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" a...
virtual void appendCols(int number, const CoinPackedVectorBase *const *columns)
Append Columns.
virtual int hiddenRows() const
Returns number of hidden rows e.g. gub.
int savedBestSequence() const
Current best sequence.
virtual int getNumCols() const =0
Number of columns.
virtual int getVectorLength(int index) const
The length of a single major-dimension vector.
virtual CoinBigIndex countBasis(const int *whichColumn, int &numberColumnBasic)=0
Returns number of elements in column part of basis.
void setRefreshFrequency(int value)
virtual int scale(ClpModel *, const ClpSimplex *=NULL) const
Creates scales for column copy (rowCopy in model may be modified) default does not allow scaling retu...
double * rhsOffset_
Effective RHS offset if it is being used.
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 ...
void setSavedBestSequence(int value)
int savedBestSequence_
Saved best sequence in pricing.
virtual bool canGetRowCopy() const
Returns true if can create row copy.
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 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)
int currentWanted_
Current number of negative reduced costs which we still need.
virtual ~ClpMatrixBase()
Destructor (has to be public)
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 CoinPackedMatrix * getPackedMatrix() const =0
Return a complete CoinPackedMatrix.
virtual void unpack(const ClpSimplex *model, CoinIndexedVector *rowArray, int column) const =0
Unpacks a column into an CoinIndexedvector.
double reducedCost(ClpSimplex *model, int sequence) const
Returns reduced cost of a variable.
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)
int trueSequenceOut_
True sequence out (i.e. from larger problem)
void setMinimumObjectsScan(int value)
void setOriginalWanted(int value)
virtual bool allElementsInRange(ClpModel *, double, double, int=15)
Checks if all elements are in valid range.
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...
void setType(int newtype)
Sets type.
This solves LPs using the simplex method.
virtual ClpMatrixBase * scaledColumnCopy(ClpModel *) const
Realy really scales column copy Only called if scales already exist.
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) ...
virtual ClpMatrixBase * subsetClone(int numberRows, const int *whichRows, int numberColumns, const int *whichColumns) const
Subset clone (without gaps).
void setStartFraction(double value)
void useEffectiveRhs(ClpSimplex *model)
Sets up an effective RHS.
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 int refresh(ClpSimplex *)
Purely for column generation and similar ideas.
virtual bool canCombine(const ClpSimplex *, const CoinIndexedVector *) const
Returns true if can combine transposeTimes and subsetTransposeTimes and if it would be faster...
virtual void setDimensions(int numrows, int numcols)
Set the dimensions of the matrix.
ClpMatrixBase()
Default constructor.
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)...
int originalWanted() const
Initial number of negative reduced costs wanted.
int currentWanted() const
Current number of negative reduced costs which we still need.
int refreshFrequency_
If rhsOffset used this is refresh frequency (0==off)
virtual ClpMatrixBase * reverseOrderedCopy() const
Returns a new matrix in reverse order without gaps Is allowed to return NULL if doesn't want to have ...
virtual void reallyScale(const double *rowScale, const double *columnScale)
virtual int checkFeasible(ClpSimplex *model, double &sum) const
Just for debug if odd type matrix.
int lastRefresh_
If rhsOffset used this is iteration last refreshed.
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.
int minimumObjectsScan() const
Partial pricing tuning parameter - minimum number of "objects" to scan.
virtual void times(double scalar, const double *x, double *y) const =0
Return y + A * x * scalar in y.
virtual CoinBigIndex getNumElements() const =0
Number of entries in the packed matrix.
bool skipDualCheck_
whether to skip dual checks most of time
virtual double * rhsOffset(ClpSimplex *model, bool forceRefresh=false, bool check=false)
Returns effective RHS offset if it is being used.
int minimumGoodReducedCosts() const
Partial pricing tuning parameter - minimum number of negative reduced costs to get.
int type() const
Returns type.
double savedBestDj() const
Current best reduced cost.
double startFraction() const
Current start of search space in matrix (as fraction)
ClpMatrixBase & operator=(const ClpMatrixBase &)
virtual ClpMatrixBase * clone() const =0
void setSavedBestDj(double value)
virtual void transposeTimes(double scalar, const double *x, double *y) const =0
Return y + x * scalar * A in y.
int minimumObjectsScan_
Partial pricing tuning parameter - minimum number of "objects" to scan.
virtual const int * getIndices() const =0
A vector containing the minor indices of the elements in the packed matrix.
virtual void backToBasics()
Gets rid of any mutable by products.
int originalWanted_
Initial number of negative reduced costs wanted.
int refreshFrequency() const
If rhsOffset used this is refresh frequency (0==off)
bool skipDualCheck() const
whether to skip dual checks most of time
int trueSequenceIn_
True sequence in (i.e. from larger problem)
virtual const int * getVectorLengths() const =0
The lengths of the major-dimension vectors.
int type_
type (may be useful)
double startFraction_
Current start of search space in matrix (as fraction)
virtual void releasePackedMatrix() const =0
Allow any parts of a created CoinPackedMatrix to be deleted.
virtual void primalExpanded(ClpSimplex *model, int mode)
utility primal function for dealing with dynamic constraints mode=0 - Set up before "update" and "tim...
virtual int updatePivot(ClpSimplex *model, double oldInValue, double oldOutValue)
update information for a pivot (and effective rhs)
void setSkipDualCheck(bool yes)
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 retur...
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.
virtual void createVariable(ClpSimplex *model, int &bestSequence)
Creates a variable.
double endFraction() const
Current end of search space in matrix (as fraction)
virtual void modifyCoefficient(int row, int column, double newElement, bool keepZero=false)
Modify one element of packed matrix.
virtual void deleteCols(const int numDel, const int *indDel)=0
Delete the columns whose indices are listed in indDel.
int minimumGoodReducedCosts_
Partial pricing tuning parameter - minimum number of negative reduced costs to get.
void setEndFraction(double value)
double endFraction_
Current end of search space in matrix (as fraction)
double savedBestDj_
Best reduced cost so far.
void setMinimumGoodReducedCosts(int value)