Skip to content

Commit

Permalink
Allowing branching on linking variables even when doing fractional br…
Browse files Browse the repository at this point in the history
…anching to accpount for some cases where cut generation fails
  • Loading branch information
tkralphs committed Nov 29, 2024
1 parent 1945f94 commit 88488b2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
15 changes: 13 additions & 2 deletions src/MibSBranchStrategyPseudo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,17 +158,28 @@ MibSBranchStrategyPseudo::createCandBranchObjects(int numPassesLeft, double ub)
}
}

// Check for fractional lower level variables variables
// Check for fractional lower level variables
if(branchPar == MibSBranchingStrategyLower){
for (i = 0; i < numCols; ++i) {
if (fabs(floor(solution[i] + 0.5) - solution[i]) > etol &&
varType[i] == MibSVarLower){
varType[i] == MibSVarLower && colType[i] == 'C'){
fractionalLowerVar = true;
break;
}
}
}

// Check for fractional variables overall
if(branchPar == MibSBranchingStrategyFractional){
for (i = 0; i < numCols; ++i) {
if (fabs(floor(solution[i] + 0.5) - solution[i]) > etol &&
colType[i] != 'C'){
branchPar = MibSBranchingStrategyLinking;
break;
}
}
}

for (i = 0; i < numCols; ++i) {
if(colType[i] == 'C'){
candidate[i] = false;
Expand Down
14 changes: 7 additions & 7 deletions src/MibSCutGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1245,7 +1245,7 @@ MibSCutGenerator::solveModelIC(double *uselessIneqs, double *ray, double *rhs,
}
}

assert(alphaUb >= 0);
//assert(alphaUb >= 0);

if(isUnbounded == false){
alpha = alphaUb;
Expand Down Expand Up @@ -6062,17 +6062,17 @@ MibSCutGenerator::generateConstraints(BcpsConstraintPool &conPool)
if (localModel_->MibSPar_->entry(MibSParams::bilevelFreeSetTypeISIC) ==
MibSBilevelFreeSetTypeISICWithLLOptSol && haveSecondLevelSol &&
relaxedObjVal <= localModel_->bS_->objVal_ + localModel_->etol_){
localModel_->counterFracISICFail_++;
localModel_->counterLIntISICFail_++;
}else if ((localModel_->MibSPar_->entry(MibSParams::bilevelFreeSetTypeISIC) ==
MibSBilevelFreeSetTypeISICWithLLOptSol && haveSecondLevelSol) ||
localModel_->MibSPar_->entry(MibSParams::bilevelFreeSetTypeISIC) ==
MibSBilevelFreeSetTypeISICWithNewLLSol){
cutType = MibSIntersectionCutImprovingSolution;
returnVal = intersectionCuts(conPool, bS->optLowerSolutionOrd_, cutType);
if (returnVal){
localModel_->counterFracISIC_++;
localModel_->counterLIntISIC_++;
}else{
localModel_->counterFracISICFail_++;
localModel_->counterLIntISICFail_++;
}
numCuts += returnVal;
}
Expand Down Expand Up @@ -6127,17 +6127,17 @@ MibSCutGenerator::generateConstraints(BcpsConstraintPool &conPool)
if (localModel_->MibSPar_->entry(MibSParams::bilevelFreeSetTypeISIC) ==
MibSBilevelFreeSetTypeISICWithLLOptSol && haveSecondLevelSol &&
relaxedObjVal <= localModel_->bS_->objVal_ + localModel_->etol_){
localModel_->counterFracISICFail_++;
localModel_->counterYIntISICFail_++;
}else if ((localModel_->MibSPar_->entry(MibSParams::bilevelFreeSetTypeISIC) ==
MibSBilevelFreeSetTypeISICWithLLOptSol && haveSecondLevelSol) ||
localModel_->MibSPar_->entry(MibSParams::bilevelFreeSetTypeISIC) ==
MibSBilevelFreeSetTypeISICWithNewLLSol){
cutType = MibSIntersectionCutImprovingSolution;
returnVal = intersectionCuts(conPool, bS->optLowerSolutionOrd_, cutType);
if (returnVal){
localModel_->counterFracISIC_++;
localModel_->counterYIntISIC_++;
}else{
localModel_->counterFracISICFail_++;
localModel_->counterYIntISICFail_++;
}
numCuts += returnVal;
}
Expand Down

0 comments on commit 88488b2

Please sign in to comment.