void OsiVolSolverInterface::initFromRlbRub(const int rownum, const double* rowlb, const double* rowub) { if (maxNumrows_ > 0) { rowRimAllocator_(); if (rowub) { CoinDisjointCopyN(rowub, rownum, rowupper_); } else { CoinFillN(rowupper_, rownum, OsiVolInfinity); } if (rowlb) { CoinDisjointCopyN(rowlb, rownum, rowlower_); } else { CoinFillN(rowlower_, rownum, -OsiVolInfinity); } // Set the initial dual solution CoinFillN(rowprice_, rownum, 0.0); convertBoundsToSenses_(); } }
//----------------------------------------------------------------------------- void OsiTestSolverInterface::setRowSetBounds(const int* indexFirst, const int* indexLast, const double* boundList) { if (indexLast - indexFirst < getNumRows() / 3) { while (indexFirst < indexLast) { setRowBounds(*indexFirst, boundList[0], boundList[1]); ++indexFirst; boundList += 2; } } else { // it's better to convert everything at once while (indexFirst < indexLast) { const int ind = *indexFirst; rowlower_[ind] = boundList[0]; rowupper_[ind] = boundList[1]; ++indexFirst; boundList += 2; } convertBoundsToSenses_(); } }
void OsiVolSolverInterface::assignProblem(CoinPackedMatrix*& matrix, double*& collb, double*& colub, double*& obj, double*& rowlb, double*& rowub) { gutsOfDestructor_(); const int rownum = matrix->getNumRows(); const int colnum = matrix->getNumCols(); maxNumcols_ = colnum; maxNumrows_ = rownum; if (matrix->isColOrdered()) { colMatrix_.swap(*matrix); colMatrixCurrent_ = true; rowMatrixCurrent_ = false; } else { rowMatrix_.swap(*matrix); rowMatrixCurrent_ = true; colMatrixCurrent_ = false; } delete matrix; matrix = 0; rowupper_ = rowub; rowub = 0; rowlower_ = rowlb; rowlb = 0; colupper_ = colub; colub = 0; collower_ = collb; collb = 0; objcoeffs_ = obj; obj = 0; if (maxNumrows_ > 0) { if (!rowupper_) { rowupper_ = new double[maxNumrows_]; CoinFillN(rowupper_, rownum, OsiVolInfinity); } if (!rowlower_) { rowlower_ = new double[maxNumrows_]; CoinFillN(rowlower_, rownum, -OsiVolInfinity); } rowsense_ = new char[maxNumrows_]; rhs_ = new double[maxNumrows_]; rowrange_ = new double[maxNumrows_]; rowprice_ = new double[maxNumrows_]; lhs_ = new double[maxNumrows_]; // Set the initial dual solution CoinFillN(rowprice_, rownum, 0.0); convertBoundsToSenses_(); } if (maxNumcols_ > 0) { if (!colupper_) { colupper_ = new double[maxNumcols_]; CoinFillN(colupper_, colnum, OsiVolInfinity); } if (!collower_) { collower_ = new double[maxNumcols_]; CoinFillN(collower_, colnum, -OsiVolInfinity); } if (!objcoeffs_) { objcoeffs_ = new double[maxNumcols_]; CoinFillN(objcoeffs_, colnum, -OsiVolInfinity); } colsol_ = new double[maxNumcols_]; int c; for ( c=0; c<colnum; c++ ) { if ( fabs(collower_[c]) < fabs(colupper_[c]) ) { colsol_[c] = collower_[c]; } else { colsol_[c] = colupper_[c]; } } rc_ = new double[maxNumcols_]; continuous_ = new bool[maxNumcols_]; } }