Loading...
Searching...
No Matches
ClpGubMatrix.hpp
Go to the documentation of this file.
/* $Id$ */
// Copyright (C) 2003, International Business Machines
// Corporation and others. All Rights Reserved.
// This code is licensed under the terms of the Eclipse Public License (EPL).
#ifndef ClpGubMatrix_H
#define ClpGubMatrix_H
#include "CoinPragma.hpp"
#include "ClpPackedMatrix.hpp"
class ClpSimplex;
class ClpGubMatrix : public ClpPackedMatrix {
public:
virtual ClpMatrixBase *reverseOrderedCopy() const;
virtual int countBasis(const int *whichColumn,
int &numberColumnBasic);
virtual void fillBasis(ClpSimplex *model,
const int *whichColumn,
int &numberColumnBasic,
int *row, int *start,
int *rowCount, int *columnCount,
CoinFactorizationDouble *element);
virtual void unpack(const ClpSimplex *model, CoinIndexedVector *rowArray,
int column) const;
virtual void unpackPacked(ClpSimplex *model,
CoinIndexedVector *rowArray,
int column) const;
virtual void add(const ClpSimplex *model, CoinIndexedVector *rowArray,
int column, double multiplier) const;
virtual void add(const ClpSimplex *model, double *array,
int column, double multiplier) const;
virtual void partialPricing(ClpSimplex *model, double start, double end,
int &bestSequence, int &numberWanted);
virtual int hiddenRows() const;
using ClpPackedMatrix::transposeTimes;
virtual void transposeTimes(const ClpSimplex *model, double scalar,
const CoinIndexedVector *x,
CoinIndexedVector *y,
CoinIndexedVector *z) const;
virtual void transposeTimesByRow(const ClpSimplex *model, double scalar,
const CoinIndexedVector *x,
CoinIndexedVector *y,
CoinIndexedVector *z) const;
virtual void subsetTransposeTimes(const ClpSimplex *model,
const CoinIndexedVector *x,
const CoinIndexedVector *y,
CoinIndexedVector *z) const;
virtual int extendUpdated(ClpSimplex *model, CoinIndexedVector *update, int mode);
virtual void primalExpanded(ClpSimplex *model, int mode);
virtual void dualExpanded(ClpSimplex *model, CoinIndexedVector *array,
double *other, int mode);
virtual int generalExpanded(ClpSimplex *model, int mode, int &number);
virtual int updatePivot(ClpSimplex *model, double oldInValue, double oldOutValue);
virtual void useEffectiveRhs(ClpSimplex *model, bool cheapest = true);
virtual double *rhsOffset(ClpSimplex *model, bool forceRefresh = false,
bool check = false);
virtual int synchronize(ClpSimplex *model, int mode);
virtual void correctSequence(const ClpSimplex *model, int &sequenceIn, int &sequenceOut);
ClpGubMatrix();
virtual ~ClpGubMatrix();
ClpGubMatrix(const ClpGubMatrix &);
ClpGubMatrix(const CoinPackedMatrix &);
ClpGubMatrix(const ClpGubMatrix &wholeModel,
int numberRows, const int *whichRows,
int numberColumns, const int *whichColumns);
ClpGubMatrix(const CoinPackedMatrix &wholeModel,
int numberRows, const int *whichRows,
int numberColumns, const int *whichColumns);
ClpGubMatrix(CoinPackedMatrix *matrix);
ClpGubMatrix(ClpPackedMatrix *matrix, int numberSets,
const int *start, const int *end,
const double *lower, const double *upper,
const unsigned char *status = NULL);
ClpGubMatrix &operator=(const ClpGubMatrix &);
virtual ClpMatrixBase *clone() const;
virtual ClpMatrixBase *subsetClone(
int numberRows, const int *whichRows,
int numberColumns, const int *whichColumns) const;
void redoSet(ClpSimplex *model, int newKey, int oldKey, int iSet);
inline ClpSimplex::Status getStatus(int sequence) const
{
return static_cast< ClpSimplex::Status >(status_[sequence] & 7);
}
inline void setStatus(int sequence, ClpSimplex::Status status)
{
unsigned char &st_byte = status_[sequence];
st_byte = static_cast< unsigned char >(st_byte & ~7);
st_byte = static_cast< unsigned char >(st_byte | status);
}
inline void setFlagged(int sequence)
{
status_[sequence] = static_cast< unsigned char >(status_[sequence] | 64);
}
inline void clearFlagged(int sequence)
{
status_[sequence] = static_cast< unsigned char >(status_[sequence] & ~64);
}
inline bool flagged(int sequence) const
{
return ((status_[sequence] & 64) != 0);
}
inline void setAbove(int sequence)
{
unsigned char iStat = status_[sequence];
iStat = static_cast< unsigned char >(iStat & ~24);
status_[sequence] = static_cast< unsigned char >(iStat | 16);
}
inline void setFeasible(int sequence)
{
unsigned char iStat = status_[sequence];
iStat = static_cast< unsigned char >(iStat & ~24);
status_[sequence] = static_cast< unsigned char >(iStat | 8);
}
inline void setBelow(int sequence)
{
unsigned char iStat = status_[sequence];
iStat = static_cast< unsigned char >(iStat & ~24);
status_[sequence] = iStat;
}
inline double weight(int sequence) const
{
int iStat = status_[sequence] & 31;
iStat = iStat >> 3;
return static_cast< double >(iStat - 1);
}
inline int *start() const
{
return start_;
}
inline int *end() const
{
return end_;
}
inline double *lower() const
{
return lower_;
}
inline double *upper() const
{
return upper_;
}
inline int *keyVariable() const
{
return keyVariable_;
}
inline int *backward() const
{
return backward_;
}
inline int numberSets() const
{
return numberSets_;
}
void switchOffCheck();
protected:
double sumDualInfeasibilities_;
double sumPrimalInfeasibilities_;
double sumOfRelaxedDualInfeasibilities_;
double sumOfRelaxedPrimalInfeasibilities_;
double infeasibilityWeight_;
int *start_;
int *end_;
double *lower_;
double *upper_;
mutable unsigned char *status_;
unsigned char *saveStatus_;
int *savedKeyVariable_;
int *backward_;
int *backToPivotRow_;
double *changeCost_;
mutable int *keyVariable_;
mutable int *next_;
int *toIndex_;
// Reverse pointer from index to set
int *fromIndex_;
ClpSimplex *model_;
int numberDualInfeasibilities_;
int numberPrimalInfeasibilities_;
int noCheck_;
int numberSets_;
int saveNumber_;
int possiblePivotKey_;
int gubSlackIn_;
int firstGub_;
int lastGub_;
int gubType_;
};
#endif
/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
*/
ClpPackedMatrix.hpp
ClpGubMatrix::possiblePivotKey_
int possiblePivotKey_
Pivot row of possible next key.
Definition ClpGubMatrix.hpp:357
ClpGubMatrix::dualExpanded
virtual void dualExpanded(ClpSimplex *model, CoinIndexedVector *array, double *other, int mode)
mode=0 - Set up before "updateTranspose" and "transposeTimes" for duals using extended updates array ...
ClpGubMatrix::getStatus
ClpSimplex::Status getStatus(int sequence) const
Status.
Definition ClpGubMatrix.hpp:207
ClpGubMatrix::setAbove
void setAbove(int sequence)
To say key is above ub.
Definition ClpGubMatrix.hpp:231
ClpGubMatrix::clearFlagged
void clearFlagged(int sequence)
Definition ClpGubMatrix.hpp:222
ClpGubMatrix::start
int * start() const
Starts.
Definition ClpGubMatrix.hpp:258
ClpGubMatrix::savedKeyVariable_
int * savedKeyVariable_
Saved key variables.
Definition ClpGubMatrix.hpp:323
ClpGubMatrix::firstGub_
int firstGub_
First gub variables (same as start_[0] at present).
Definition ClpGubMatrix.hpp:361
ClpGubMatrix::noCheck_
int noCheck_
If pricing will declare victory (i.e.
Definition ClpGubMatrix.hpp:351
ClpGubMatrix::lastGub_
int lastGub_
last gub variable (same as end_[numberSets_-1] at present)
Definition ClpGubMatrix.hpp:363
ClpGubMatrix::numberDualInfeasibilities_
int numberDualInfeasibilities_
Number of dual infeasibilities.
Definition ClpGubMatrix.hpp:343
ClpGubMatrix::upper
double * upper() const
Upper bounds on sets.
Definition ClpGubMatrix.hpp:273
ClpGubMatrix::status_
unsigned char * status_
Status of slacks.
Definition ClpGubMatrix.hpp:319
ClpGubMatrix::unpack
virtual void unpack(const ClpSimplex *model, CoinIndexedVector *rowArray, int column) const
Unpacks a column into an CoinIndexedvector.
ClpGubMatrix::setFlagged
void setFlagged(int sequence)
To flag a variable.
Definition ClpGubMatrix.hpp:218
ClpGubMatrix::hiddenRows
virtual int hiddenRows() const
Returns number of hidden rows e.g. gub.
ClpGubMatrix::setBelow
void setBelow(int sequence)
To say key is below lb.
Definition ClpGubMatrix.hpp:245
ClpGubMatrix::countBasis
virtual int countBasis(const int *whichColumn, int &numberColumnBasic)
Returns number of elements in column part of basis.
ClpGubMatrix::reverseOrderedCopy
virtual ClpMatrixBase * reverseOrderedCopy() const
Returns a new matrix in reverse order without gaps (GUB wants NULL).
ClpGubMatrix::partialPricing
virtual void partialPricing(ClpSimplex *model, double start, double end, int &bestSequence, int &numberWanted)
Partial pricing.
ClpGubMatrix::end
int * end() const
End.
Definition ClpGubMatrix.hpp:263
ClpGubMatrix::backward_
int * backward_
Backward pointer to set number.
Definition ClpGubMatrix.hpp:325
ClpGubMatrix::weight
double weight(int sequence) const
Definition ClpGubMatrix.hpp:251
ClpGubMatrix::subsetTransposeTimes
virtual void subsetTransposeTimes(const ClpSimplex *model, const CoinIndexedVector *x, const CoinIndexedVector *y, CoinIndexedVector *z) const
Return x *A in z but just for indices in y.
ClpGubMatrix::correctSequence
virtual void correctSequence(const ClpSimplex *model, int &sequenceIn, int &sequenceOut)
Correct sequence in and out to give true value.
ClpGubMatrix::ClpGubMatrix
ClpGubMatrix(const CoinPackedMatrix &wholeModel, int numberRows, const int *whichRows, int numberColumns, const int *whichColumns)
ClpGubMatrix::unpackPacked
virtual void unpackPacked(ClpSimplex *model, CoinIndexedVector *rowArray, int column) const
Unpacks a column into an CoinIndexedvector in packed foramt Note that model is NOT const.
ClpGubMatrix::generalExpanded
virtual int generalExpanded(ClpSimplex *model, int mode, int &number)
mode=0 - Create list of non-key basics in pivotVariable_ using number as numberBasic in and out mode=...
ClpGubMatrix::next_
int * next_
Next basic variable in set - starts at key and end with -(set+1).
Definition ClpGubMatrix.hpp:335
ClpGubMatrix::ClpGubMatrix
ClpGubMatrix(const CoinPackedMatrix &)
The copy constructor from an CoinPackedMatrix.
ClpGubMatrix::lower
double * lower() const
Lower bounds on sets.
Definition ClpGubMatrix.hpp:268
ClpGubMatrix::ClpGubMatrix
ClpGubMatrix(CoinPackedMatrix *matrix)
This takes over ownership (for space reasons).
ClpGubMatrix::lower_
double * lower_
Lower bounds on sets.
Definition ClpGubMatrix.hpp:315
ClpGubMatrix::sumDualInfeasibilities_
double sumDualInfeasibilities_
Sum of dual infeasibilities.
Definition ClpGubMatrix.hpp:301
ClpGubMatrix::flagged
bool flagged(int sequence) const
Definition ClpGubMatrix.hpp:226
ClpGubMatrix::backward
int * backward() const
Backward pointer to set number.
Definition ClpGubMatrix.hpp:283
ClpGubMatrix::clone
virtual ClpMatrixBase * clone() const
Clone.
ClpGubMatrix::fromIndex_
int * fromIndex_
Definition ClpGubMatrix.hpp:339
ClpGubMatrix::model_
ClpSimplex * model_
Pointer back to model.
Definition ClpGubMatrix.hpp:341
ClpGubMatrix::switchOffCheck
void switchOffCheck()
Switches off dj checking each factorization (for BIG models).
ClpGubMatrix::sumOfRelaxedDualInfeasibilities_
double sumOfRelaxedDualInfeasibilities_
Sum of Dual infeasibilities using tolerance based on error in duals.
Definition ClpGubMatrix.hpp:305
ClpGubMatrix::subsetClone
virtual ClpMatrixBase * subsetClone(int numberRows, const int *whichRows, int numberColumns, const int *whichColumns) const
Subset clone (without gaps).
ClpGubMatrix::ClpGubMatrix
ClpGubMatrix(ClpPackedMatrix *matrix, int numberSets, const int *start, const int *end, const double *lower, const double *upper, const unsigned char *status=NULL)
This takes over ownership (for space reasons) and is the real constructor.
ClpGubMatrix::end_
int * end_
End.
Definition ClpGubMatrix.hpp:313
ClpGubMatrix::upper_
double * upper_
Upper bounds on sets.
Definition ClpGubMatrix.hpp:317
ClpGubMatrix::add
virtual void add(const ClpSimplex *model, double *array, int column, double multiplier) const
Adds multiple of a column into an array.
ClpGubMatrix::changeCost_
double * changeCost_
Change in costs for keys.
Definition ClpGubMatrix.hpp:329
ClpGubMatrix::sumPrimalInfeasibilities_
double sumPrimalInfeasibilities_
Sum of primal infeasibilities.
Definition ClpGubMatrix.hpp:303
ClpGubMatrix::useEffectiveRhs
virtual void useEffectiveRhs(ClpSimplex *model, bool cheapest=true)
Sets up an effective RHS and does gub crash if needed.
ClpGubMatrix::numberSets_
int numberSets_
Number of sets (gub rows).
Definition ClpGubMatrix.hpp:353
ClpGubMatrix::primalExpanded
virtual void primalExpanded(ClpSimplex *model, int mode)
mode=0 - Set up before "update" and "times" for primal solution using extended rows mode=1 - Cleanup ...
ClpGubMatrix::synchronize
virtual int synchronize(ClpSimplex *model, int mode)
This is local to Gub to allow synchronization: mode=0 when status of basis is good mode=1 when variab...
ClpGubMatrix::toIndex_
int * toIndex_
Backward pointer to index in CoinIndexedVector.
Definition ClpGubMatrix.hpp:337
ClpGubMatrix::numberSets
int numberSets() const
Number of sets (gub rows).
Definition ClpGubMatrix.hpp:288
ClpGubMatrix::backToPivotRow_
int * backToPivotRow_
Backward pointer to pivot row !!!
Definition ClpGubMatrix.hpp:327
ClpGubMatrix::transposeTimes
virtual void transposeTimes(const ClpSimplex *model, double scalar, const CoinIndexedVector *x, CoinIndexedVector *y, CoinIndexedVector *z) const
Return x * scalar * A + y in z.
ClpGubMatrix::gubType_
int gubType_
type of gub - 0 not contiguous, 1 contiguous add 8 bit to say no ubs on individual variables
Definition ClpGubMatrix.hpp:366
ClpGubMatrix::operator=
ClpGubMatrix & operator=(const ClpGubMatrix &)
ClpGubMatrix::ClpGubMatrix
ClpGubMatrix(const ClpGubMatrix &wholeModel, int numberRows, const int *whichRows, int numberColumns, const int *whichColumns)
Subset constructor (without gaps).
ClpGubMatrix::sumOfRelaxedPrimalInfeasibilities_
double sumOfRelaxedPrimalInfeasibilities_
Sum of Primal infeasibilities using tolerance based on error in primals.
Definition ClpGubMatrix.hpp:307
ClpGubMatrix::saveStatus_
unsigned char * saveStatus_
Saved status of slacks.
Definition ClpGubMatrix.hpp:321
ClpGubMatrix::infeasibilityWeight_
double infeasibilityWeight_
Infeasibility weight when last full pass done.
Definition ClpGubMatrix.hpp:309
ClpGubMatrix::extendUpdated
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...
ClpGubMatrix::setStatus
void setStatus(int sequence, ClpSimplex::Status status)
Definition ClpGubMatrix.hpp:211
ClpGubMatrix::redoSet
void redoSet(ClpSimplex *model, int newKey, int oldKey, int iSet)
redoes next_ for a set.
ClpGubMatrix::transposeTimesByRow
virtual void transposeTimesByRow(const ClpSimplex *model, double scalar, const CoinIndexedVector *x, CoinIndexedVector *y, CoinIndexedVector *z) const
Return x * scalar * A + y in z.
ClpGubMatrix::updatePivot
virtual int updatePivot(ClpSimplex *model, double oldInValue, double oldOutValue)
update information for a pivot (and effective rhs)
ClpGubMatrix::keyVariable_
int * keyVariable_
Key variable of set.
Definition ClpGubMatrix.hpp:331
ClpGubMatrix::keyVariable
int * keyVariable() const
Key variable of set.
Definition ClpGubMatrix.hpp:278
ClpGubMatrix::gubSlackIn_
int gubSlackIn_
Gub slack in (set number or -1).
Definition ClpGubMatrix.hpp:359
ClpGubMatrix::ClpGubMatrix
ClpGubMatrix(const ClpGubMatrix &)
The copy constructor.
ClpGubMatrix::add
virtual void add(const ClpSimplex *model, CoinIndexedVector *rowArray, int column, double multiplier) const
Adds multiple of a column into an CoinIndexedvector You can use quickAdd to add to vector.
ClpGubMatrix::numberPrimalInfeasibilities_
int numberPrimalInfeasibilities_
Number of primal infeasibilities.
Definition ClpGubMatrix.hpp:345
ClpGubMatrix::fillBasis
virtual void fillBasis(ClpSimplex *model, const int *whichColumn, int &numberColumnBasic, int *row, int *start, int *rowCount, int *columnCount, CoinFactorizationDouble *element)
Fills in column part of basis.
ClpGubMatrix::~ClpGubMatrix
virtual ~ClpGubMatrix()
Destructor.
ClpGubMatrix::saveNumber_
int saveNumber_
Number in vector without gub extension.
Definition ClpGubMatrix.hpp:355
ClpGubMatrix::ClpGubMatrix
ClpGubMatrix()
Default constructor.
ClpGubMatrix::setFeasible
void setFeasible(int sequence)
To say key is feasible.
Definition ClpGubMatrix.hpp:238
ClpGubMatrix::start_
int * start_
Starts.
Definition ClpGubMatrix.hpp:311
ClpGubMatrix::rhsOffset
virtual double * rhsOffset(ClpSimplex *model, bool forceRefresh=false, bool check=false)
Returns effective RHS offset if it is being used.
ClpMatrixBase::ClpMatrixBase
ClpMatrixBase()
Default constructor.
ClpPackedMatrix::ClpPackedMatrix
ClpPackedMatrix()
Default constructor.
ClpPackedMatrix::transposeTimes
virtual void transposeTimes(double scalar, const double *x, double *y) const
Return y + x * scalar * A in y.
ClpPackedMatrix::matrix
CoinPackedMatrix * matrix() const
Returns CoinPackedMatrix (non const).
Definition ClpPackedMatrix.hpp:314
ClpSimplex
This solves LPs using the simplex method.
Definition ClpSimplex.hpp:106
ClpSimplex::Status
Status
enums for status of various sorts.
Definition ClpSimplex.hpp:114