From 3c033fd84fbfb7617d14da1195c7ab49db7a5536 Mon Sep 17 00:00:00 2001 From: Yu Xie Date: Tue, 7 Nov 2023 15:42:19 -0500 Subject: [PATCH] rm unused isTimeLimReached from findLowerSol(IDIC) --- src/MibSCutGenerator.cpp | 26 ++++---------------------- src/MibSCutGenerator.hpp | 5 ++--- 2 files changed, 6 insertions(+), 25 deletions(-) diff --git a/src/MibSCutGenerator.cpp b/src/MibSCutGenerator.cpp index 5254764b..f8a67253 100644 --- a/src/MibSCutGenerator.cpp +++ b/src/MibSCutGenerator.cpp @@ -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); @@ -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; @@ -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 @@ -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{ @@ -1081,7 +1065,6 @@ MibSCutGenerator::findLowerLevelSol(double *uselessIneqs, double *lowerLevelSol, if((feasCheckSolver == "SYMPHONY") && (sym_is_time_limit_reached (dynamic_cast (nSolver)->getSymphonyEnvironment()))){ - isTimeLimReached = true; localModel_->setTimeLimitReached(); // YX: replace shouldPrune_ by timeout } else if(nSolver->isProvenOptimal()){ @@ -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)); @@ -1541,7 +1524,6 @@ MibSCutGenerator::findLowerLevelSolImprovingDirectionIC(double *uselessIneqs, do (dynamic_cast (nSolver)->getSymphonyEnvironment()))) || (timeLimit - localModel_->broker_->subTreeTimer().getTime() < 3)){ - isTimeLimReached = true; localModel_->setTimeLimitReached(); // YX: replace shouldPrune_ by timeout } else if(nSolver->isProvenOptimal()){ diff --git a/src/MibSCutGenerator.hpp b/src/MibSCutGenerator.hpp index 08328407..521873e4 100644 --- a/src/MibSCutGenerator.hpp +++ b/src/MibSCutGenerator.hpp @@ -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, @@ -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,