11 using std::partial_sum;
21 CoinPackedMatrix(mat),
22 _Objective(mat._Objective),
23 _ColLowerBound(mat._ColLowerBound),
24 _ColUpperBound(mat._ColUpperBound),
25 _RowLowerBound(mat._RowLowerBound),
26 _RowUpperBound(mat._RowUpperBound) {}
33 CoinPackedMatrix::operator=(mat);
46 const int MaxNonzeros)
48 CoinPackedMatrix::reserve(isColOrdered() ? MaxColNum : MaxRowNum,
61 CoinPackedMatrix::clear();
70 const double* OBJ,
const double* CLB,
const double* CUB,
71 const double* RLB,
const double* RUB)
74 const int colnum = m.getNumCols();
75 const int rownum = m.getNumRows();
82 CoinPackedMatrix::copyOf(m);
89 double*& OBJ,
double*& CLB,
double*& CUB,
90 double*& RLB,
double*& RUB)
93 const int colnum = m.getNumCols();
94 const int rownum = m.getNumRows();
111 CoinPackedMatrix::gutsOfDestructor();
112 CoinPackedMatrix::swap(m);
118 BCP_lp_relax::add_col_set(
const BCP_col_set& Cols)
120 rightAppendPackedMatrix(Cols);
129 BCP_lp_relax::add_row_set(
const BCP_row_set& Rows)
131 bottomAppendPackedMatrix(Rows);
160 BCP_lp_relax::dot_product_col(
const int index,
163 if (! isColOrdered())
165 LP: dot_product_col() called for a row ordered matrix...\n");
166 return dot_product(index, col);
170 BCP_lp_relax::dot_product_col(
const int index,
171 const double* col)
const
173 if (_Ordering != ColWise)
175 LP: dot_product_col() called for a row ordered matrix...\n");
176 return dot_product(index, col);
182 BCP_lp_relax::dot_product_row(
const int index,
185 if (_Ordering != RowWise)
187 LP: dot_product_col() called for a col ordered matrix...\n");
188 return dot_product(index, row);
192 BCP_lp_relax::dot_product_row(
const int index,
193 const double* row)
const
195 if (_Ordering != RowWise)
197 LP: dot_product_col() called for a col ordered matrix...\n");
198 return dot_product(index, row);
213 for (i = 0; i <
rownum; ++i)
214 nzcnt += rows[i]->getNumElements();
215 CoinPackedMatrix::clear();
216 CoinPackedMatrix::reserve(rownum, nzcnt);
217 CoinPackedMatrix::setDimensions(0, CLB.
size());
220 for (i = 0; i <
rownum; ++i) {
222 CoinPackedMatrix::appendMajorVector(*row);
236 CoinPackedMatrix(false , 0, 0, 0, NULL, NULL, NULL, NULL)
246 double extra_gap,
double extra_major) :
247 CoinPackedMatrix(false , 0, 0, 0, NULL, NULL, NULL, NULL)
249 setExtraGap(extra_gap);
250 setExtraMajor(extra_major);
264 for (i = 0; i <
colnum; ++i)
265 nzcnt += cols[i]->getNumElements();
266 CoinPackedMatrix::clear();
267 CoinPackedMatrix::reserve(colnum, nzcnt);
268 CoinPackedMatrix::setDimensions(RLB.
size(), 0);
272 for (i = 0; i <
colnum; ++i) {
274 CoinPackedMatrix::appendMajorVector(*col);
287 CoinPackedMatrix(true , 0, 0, 0, NULL, NULL, NULL, NULL)
296 double extra_gap,
double extra_major) :
297 CoinPackedMatrix(true , 0, 0, 0, NULL, NULL, NULL, NULL)
299 setExtraGap(extra_gap);
300 setExtraMajor(extra_major);
315 _Objective(OBJ), _ColLowerBound(CLB), _ColUpperBound(CUB),
316 _RowLowerBound(RLB), _RowUpperBound(RUB)
318 const int minor = colordered ? RLB.
size() : CLB.
size();
319 const int major = colordered ? CLB.
size() : RLB.
size();
320 CoinPackedMatrix::copyOf(colordered, minor, major, EI.
size(),
327 const int rownum,
const int colnum,
const int nznum,
328 int*& VB,
int*& EI,
double*& EV,
329 double*& OBJ,
double*& CLB,
double*& CUB,
330 double*& RLB,
double*& RUB) :
332 _Objective(OBJ, OBJ+colnum),
333 _ColLowerBound(CLB, CLB+colnum), _ColUpperBound(CUB, CUB+colnum),
334 _RowLowerBound(RLB, RLB+rownum), _RowUpperBound(RUB, RUB+rownum)
336 const int minor = colordered ? rownum :
colnum;
337 const int major = colordered ? colnum :
rownum;
339 CoinPackedMatrix::assignMatrix(colordered, minor, major, nznum,
341 delete[] OBJ; OBJ = 0;
342 delete[] CLB; CLB = 0;
343 delete[] CUB; CUB = 0;
344 delete[] RLB; RLB = 0;
345 delete[] RUB; RUB = 0;
double LowerBound() const
Return the lower bound.
BCP_vec< double > _ColUpperBound
The upper bounds on the variables.
This class holds a column in a compressed form.
void erase_row_set(const BCP_vec< int > &pos)
Remove the rows whose indices are listed in pos from the LP relaxation.
BCP_vec< double > _RowUpperBound
The upper bounds on the cuts.
double LowerBound() const
Return the lower bound.
size_t rownum() const
The number of rows.
double UpperBound() const
Return the upper bound.
pos
position where the operator should be printed when printing the expression
void clear()
Delete every entry.
void clear()
Clear the LP relaxation.
size_t colnum() const
The number of columns.
BCP_lp_relax(const bool colordered=true)
Create an empty LP relaxation with given ordering.
iterator begin()
Return an iterator to the beginning of the object.
void BCP_createRowOrderedMatrix(BCP_vec< BCP_col * > &cols, BCP_vec< double > &RLB, BCP_vec< double > &RUB)
void reserve(const size_t n)
Reallocate the object to make space for n entries.
void erase_col_set(const BCP_vec< int > &pos)
Remove the columns whose indices are listed in pos from the LP relaxation.
void copyOf(const CoinPackedMatrix &m, const double *OBJ, const double *CLB, const double *CUB, const double *RLB, const double *RUB)
Set up the LP relaxation by making a copy of the arguments.
BCP_vec< double > _ColLowerBound
The lower bounds on the variables.
void erase_by_index(const BCP_vec< int > &positions)
Erase the entries indexed by indices.
double Objective() const
Return the objective coefficient.
void insert(iterator position, const void *first, const size_t num)
Insert num entries starting from memory location first into the vector from position pos...
void assign(CoinPackedMatrix &m, double *&OBJ, double *&CLB, double *&CUB, double *&RLB, double *&RUB)
Set up the LP relaxation by taking over the pointers in the arguments.
BCP_vec< double > _Objective
The objective coefficients of the variables.
Currently there isn't any error handling in BCP.
double UpperBound() const
Return the upper bound.
size_t size() const
Return the current number of entries.
iterator end()
Return an iterator to the end of the object.
void unchecked_push_back(const_reference x)
Append x to the end of the vector.
BCP_lp_relax & operator=(const BCP_lp_relax &mat)
Copy the content of x into the LP relaxation.
BCP_vec< double > _RowLowerBound
The lower bounds on the cuts.
void reserve(const int MaxColNum, const int MaxRowNum, const int MaxNonzeros)
Reserve space in the LP relaxation for at least MaxColNum columns, MaxRowNum rows and MaxNonzeros non...
void append(const BCP_vec< T > &x)
Append the entries in x to the end of the vector.
void swap(BCP_vec< T > &x)
Exchange the contents of the object with that of x.
An object of type BCP_lp_relax holds the description of an lp relaxation.
void BCP_createColumnOrderedMatrix(BCP_vec< BCP_row * > &rows, BCP_vec< double > &CLB, BCP_vec< double > &CUB, BCP_vec< double > &OBJ)
This class holds a row in a compressed form.