Skip to content

Commit

Permalink
change instanceStructure and setRequiredFixedList
Browse files Browse the repository at this point in the history
  • Loading branch information
yuxies committed Feb 10, 2022
1 parent c7ded90 commit 47a9b5b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 21 deletions.
34 changes: 16 additions & 18 deletions src/MibSModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4043,9 +4043,9 @@ MibSModel::loadProblemData(const CoinPackedMatrix& matrix,
//checkProblemType(); // checks if MibS can solve problem entered
setProblemType(); //determine the type of MIBLP
//determine the list of first-stage variables participate in second-stage constraints
setRequiredFixedList(newMatrix);
setRequiredFixedList();
if((stochasticityType == "deterministic") || (stochasticityType == "stochasticWithoutSAA")){
instanceStructure(newMatrix, conLB, conUB, origRowSense_);
instanceStructure();
}
}

Expand Down Expand Up @@ -6134,7 +6134,7 @@ MibSModel::decodeToSelf(AlpsEncoded& encoded)

//#############################################################################
void
MibSModel::setRequiredFixedList(const CoinPackedMatrix *newMatrix)
MibSModel::setRequiredFixedList()
{
//saharSto: we should change the structure of fixedInd
std::string stochasticityType(MibSPar_->entry
Expand All @@ -6145,9 +6145,9 @@ MibSModel::setRequiredFixedList(const CoinPackedMatrix *newMatrix)
int * upperColInd = getUpperColInd();
int * lowerRowInd = getLowerRowInd();

const double * matElements = newMatrix->getElements();
const int * matIndices = newMatrix->getIndices();
const int * matStarts = newMatrix->getVectorStarts();
const double * matElements = colMatrix_->getElements();
const int * matIndices = colMatrix_->getIndices();
const int * matStarts = colMatrix_->getVectorStarts();

int index1, rowIndex, posRow, start, end, begPos, endPos;
int i, j;
Expand All @@ -6162,7 +6162,7 @@ MibSModel::setRequiredFixedList(const CoinPackedMatrix *newMatrix)
fixedInd_[i] = 0;
if(binarySearch(0, uCols - 1, i, upperColInd) >= 0){
start = matStarts[i];
end = start + newMatrix->getVectorSize(i);
end = start + colMatrix_->getVectorSize(i);
for(j = start; j < end; j++){
rowIndex = matIndices[j];
posRow = binarySearch(0, lRows - 1, rowIndex, lowerRowInd);
Expand All @@ -6182,7 +6182,7 @@ MibSModel::setRequiredFixedList(const CoinPackedMatrix *newMatrix)
fixedInd_[i] = 0;
if(i < uCols){
start = matStarts[i];
end = start + newMatrix->getVectorSize(i);
end = start + colMatrix_->getVectorSize(i);
for(j = start; j < end; j++){
rowIndex = matIndices[j];
if((begPos <= rowIndex) && (rowIndex <= endPos)){
Expand All @@ -6199,9 +6199,7 @@ MibSModel::setRequiredFixedList(const CoinPackedMatrix *newMatrix)

//#############################################################################
void
MibSModel::instanceStructure(const CoinPackedMatrix *newMatrix,
const double* rowLB, const double* rowUB,
const char *newRowSense)
MibSModel::instanceStructure()
{

bool printProblemInfo(MibSPar_->entry(MibSParams::printProblemInfo));
Expand Down Expand Up @@ -6476,9 +6474,9 @@ MibSModel::instanceStructure(const CoinPackedMatrix *newMatrix,
bool lowerRow, lowerCol;
double rhs(0.0);

const double * matElements = newMatrix->getElements();
const int * matIndices = newMatrix->getIndices();
const int * matStarts = newMatrix->getVectorStarts();
const double * matElements = colMatrix_->getElements();
const int * matIndices = colMatrix_->getIndices();
const int * matStarts = colMatrix_->getVectorStarts();
colSignsG2_ = new int[numCols];
colSignsA2_ = new int[numCols];

Expand All @@ -6503,7 +6501,7 @@ MibSModel::instanceStructure(const CoinPackedMatrix *newMatrix,
if (binarySearch(0, structRowNum_-1, rowIndex, structRowInd_) < 0){
continue;
}
if(newRowSense[rowIndex] == 'L'){
if(origRowSense_[rowIndex] == 'L'){
mult = -1;
}
else{
Expand Down Expand Up @@ -6567,12 +6565,12 @@ MibSModel::instanceStructure(const CoinPackedMatrix *newMatrix,

if ((isUpperCoeffInt_ == true) || (isLowerCoeffInt_ == true)){
for (i = 0; i < numRows; i++){
switch(newRowSense[i]){
switch(origRowSense_[i]){
case 'L':
rhs = rowUB[i];
rhs = conUB_[i];
break;
case 'G':
rhs = rowLB[i];
rhs = conLB_[i];
break;
case 'E':
std::cout << "MibS cannot currently handle equality constraints.";
Expand Down
5 changes: 2 additions & 3 deletions src/MibSModel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -688,11 +688,10 @@ class MIBSLIB_EXPORT MibSModel : public BlisModel {
virtual void decodeToSelf(AlpsEncoded&);

/** Determine the list of first-stage variables participate in second-stage constraints */
void setRequiredFixedList(const CoinPackedMatrix *newMatrix);
void setRequiredFixedList();

/** Determines the properties of instance. */
void instanceStructure(const CoinPackedMatrix *newMatrix, const double* rowLB,
const double* rowUB, const char *newRowSense);
void instanceStructure();

AlpsTreeNode * createRoot();

Expand Down

0 comments on commit 47a9b5b

Please sign in to comment.