Skip to content

Commit

Permalink
rplc shouldPrune when timeout in const generation
Browse files Browse the repository at this point in the history
  • Loading branch information
yuxies committed Nov 3, 2023
1 parent f1d6d7d commit 386df86
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 21 deletions.
40 changes: 21 additions & 19 deletions src/MibSCutGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -583,11 +583,12 @@ MibSCutGenerator::intersectionCuts(BcpsConstraintPool &conPool,
delete [] lowerLevelSol;
goto TERM_INTERSECTIONCUT;
}
if(isTimeLimReached == true){
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 Down Expand Up @@ -621,11 +622,12 @@ MibSCutGenerator::intersectionCuts(BcpsConstraintPool &conPool,
delete [] lowerLevelSol;
goto TERM_INTERSECTIONCUT;
}
if(isTimeLimReached == true){
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 @@ -1023,8 +1025,8 @@ MibSCutGenerator::findLowerLevelSol(double *uselessIneqs, double *lowerLevelSol,
remainingTime = timeLimit - localModel_->broker_->subTreeTimer().getTime();

if(remainingTime <= localModel_->etol_){
isTimeLimReached = true;
localModel_->bS_->shouldPrune_ = true;
isTimeLimReached = true;
localModel_->setTimeLimitReached(); // YX: replace shouldPrune_ by timeout
}
else{
remainingTime = CoinMax(remainingTime, 0.00);
Expand Down Expand Up @@ -1080,7 +1082,7 @@ MibSCutGenerator::findLowerLevelSol(double *uselessIneqs, double *lowerLevelSol,
(dynamic_cast<OsiSymSolverInterface *>
(nSolver)->getSymphonyEnvironment()))){
isTimeLimReached = true;
localModel_->bS_->shouldPrune_ = true;
localModel_->setTimeLimitReached(); // YX: replace shouldPrune_ by timeout
}
else if(nSolver->isProvenOptimal()){
const double *optSol = nSolver->getColSolution();
Expand Down Expand Up @@ -1539,8 +1541,8 @@ MibSCutGenerator::findLowerLevelSolImprovingDirectionIC(double *uselessIneqs, do
(dynamic_cast<OsiSymSolverInterface *>
(nSolver)->getSymphonyEnvironment())))
|| (timeLimit - localModel_->broker_->subTreeTimer().getTime() < 3)){
isTimeLimReached = true;
localModel_->bS_->shouldPrune_ = true;
isTimeLimReached = true;
localModel_->setTimeLimitReached(); // YX: replace shouldPrune_ by timeout
}
else if(nSolver->isProvenOptimal()){
const double *optSol = nSolver->getColSolution();
Expand Down Expand Up @@ -1735,8 +1737,8 @@ MibSCutGenerator::storeBestSolHypercubeIC(const double* lpSol, double optLowerOb
remainingTime = timeLimit - localModel_->broker_->subTreeTimer().getTime();

if(remainingTime <= localModel_->etol_){
isTimeLimReached = true;
bS->shouldPrune_ = true;
isTimeLimReached = true;
localModel_->setTimeLimitReached(); // YX: replace shouldPrune_ by timeout
}
else{
remainingTime = CoinMax(remainingTime, 0.00);
Expand Down Expand Up @@ -1800,8 +1802,8 @@ MibSCutGenerator::storeBestSolHypercubeIC(const double* lpSol, double optLowerOb
if((feasCheckSolver == "SYMPHONY") && (sym_is_time_limit_reached
(dynamic_cast<OsiSymSolverInterface *>
(UBSolver)->getSymphonyEnvironment()))){
isTimeLimReached = true;
bS->shouldPrune_ = true;
isTimeLimReached = true;
localModel_->setTimeLimitReached(); // YX: replace shouldPrune_ by timeout
}
else if(UBSolver->isProvenOptimal()){
MibSSolution *mibsSol = new MibSSolution(numCols,
Expand Down
7 changes: 5 additions & 2 deletions src/MibSTreeNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -771,8 +771,11 @@ MibSTreeNode::process(bool isRoot, bool rampUp)
setStatus(AlpsNodeStatusFathomed);
quality_ = -ALPS_OBJ_MAX;
goto TERM_PROCESS;
}

}else if(mibsModel->isTimeLimitReached()){
// YX: mark node as partially processed
setStatus(AlpsNodeStatusEvaluated);
goto TERM_PROCESS;
}

if (lpStatus != BlisLpStatusOptimal) {
setStatus(AlpsNodeStatusFathomed);
Expand Down

0 comments on commit 386df86

Please sign in to comment.