coin-Bcp
|
This class holds a column in a compressed form. More...
#include <BCP_matrix.hpp>
Public Member Functions | |
Query methods | |
double | Objective () const |
Return the objective coefficient. More... | |
double | LowerBound () const |
Return the lower bound. More... | |
double | UpperBound () const |
Return the upper bound. More... | |
General modifying methods | |
void | Objective (const double obj) |
Set the objective coefficient to the given value. More... | |
void | LowerBound (const double lb) |
Set the lower bound to the given value. More... | |
void | UpperBound (const double ub) |
Set the upper bound to the given value. More... | |
BCP_col & | operator= (const BCP_col &x) |
Assignment operator: copy over the contents of x . More... | |
void | assign (const int size, int *&ElementIndices, double *&ElementValues, const double Obj, const double LB, const double UB) |
Set the objective coefficient, lower and upper bounds to the given values. More... | |
void | copy (const int size, const int *ElementIndices, const double *ElementValues, const double Obj, const double LB, const double UB) |
Copy the arguments into the appropriate data members. More... | |
void | copy (BCP_vec< int >::const_iterator firstind, BCP_vec< int >::const_iterator lastind, BCP_vec< double >::const_iterator firstval, BCP_vec< double >::const_iterator lastval, const double Obj, const double LB, const double UB) |
Same as the other copy() method, except that instead of using vectors the indices (values) are given in [firstind,lastind) ([firstval,lastval) ). More... | |
Constructors / Destructor | |
BCP_col () | |
The default constructor creates an empty column with 0 as objective coefficient, 0.0 as lower and +infinity as upper bound. More... | |
BCP_col (const BCP_col &x) | |
The copy constructor makes a copy of x . More... | |
BCP_col (BCP_vec< int >::const_iterator firstind, BCP_vec< int >::const_iterator lastind, BCP_vec< double >::const_iterator firstval, BCP_vec< double >::const_iterator lastval, const double Obj, const double LB, const double UB) | |
This constructor acts exactly like the copy method with the same argument list. More... | |
BCP_col (const int size, int *&ElementIndices, double *&ElementValues, const double Obj, const double LB, const double UB) | |
This constructor acts exactly like the assign method with the same argument list. More... | |
BCP_col (const CoinPackedVectorBase &vec, const double Obj, const double LB, const double UB) | |
The default constructor creates an empty column with 0 as objective coefficient, 0.0 as lower and +infinity as upper bound. More... | |
~BCP_col () | |
The destructor deletes all data members. More... | |
![]() | |
virtual int | getNumElements () const |
Get the size. More... | |
virtual const int * | getIndices () const |
Get indices of elements. More... | |
virtual const double * | getElements () const |
Get element values. More... | |
int * | getIndices () |
Get indices of elements. More... | |
int | getVectorNumElements () const |
Get the size. More... | |
const int * | getVectorIndices () const |
Get indices of elements. More... | |
const double * | getVectorElements () const |
Get element values. More... | |
double * | getElements () |
Get element values. More... | |
const int * | getOriginalPosition () const |
Get pointer to int * vector of original postions. More... | |
void | clear () |
Reset the vector (as if were just created an empty vector) More... | |
CoinPackedVector & | operator= (const CoinPackedVector &) |
Assignment operator. More... | |
CoinPackedVector & | operator= (const CoinPackedVectorBase &rhs) |
Assignment operator from a CoinPackedVectorBase. More... | |
void | assignVector (int size, int *&inds, double *&elems, bool testForDuplicateIndex=COIN_DEFAULT_VALUE_FOR_DUPLICATE) |
Assign the ownership of the arguments to this vector. More... | |
void | setVector (int size, const int *inds, const double *elems, bool testForDuplicateIndex=COIN_DEFAULT_VALUE_FOR_DUPLICATE) |
Set vector size, indices, and elements. More... | |
void | setConstant (int size, const int *inds, double elems, bool testForDuplicateIndex=COIN_DEFAULT_VALUE_FOR_DUPLICATE) |
Elements set to have the same scalar value. More... | |
void | setFull (int size, const double *elems, bool testForDuplicateIndex=COIN_DEFAULT_VALUE_FOR_DUPLICATE) |
Indices are not specified and are taken to be 0,1,...,size-1. More... | |
void | setFullNonZero (int size, const double *elems, bool testForDuplicateIndex=COIN_DEFAULT_VALUE_FOR_DUPLICATE) |
Indices are not specified and are taken to be 0,1,...,size-1, but only where non zero. More... | |
void | setElement (int index, double element) |
Set an existing element in the packed vector The first argument is the "index" into the elements() array. More... | |
void | insert (int index, double element) |
Insert an element into the vector. More... | |
void | append (const CoinPackedVectorBase &caboose) |
Append a CoinPackedVector to the end. More... | |
void | swap (int i, int j) |
Swap values in positions i and j of indices and elements. More... | |
void | truncate (int newSize) |
Resize the packed vector to be the first newSize elements. More... | |
void | operator+= (double value) |
add value to every entry More... | |
void | operator-= (double value) |
subtract value from every entry More... | |
void | operator*= (double value) |
multiply every entry by value More... | |
void | operator/= (double value) |
divide every entry by value More... | |
template<class CoinCompare3 > | |
void | sort (const CoinCompare3 &tc) |
Sort the packed storage vector. More... | |
void | sortIncrIndex () |
Sort the packed storage vector. More... | |
void | sortDecrIndex () |
Sort the packed storage vector. More... | |
void | sortIncrElement () |
Sort the packed storage vector. More... | |
void | sortDecrElement () |
Sort the packed storage vector. More... | |
void | sortOriginalOrder () |
Sort in original order. More... | |
void | reserve (int n) |
Reserve space. More... | |
int | capacity () const |
capacity returns the size which could be accomodated without having to reallocate storage. More... | |
CoinPackedVector (bool testForDuplicateIndex=COIN_DEFAULT_VALUE_FOR_DUPLICATE) | |
Default constructor. More... | |
CoinPackedVector (int size, const int *inds, const double *elems, bool testForDuplicateIndex=COIN_DEFAULT_VALUE_FOR_DUPLICATE) | |
Alternate Constructors - set elements to vector of doubles. More... | |
CoinPackedVector (int capacity, int size, int *&inds, double *&elems, bool testForDuplicateIndex=COIN_DEFAULT_VALUE_FOR_DUPLICATE) | |
Alternate Constructors - set elements to vector of doubles. More... | |
CoinPackedVector (int size, const int *inds, double element, bool testForDuplicateIndex=COIN_DEFAULT_VALUE_FOR_DUPLICATE) | |
Alternate Constructors - set elements to same scalar value. More... | |
CoinPackedVector (int size, const double *elements, bool testForDuplicateIndex=COIN_DEFAULT_VALUE_FOR_DUPLICATE) | |
Alternate Constructors - construct full storage with indices 0 through size-1. More... | |
CoinPackedVector (const CoinPackedVector &) | |
Copy constructor. More... | |
CoinPackedVector (const CoinPackedVectorBase &rhs) | |
Copy constructor from a PackedVectorBase. More... | |
virtual | ~CoinPackedVector () |
Destructor. More... | |
![]() | |
void | setTestForDuplicateIndex (bool test) const |
Set to the argument value whether to test for duplicate indices in the vector whenever they can occur. More... | |
void | setTestForDuplicateIndexWhenTrue (bool test) const |
Set to the argument value whether to test for duplicate indices in the vector whenever they can occur BUT we know that right now the vector has no duplicate indices. More... | |
bool | testForDuplicateIndex () const |
Returns true if the vector should be tested for duplicate indices when they can occur. More... | |
void | setTestsOff () const |
Just sets test stuff false without a try etc. More... | |
double * | denseVector (int denseSize) const |
Get the vector as a dense vector. More... | |
double | operator[] (int i) const |
Access the i'th element of the full storage vector. More... | |
int | getMaxIndex () const |
Get value of maximum index. More... | |
int | getMinIndex () const |
Get value of minimum index. More... | |
void | duplicateIndex (const char *methodName=NULL, const char *className=NULL) const |
Throw an exception if there are duplicate indices. More... | |
bool | isExistingIndex (int i) const |
Return true if the i'th element of the full storage vector exists in the packed storage vector. More... | |
int | findIndex (int i) const |
Return the position of the i'th element of the full storage vector. More... | |
bool | operator== (const CoinPackedVectorBase &rhs) const |
Equal. More... | |
bool | operator!= (const CoinPackedVectorBase &rhs) const |
Not equal. More... | |
int | compare (const CoinPackedVectorBase &rhs) const |
This method establishes an ordering on packed vectors. More... | |
template<class FloatEqual > | |
bool | isEquivalent (const CoinPackedVectorBase &rhs, const FloatEqual &eq) const |
equivalent - If shallow packed vector A & B are equivalent, then they are still equivalent no matter how they are sorted. More... | |
bool | isEquivalent (const CoinPackedVectorBase &rhs) const |
Equal. More... | |
double | dotProduct (const double *dense) const |
Create the dot product with a full vector. More... | |
double | oneNorm () const |
Return the 1-norm of the vector. More... | |
double | normSquare () const |
Return the square of the 2-norm of the vector. More... | |
double | twoNorm () const |
Return the 2-norm of the vector. More... | |
double | infNorm () const |
Return the infinity-norm of the vector. More... | |
double | sum () const |
Sum elements of vector. More... | |
virtual | ~CoinPackedVectorBase () |
Destructor. More... | |
Protected Attributes | |
Data members | |
double | _Objective |
The objective function coefficient corresponding to the column. More... | |
double | _LowerBound |
The lower bound corresponding to the column. More... | |
double | _UpperBound |
The upper bound corresponding to the column. More... | |
Additional Inherited Members | |
![]() | |
void | findMaxMinIndices () const |
Find Maximum and Minimum Indices. More... | |
std::set< int > * | indexSet (const char *methodName=NULL, const char *className=NULL) const |
Return indexSetPtr_ (create it if necessary). More... | |
void | clearIndexSet () const |
Delete the indexSet. More... | |
void | clearBase () const |
Find Maximum and Minimum Indices. More... | |
void | copyMaxMinIndex (const CoinPackedVectorBase &x) const |
Find Maximum and Minimum Indices. More... | |
CoinPackedVectorBase () | |
Default constructor. More... | |
This class holds a column in a compressed form.
That is, it is a packed vector with an objective coefficient, lower and upper bound.
Definition at line 26 of file BCP_matrix.hpp.
|
inline |
The default constructor creates an empty column with 0 as objective coefficient, 0.0 as lower and +infinity as upper bound.
Definition at line 113 of file BCP_matrix.hpp.
|
inline |
The copy constructor makes a copy of x
.
Definition at line 116 of file BCP_matrix.hpp.
|
inline |
This constructor acts exactly like the copy
method with the same argument list.
Definition at line 121 of file BCP_matrix.hpp.
|
inline |
This constructor acts exactly like the assign
method with the same argument list.
Definition at line 131 of file BCP_matrix.hpp.
References CoinPackedVector::assignVector().
|
inline |
The default constructor creates an empty column with 0 as objective coefficient, 0.0 as lower and +infinity as upper bound.
Definition at line 137 of file BCP_matrix.hpp.
|
inline |
The destructor deletes all data members.
Definition at line 143 of file BCP_matrix.hpp.
|
inline |
Return the objective coefficient.
Definition at line 44 of file BCP_matrix.hpp.
References _Objective.
Referenced by operator=().
|
inline |
Return the lower bound.
Definition at line 46 of file BCP_matrix.hpp.
References _LowerBound.
Referenced by operator=().
|
inline |
Return the upper bound.
Definition at line 48 of file BCP_matrix.hpp.
References _UpperBound.
Referenced by operator=().
|
inline |
Set the objective coefficient to the given value.
Definition at line 55 of file BCP_matrix.hpp.
References _Objective.
|
inline |
Set the lower bound to the given value.
Definition at line 57 of file BCP_matrix.hpp.
References _LowerBound.
|
inline |
Set the upper bound to the given value.
Definition at line 59 of file BCP_matrix.hpp.
References _UpperBound.
Assignment operator: copy over the contents of x
.
Definition at line 62 of file BCP_matrix.hpp.
References _LowerBound, _Objective, _UpperBound, LowerBound(), Objective(), CoinPackedVector::operator=(), and UpperBound().
|
inline |
Set the objective coefficient, lower and upper bounds to the given values.
Also invokes the assign method of the underlying packed vector.
Definition at line 73 of file BCP_matrix.hpp.
References _LowerBound, _Objective, _UpperBound, and CoinPackedVector::assignVector().
|
inline |
Copy the arguments into the appropriate data members.
Definition at line 83 of file BCP_matrix.hpp.
References _LowerBound, _Objective, _UpperBound, and CoinPackedVector::setVector().
|
inline |
Same as the other copy()
method, except that instead of using vectors the indices (values) are given in [firstind,lastind)
([firstval,lastval)
).
Definition at line 95 of file BCP_matrix.hpp.
References _LowerBound, _Objective, _UpperBound, and CoinPackedVector::setVector().
|
protected |
The objective function coefficient corresponding to the column.
Definition at line 32 of file BCP_matrix.hpp.
Referenced by assign(), copy(), Objective(), and operator=().
|
protected |
The lower bound corresponding to the column.
Definition at line 34 of file BCP_matrix.hpp.
Referenced by assign(), copy(), LowerBound(), and operator=().
|
protected |
The upper bound corresponding to the column.
Definition at line 36 of file BCP_matrix.hpp.
Referenced by assign(), copy(), operator=(), and UpperBound().