Loading...
Searching...
No Matches
ClpDynamicMatrix.hpp
Go to the documentation of this file.
/* $Id$ */
// Copyright (C) 2004, International Business Machines
// Corporation and others. All Rights Reserved.
// This code is licensed under the terms of the Eclipse Public License (EPL).
#ifndef ClpDynamicMatrix_H
#define ClpDynamicMatrix_H
#include "CoinPragma.hpp"
#include "ClpPackedMatrix.hpp"
class ClpSimplex;
class ClpDynamicMatrix : public ClpPackedMatrix {
public:
enum DynamicStatus {
soloKey = 0x00,
inSmall = 0x01,
atUpperBound = 0x02,
atLowerBound = 0x03
};
virtual void partialPricing(ClpSimplex *model, double start, double end,
int &bestSequence, int &numberWanted);
virtual int updatePivot(ClpSimplex *model, double oldInValue, double oldOutValue);
virtual double *rhsOffset(ClpSimplex *model, bool forceRefresh = false,
bool check = false);
using ClpPackedMatrix::times;
virtual void times(double scalar,
const double *x, double *y) const;
void modifyOffset(int sequence, double amount);
double keyValue(int iSet) const;
virtual void dualExpanded(ClpSimplex *model, CoinIndexedVector *array,
double *other, int mode);
virtual int generalExpanded(ClpSimplex *model, int mode, int &number);
virtual int refresh(ClpSimplex *model);
virtual void createVariable(ClpSimplex *model, int &bestSequence);
virtual double reducedCost(ClpSimplex *model, int sequence) const;
void gubCrash();
void writeMps(const char *name);
void initialProblem();
int addColumn(CoinBigIndex numberEntries, const int *row, const double *element,
double cost, double lower, double upper, int iSet,
DynamicStatus status);
virtual void packDown(const int *, int) {}
inline double columnLower(int sequence) const
{
if (columnLower_)
return columnLower_[sequence];
else
return 0.0;
}
inline double columnUpper(int sequence) const
{
if (columnUpper_)
return columnUpper_[sequence];
else
return COIN_DBL_MAX;
}
ClpDynamicMatrix();
ClpDynamicMatrix(ClpSimplex *model, int numberSets,
int numberColumns, const int *starts,
const double *lower, const double *upper,
const CoinBigIndex *startColumn, const int *row,
const double *element, const double *cost,
const double *columnLower = NULL, const double *columnUpper = NULL,
const unsigned char *status = NULL,
const unsigned char *dynamicStatus = NULL);
virtual ~ClpDynamicMatrix();
ClpDynamicMatrix(const ClpDynamicMatrix &);
ClpDynamicMatrix(const CoinPackedMatrix &);
ClpDynamicMatrix &operator=(const ClpDynamicMatrix &);
virtual ClpMatrixBase *clone() const;
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 bool flaggedSlack(int i) const
{
return (status_[i] & 8) != 0;
}
inline void setFlaggedSlack(int i)
{
status_[i] = static_cast< unsigned char >(status_[i] | 8);
}
inline void unsetFlaggedSlack(int i)
{
status_[i] = static_cast< unsigned char >(status_[i] & ~8);
}
inline int numberSets() const
{
return numberSets_;
}
inline int numberGubEntries() const
{
return startSet_[numberSets_];
}
inline int *startSets() const
{
return startSet_;
}
inline bool flagged(int i) const
{
return (dynamicStatus_[i] & 8) != 0;
}
inline void setFlagged(int i)
{
dynamicStatus_[i] = static_cast< unsigned char >(dynamicStatus_[i] | 8);
}
inline void unsetFlagged(int i)
{
dynamicStatus_[i] = static_cast< unsigned char >(dynamicStatus_[i] & ~8);
}
inline void setDynamicStatus(int sequence, DynamicStatus status)
{
unsigned char &st_byte = dynamicStatus_[sequence];
st_byte = static_cast< unsigned char >(st_byte & ~7);
st_byte = static_cast< unsigned char >(st_byte | status);
}
inline DynamicStatus getDynamicStatus(int sequence) const
{
return static_cast< DynamicStatus >(dynamicStatus_[sequence] & 7);
}
inline double objectiveOffset() const
{
return objectiveOffset_;
}
inline CoinBigIndex *startColumn() const
{
return startColumn_;
}
inline int *row() const
{
return row_;
}
inline double *element() const
{
return element_;
}
inline double *cost() const
{
return cost_;
}
inline int *id() const
{
return id_;
}
inline double *columnLower() const
{
return columnLower_;
}
inline double *columnUpper() const
{
return columnUpper_;
}
inline double *lowerSet() const
{
return lowerSet_;
}
inline double *upperSet() const
{
return upperSet_;
}
inline int numberGubColumns() const
{
return numberGubColumns_;
}
inline int firstAvailable() const
{
return firstAvailable_;
}
inline int firstDynamic() const
{
return firstDynamic_;
}
inline int lastDynamic() const
{
return lastDynamic_;
}
inline int numberStaticRows() const
{
return numberStaticRows_;
}
inline CoinBigIndex numberElements() const
{
return numberElements_;
}
inline int *keyVariable() const
{
return keyVariable_;
}
void switchOffCheck();
inline unsigned char *gubRowStatus() const
{
return status_;
}
inline unsigned char *dynamicStatus() const
{
return dynamicStatus_;
}
int whichSet(int sequence) const;
protected:
double sumDualInfeasibilities_;
double sumPrimalInfeasibilities_;
double sumOfRelaxedDualInfeasibilities_;
double sumOfRelaxedPrimalInfeasibilities_;
double savedBestGubDual_;
int savedBestSet_;
int *backToPivotRow_;
mutable int *keyVariable_;
int *toIndex_;
// Reverse pointer from index to set
int *fromIndex_;
int numberSets_;
int numberActiveSets_;
double objectiveOffset_;
double *lowerSet_;
double *upperSet_;
unsigned char *status_;
ClpSimplex *model_;
int firstAvailable_;
int firstAvailableBefore_;
int firstDynamic_;
int lastDynamic_;
int numberStaticRows_;
CoinBigIndex numberElements_;
int numberDualInfeasibilities_;
int numberPrimalInfeasibilities_;
int noCheck_;
double infeasibilityWeight_;
int numberGubColumns_;
int maximumGubColumns_;
CoinBigIndex maximumElements_;
int *startSet_;
int *next_;
CoinBigIndex *startColumn_;
int *row_;
double *element_;
double *cost_;
int *id_;
unsigned char *dynamicStatus_;
double *columnLower_;
double *columnUpper_;
};
#endif
/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
*/
name
std::string name() const
Returns name.
Definition CbcOrClpParam.hpp:332
ClpPackedMatrix.hpp
ClpDynamicMatrix::columnUpper
double * columnUpper() const
Optional upper bounds on columns.
Definition ClpDynamicMatrix.hpp:262
ClpDynamicMatrix::whichSet
int whichSet(int sequence) const
Returns which set a variable is in.
ClpDynamicMatrix::numberGubColumns_
int numberGubColumns_
size
Definition ClpDynamicMatrix.hpp:389
ClpDynamicMatrix::next_
int * next_
next in chain
Definition ClpDynamicMatrix.hpp:397
ClpDynamicMatrix::id_
int * id_
ids of active columns (just index here)
Definition ClpDynamicMatrix.hpp:407
ClpDynamicMatrix::times
virtual void times(double scalar, const double *x, double *y) const
Return y + A * scalar *x in y.
ClpDynamicMatrix::reducedCost
virtual double reducedCost(ClpSimplex *model, int sequence) const
Returns reduced cost of a variable.
ClpDynamicMatrix::refresh
virtual int refresh(ClpSimplex *model)
Purely for column generation and similar ideas.
ClpDynamicMatrix::keyValue
double keyValue(int iSet) const
Gets key value when none in small.
ClpDynamicMatrix::gubRowStatus
unsigned char * gubRowStatus() const
Status region for gub slacks.
Definition ClpDynamicMatrix.hpp:313
ClpDynamicMatrix::maximumElements_
CoinBigIndex maximumElements_
current maximum number of elemnts (then compress)
Definition ClpDynamicMatrix.hpp:393
ClpDynamicMatrix::rhsOffset
virtual double * rhsOffset(ClpSimplex *model, bool forceRefresh=false, bool check=false)
Returns effective RHS offset if it is being used.
ClpDynamicMatrix::objectiveOffset
double objectiveOffset() const
Saved value of objective offset.
Definition ClpDynamicMatrix.hpp:227
ClpDynamicMatrix::operator=
ClpDynamicMatrix & operator=(const ClpDynamicMatrix &)
ClpDynamicMatrix::status_
unsigned char * status_
Status of slack on set.
Definition ClpDynamicMatrix.hpp:361
ClpDynamicMatrix::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 ...
ClpDynamicMatrix::lowerSet_
double * lowerSet_
Lower bounds on sets.
Definition ClpDynamicMatrix.hpp:357
ClpDynamicMatrix::startColumn_
CoinBigIndex * startColumn_
Starts of each column.
Definition ClpDynamicMatrix.hpp:399
ClpDynamicMatrix::firstDynamic
int firstDynamic() const
first dynamic
Definition ClpDynamicMatrix.hpp:287
ClpDynamicMatrix::numberGubEntries
int numberGubEntries() const
Number of possible gub variables.
Definition ClpDynamicMatrix.hpp:194
ClpDynamicMatrix::savedBestSet_
int savedBestSet_
Saved best set in pricing.
Definition ClpDynamicMatrix.hpp:341
ClpDynamicMatrix::DynamicStatus
DynamicStatus
enums for status of various sorts
Definition ClpDynamicMatrix.hpp:23
ClpDynamicMatrix::inSmall
@ inSmall
Definition ClpDynamicMatrix.hpp:25
ClpDynamicMatrix::atUpperBound
@ atUpperBound
Definition ClpDynamicMatrix.hpp:26
ClpDynamicMatrix::soloKey
@ soloKey
Definition ClpDynamicMatrix.hpp:24
ClpDynamicMatrix::atLowerBound
@ atLowerBound
Definition ClpDynamicMatrix.hpp:27
ClpDynamicMatrix::infeasibilityWeight_
double infeasibilityWeight_
Infeasibility weight when last full pass done.
Definition ClpDynamicMatrix.hpp:387
ClpDynamicMatrix::numberSets_
int numberSets_
Number of sets (dynamic rows).
Definition ClpDynamicMatrix.hpp:351
ClpDynamicMatrix::columnUpper
double columnUpper(int sequence) const
Gets upper bound (to simplify coding).
Definition ClpDynamicMatrix.hpp:118
ClpDynamicMatrix::row
int * row() const
rows
Definition ClpDynamicMatrix.hpp:237
ClpDynamicMatrix::columnLower
double columnLower(int sequence) const
Gets lower bound (to simplify coding).
Definition ClpDynamicMatrix.hpp:110
ClpDynamicMatrix::numberGubColumns
int numberGubColumns() const
size
Definition ClpDynamicMatrix.hpp:277
ClpDynamicMatrix::partialPricing
virtual void partialPricing(ClpSimplex *model, double start, double end, int &bestSequence, int &numberWanted)
Partial pricing.
ClpDynamicMatrix::cost_
double * cost_
costs
Definition ClpDynamicMatrix.hpp:405
ClpDynamicMatrix::setFlaggedSlack
void setFlaggedSlack(int i)
Definition ClpDynamicMatrix.hpp:180
ClpDynamicMatrix::startSets
int * startSets() const
Sets.
Definition ClpDynamicMatrix.hpp:199
ClpDynamicMatrix::numberDualInfeasibilities_
int numberDualInfeasibilities_
Number of dual infeasibilities.
Definition ClpDynamicMatrix.hpp:377
ClpDynamicMatrix::numberPrimalInfeasibilities_
int numberPrimalInfeasibilities_
Number of primal infeasibilities.
Definition ClpDynamicMatrix.hpp:379
ClpDynamicMatrix::writeMps
void writeMps(const char *name)
Writes out model (without names).
ClpDynamicMatrix::model_
ClpSimplex * model_
Pointer back to model.
Definition ClpDynamicMatrix.hpp:363
ClpDynamicMatrix::ClpDynamicMatrix
ClpDynamicMatrix()
Default constructor.
ClpDynamicMatrix::columnLower
double * columnLower() const
Optional lower bounds on columns.
Definition ClpDynamicMatrix.hpp:257
ClpDynamicMatrix::sumDualInfeasibilities_
double sumDualInfeasibilities_
Sum of dual infeasibilities.
Definition ClpDynamicMatrix.hpp:331
ClpDynamicMatrix::objectiveOffset_
double objectiveOffset_
Saved value of objective offset.
Definition ClpDynamicMatrix.hpp:355
ClpDynamicMatrix::numberActiveSets_
int numberActiveSets_
Number of active sets.
Definition ClpDynamicMatrix.hpp:353
ClpDynamicMatrix::unsetFlaggedSlack
void unsetFlaggedSlack(int i)
Definition ClpDynamicMatrix.hpp:184
ClpDynamicMatrix::columnLower_
double * columnLower_
Optional lower bounds on columns.
Definition ClpDynamicMatrix.hpp:411
ClpDynamicMatrix::setFlagged
void setFlagged(int i)
Definition ClpDynamicMatrix.hpp:208
ClpDynamicMatrix::numberElements_
CoinBigIndex numberElements_
size of working matrix (max)
Definition ClpDynamicMatrix.hpp:375
ClpDynamicMatrix::gubCrash
void gubCrash()
Does gub crash.
ClpDynamicMatrix::dynamicStatus_
unsigned char * dynamicStatus_
for status and which bound
Definition ClpDynamicMatrix.hpp:409
ClpDynamicMatrix::initialProblem
void initialProblem()
Populates initial matrix from dynamic status.
ClpDynamicMatrix::modifyOffset
void modifyOffset(int sequence, double amount)
Modifies rhs offset.
ClpDynamicMatrix::upperSet
double * upperSet() const
Upper bounds on sets.
Definition ClpDynamicMatrix.hpp:272
ClpDynamicMatrix::updatePivot
virtual int updatePivot(ClpSimplex *model, double oldInValue, double oldOutValue)
update information for a pivot (and effective rhs)
ClpDynamicMatrix::unsetFlagged
void unsetFlagged(int i)
Definition ClpDynamicMatrix.hpp:212
ClpDynamicMatrix::columnUpper_
double * columnUpper_
Optional upper bounds on columns.
Definition ClpDynamicMatrix.hpp:413
ClpDynamicMatrix::savedBestGubDual_
double savedBestGubDual_
Saved best dual on gub row in pricing.
Definition ClpDynamicMatrix.hpp:339
ClpDynamicMatrix::maximumGubColumns_
int maximumGubColumns_
current maximum number of columns (then compress)
Definition ClpDynamicMatrix.hpp:391
ClpDynamicMatrix::firstAvailable_
int firstAvailable_
first free
Definition ClpDynamicMatrix.hpp:365
ClpDynamicMatrix::flagged
bool flagged(int i) const
Whether flagged.
Definition ClpDynamicMatrix.hpp:204
ClpDynamicMatrix::firstDynamic_
int firstDynamic_
first dynamic
Definition ClpDynamicMatrix.hpp:369
ClpDynamicMatrix::id
int * id() const
ids of active columns (just index here)
Definition ClpDynamicMatrix.hpp:252
ClpDynamicMatrix::firstAvailable
int firstAvailable() const
first free
Definition ClpDynamicMatrix.hpp:282
ClpDynamicMatrix::addColumn
int addColumn(CoinBigIndex numberEntries, const int *row, const double *element, double cost, double lower, double upper, int iSet, DynamicStatus status)
Adds in a column to gub structure (called from descendant) and returns sequence.
ClpDynamicMatrix::createVariable
virtual void createVariable(ClpSimplex *model, int &bestSequence)
Creates a variable.
ClpDynamicMatrix::setDynamicStatus
void setDynamicStatus(int sequence, DynamicStatus status)
Definition ClpDynamicMatrix.hpp:216
ClpDynamicMatrix::numberElements
CoinBigIndex numberElements() const
size of working matrix (max)
Definition ClpDynamicMatrix.hpp:302
ClpDynamicMatrix::cost
double * cost() const
costs
Definition ClpDynamicMatrix.hpp:247
ClpDynamicMatrix::numberStaticRows
int numberStaticRows() const
number of rows in original model
Definition ClpDynamicMatrix.hpp:297
ClpDynamicMatrix::ClpDynamicMatrix
ClpDynamicMatrix(const ClpDynamicMatrix &)
The copy constructor.
ClpDynamicMatrix::getDynamicStatus
DynamicStatus getDynamicStatus(int sequence) const
Definition ClpDynamicMatrix.hpp:222
ClpDynamicMatrix::sumOfRelaxedPrimalInfeasibilities_
double sumOfRelaxedPrimalInfeasibilities_
Sum of Primal infeasibilities using tolerance based on error in primals.
Definition ClpDynamicMatrix.hpp:337
ClpDynamicMatrix::lowerSet
double * lowerSet() const
Lower bounds on sets.
Definition ClpDynamicMatrix.hpp:267
ClpDynamicMatrix::ClpDynamicMatrix
ClpDynamicMatrix(ClpSimplex *model, int numberSets, int numberColumns, const int *starts, const double *lower, const double *upper, const CoinBigIndex *startColumn, const int *row, const double *element, const double *cost, const double *columnLower=NULL, const double *columnUpper=NULL, const unsigned char *status=NULL, const unsigned char *dynamicStatus=NULL)
This is the real constructor.
ClpDynamicMatrix::toIndex_
int * toIndex_
Backward pointer to extra row.
Definition ClpDynamicMatrix.hpp:347
ClpDynamicMatrix::numberSets
int numberSets() const
Number of sets (dynamic rows).
Definition ClpDynamicMatrix.hpp:189
ClpDynamicMatrix::dynamicStatus
unsigned char * dynamicStatus() const
Status region for gub variables.
Definition ClpDynamicMatrix.hpp:318
ClpDynamicMatrix::element
double * element() const
elements
Definition ClpDynamicMatrix.hpp:242
ClpDynamicMatrix::sumOfRelaxedDualInfeasibilities_
double sumOfRelaxedDualInfeasibilities_
Sum of Dual infeasibilities using tolerance based on error in duals.
Definition ClpDynamicMatrix.hpp:335
ClpDynamicMatrix::lastDynamic_
int lastDynamic_
number of columns in dynamic model
Definition ClpDynamicMatrix.hpp:371
ClpDynamicMatrix::switchOffCheck
void switchOffCheck()
Switches off dj checking each factorization (for BIG models).
ClpDynamicMatrix::row_
int * row_
rows
Definition ClpDynamicMatrix.hpp:401
ClpDynamicMatrix::keyVariable_
int * keyVariable_
Key variable of set (only accurate if none in small problem).
Definition ClpDynamicMatrix.hpp:345
ClpDynamicMatrix::sumPrimalInfeasibilities_
double sumPrimalInfeasibilities_
Sum of primal infeasibilities.
Definition ClpDynamicMatrix.hpp:333
ClpDynamicMatrix::flaggedSlack
bool flaggedSlack(int i) const
Whether flagged slack.
Definition ClpDynamicMatrix.hpp:176
ClpDynamicMatrix::fromIndex_
int * fromIndex_
Definition ClpDynamicMatrix.hpp:349
ClpDynamicMatrix::clone
virtual ClpMatrixBase * clone() const
Clone.
ClpDynamicMatrix::getStatus
ClpSimplex::Status getStatus(int sequence) const
Status of row slacks.
Definition ClpDynamicMatrix.hpp:165
ClpDynamicMatrix::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=...
ClpDynamicMatrix::keyVariable
int * keyVariable() const
Definition ClpDynamicMatrix.hpp:306
ClpDynamicMatrix::firstAvailableBefore_
int firstAvailableBefore_
first free when iteration started
Definition ClpDynamicMatrix.hpp:367
ClpDynamicMatrix::noCheck_
int noCheck_
If pricing will declare victory (i.e.
Definition ClpDynamicMatrix.hpp:385
ClpDynamicMatrix::ClpDynamicMatrix
ClpDynamicMatrix(const CoinPackedMatrix &)
The copy constructor from an CoinPackedMatrix.
ClpDynamicMatrix::numberStaticRows_
int numberStaticRows_
number of rows in original model
Definition ClpDynamicMatrix.hpp:373
ClpDynamicMatrix::~ClpDynamicMatrix
virtual ~ClpDynamicMatrix()
Destructor.
ClpDynamicMatrix::backToPivotRow_
int * backToPivotRow_
Backward pointer to pivot row !!!
Definition ClpDynamicMatrix.hpp:343
ClpDynamicMatrix::element_
double * element_
elements
Definition ClpDynamicMatrix.hpp:403
ClpDynamicMatrix::setStatus
void setStatus(int sequence, ClpSimplex::Status status)
Definition ClpDynamicMatrix.hpp:169
ClpDynamicMatrix::startColumn
CoinBigIndex * startColumn() const
Starts of each column.
Definition ClpDynamicMatrix.hpp:232
ClpDynamicMatrix::upperSet_
double * upperSet_
Upper bounds on sets.
Definition ClpDynamicMatrix.hpp:359
ClpDynamicMatrix::startSet_
int * startSet_
Start of each set.
Definition ClpDynamicMatrix.hpp:395
ClpDynamicMatrix::lastDynamic
int lastDynamic() const
number of columns in dynamic model
Definition ClpDynamicMatrix.hpp:292
ClpDynamicMatrix::packDown
virtual void packDown(const int *, int)
If addColumn forces compression then this allows descendant to know what to do.
Definition ClpDynamicMatrix.hpp:108
ClpMatrixBase::ClpMatrixBase
ClpMatrixBase()
Default constructor.
ClpPackedMatrix::times
virtual void times(double scalar, const double *x, double *y) const
Return y + A * scalar *x in y.
ClpPackedMatrix::ClpPackedMatrix
ClpPackedMatrix()
Default constructor.
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