Skip to content

Commit

Permalink
clean up interdict rowSense; remove unused vars
Browse files Browse the repository at this point in the history
  • Loading branch information
yuxies committed Feb 10, 2022
1 parent 96ae1ca commit c7ded90
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 21 deletions.
23 changes: 3 additions & 20 deletions src/MibSModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,6 @@ MibSModel::readAuxiliaryData(const CoinPackedMatrix& rowMatrix,
int i(0), j(0), k(0), m(0), p(0), pos(0);
int lowerColNum(0), lowerRowNum(0);
// Find out if we are reading an interdiction problem in legacy format
double * intCosts = getInterdictCost();

while (data_stream >> key){
if(key == "N"){
Expand Down Expand Up @@ -3911,7 +3910,7 @@ MibSModel::loadProblemData(const CoinPackedMatrix& matrix,

newMatrix = new CoinPackedMatrix(false, 0, 0);
newMatrix->setDimensions(0, numTotalCols);
int start(0), end(0), tmp(0), index(0);
int start(0), end(0);

/* Add interdiction budget row */
if (intCosts){
Expand Down Expand Up @@ -4046,7 +4045,7 @@ MibSModel::loadProblemData(const CoinPackedMatrix& matrix,
//determine the list of first-stage variables participate in second-stage constraints
setRequiredFixedList(newMatrix);
if((stochasticityType == "deterministic") || (stochasticityType == "stochasticWithoutSAA")){
instanceStructure(newMatrix, conLB, conUB, rowSense);
instanceStructure(newMatrix, conLB, conUB, origRowSense_);
}
}

Expand Down Expand Up @@ -6202,7 +6201,7 @@ MibSModel::setRequiredFixedList(const CoinPackedMatrix *newMatrix)
void
MibSModel::instanceStructure(const CoinPackedMatrix *newMatrix,
const double* rowLB, const double* rowUB,
const char *rowSense)
const char *newRowSense)
{

bool printProblemInfo(MibSPar_->entry(MibSParams::printProblemInfo));
Expand Down Expand Up @@ -6392,15 +6391,13 @@ MibSModel::instanceStructure(const CoinPackedMatrix *newMatrix,
int numRows(numCons_);
int uCols(upperDim_);
int lCols(lowerDim_);
int uRows(upperRowNum_);
int lRows(lowerRowNum_);
int numUpperInt(0);
int numLowerInt(0);
int * uColIndices = getUpperColInd();
int * lColIndices = getLowerColInd();
int * lRowIndices = getLowerRowInd();
double * lObjCoeffs = getLowerObjCoeffs();
char * newRowSense = new char[numRows];

for(i = 0; i < uCols; i++){
index = uColIndices[i];
Expand All @@ -6423,17 +6420,6 @@ MibSModel::instanceStructure(const CoinPackedMatrix *newMatrix,
std::cout << numLowerInt << std::endl;
}

if (isInterdict_ == false){
CoinDisjointCopyN(rowSense, numRows, newRowSense);
}else{
for (i = 0; i < numRows; i++){
newRowSense[i] = 'L';
}
for (i = 0; i < lRows-lCols; i++){
newRowSense[i+uRows] = rowSense[i];
}
}

//Checks general or interdiction
if (isInterdict_ == true){
if (printProblemInfo == true){
Expand Down Expand Up @@ -6485,7 +6471,6 @@ MibSModel::instanceStructure(const CoinPackedMatrix *newMatrix,
}
}

int nonZero (newMatrix->getNumElements());
int counterStart, counterEnd;
int rowIndex;
bool lowerRow, lowerCol;
Expand Down Expand Up @@ -6997,6 +6982,4 @@ MibSModel::instanceStructure(const CoinPackedMatrix *newMatrix,
}
}
std::cout << std::endl;

delete [] newRowSense;
}
2 changes: 1 addition & 1 deletion src/MibSModel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ class MIBSLIB_EXPORT MibSModel : public BlisModel {

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

AlpsTreeNode * createRoot();

Expand Down

0 comments on commit c7ded90

Please sign in to comment.