Skip to content

Commit

Permalink
rm unused isTimeLimReached from findLowerSol(IDIC)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuxies committed Nov 7, 2023
1 parent 386df86 commit 3c033fd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 25 deletions.
26 changes: 4 additions & 22 deletions src/MibSCutGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -577,18 +577,11 @@ MibSCutGenerator::intersectionCuts(BcpsConstraintPool &conPool,
double *lowerLevelSol = new double[lCols];
CoinZeroN(uselessIneqs, lRows);
CoinZeroN(lowerLevelSol, lCols);
isTimeLimReached = false;
if (!findLowerLevelSol(uselessIneqs, lowerLevelSol, sol, isTimeLimReached)){
if (!findLowerLevelSol(uselessIneqs, lowerLevelSol, sol)){
delete [] uselessIneqs;
delete [] lowerLevelSol;
goto TERM_INTERSECTIONCUT;
}
// YX: not used since it has been handled above
// if(isTimeLimReached == true){
// delete [] uselessIneqs;
// delete [] lowerLevelSol;
// goto TERM_INTERSECTIONCUT;
// }
intersectionFound = getAlphaIC(extRay, uselessIneqs, lowerLevelSol,
numStruct, numNonBasic, sol, alpha);

Expand All @@ -615,19 +608,11 @@ MibSCutGenerator::intersectionCuts(BcpsConstraintPool &conPool,
double *lowerLevelSol = new double[lCols];
CoinZeroN(uselessIneqs, lRows);
CoinZeroN(lowerLevelSol, lCols);
isTimeLimReached = false;
if (!findLowerLevelSolImprovingDirectionIC(uselessIneqs, lowerLevelSol, lpSol,
isTimeLimReached)){
if (!findLowerLevelSolImprovingDirectionIC(uselessIneqs, lowerLevelSol, lpSol)){
delete [] uselessIneqs;
delete [] lowerLevelSol;
goto TERM_INTERSECTIONCUT;
}
// YX: not used since it has been handled above
// if(isTimeLimReached == true){
// delete [] uselessIneqs;
// delete [] lowerLevelSol;
// goto TERM_INTERSECTIONCUT;
// }
intersectionFound = getAlphaImprovingDirectionIC(extRay, uselessIneqs, lowerLevelSol,
numStruct, numNonBasic, lpSol, alpha);
delete [] uselessIneqs;
Expand Down Expand Up @@ -822,7 +807,7 @@ MibSCutGenerator::intersectionCuts(BcpsConstraintPool &conPool,
//#############################################################################
bool
MibSCutGenerator::findLowerLevelSol(double *uselessIneqs, double *lowerLevelSol,
const double *sol, bool &isTimeLimReached)
const double *sol)
{

std::string feasCheckSolver(localModel_->MibSPar_->entry
Expand Down Expand Up @@ -1025,7 +1010,6 @@ MibSCutGenerator::findLowerLevelSol(double *uselessIneqs, double *lowerLevelSol,
remainingTime = timeLimit - localModel_->broker_->subTreeTimer().getTime();

if(remainingTime <= localModel_->etol_){
isTimeLimReached = true;
localModel_->setTimeLimitReached(); // YX: replace shouldPrune_ by timeout
}
else{
Expand Down Expand Up @@ -1081,7 +1065,6 @@ MibSCutGenerator::findLowerLevelSol(double *uselessIneqs, double *lowerLevelSol,
if((feasCheckSolver == "SYMPHONY") && (sym_is_time_limit_reached
(dynamic_cast<OsiSymSolverInterface *>
(nSolver)->getSymphonyEnvironment()))){
isTimeLimReached = true;
localModel_->setTimeLimitReached(); // YX: replace shouldPrune_ by timeout
}
else if(nSolver->isProvenOptimal()){
Expand Down Expand Up @@ -1286,7 +1269,7 @@ MibSCutGenerator::solveModelIC(double *uselessIneqs, double *ray, double *rhs,
//#############################################################################
bool
MibSCutGenerator::findLowerLevelSolImprovingDirectionIC(double *uselessIneqs, double *lowerLevelSol,
double* lpSol, bool &isTimeLimReached)
double* lpSol)
{
std::string feasCheckSolver(localModel_->MibSPar_->entry
(MibSParams::feasCheckSolver));
Expand Down Expand Up @@ -1541,7 +1524,6 @@ MibSCutGenerator::findLowerLevelSolImprovingDirectionIC(double *uselessIneqs, do
(dynamic_cast<OsiSymSolverInterface *>
(nSolver)->getSymphonyEnvironment())))
|| (timeLimit - localModel_->broker_->subTreeTimer().getTime() < 3)){
isTimeLimReached = true;
localModel_->setTimeLimitReached(); // YX: replace shouldPrune_ by timeout
}
else if(nSolver->isProvenOptimal()){
Expand Down
5 changes: 2 additions & 3 deletions src/MibSCutGenerator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ class MibSCutGenerator : public BlisConGenerator {
int intersectionCuts(BcpsConstraintPool &conPool,
double *optLowerSolution, MibSIntersectionCutType ICType);
/** Helper function for IC*/
bool findLowerLevelSol(double *uselessIneqs, double *lowerLevelSol, const double *sol,
bool &isTimeLimReached);
bool findLowerLevelSol(double *uselessIneqs, double *lowerLevelSol, const double *sol);

/** Helper function for IC*/
bool getAlphaIC(double** extRay, double *uselessIneqs, double* lowerSolution, int numStruct,
Expand All @@ -97,7 +96,7 @@ class MibSCutGenerator : public BlisConGenerator {

/** Helper function for ImprovingDirectionIC **/
bool findLowerLevelSolImprovingDirectionIC(double *uselessIneqs, double *lowerLevelSol,
double* lpSol, bool &isTimeLimReached);
double* lpSol);

/** Helper function for ImprovingDirectionIC*/
bool getAlphaImprovingDirectionIC(double** extRay, double *uselessIneqs, double* lowerSolution,
Expand Down

0 comments on commit 3c033fd

Please sign in to comment.