Skip to content

Commit 3065eef

Browse files
committed
Add shadow and edge score as combination
1 parent 7f4f85f commit 3065eef

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

highs/mip/HighsSearch.cpp

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,10 @@ HighsInt HighsSearch::selectBranchingCandidate(int64_t maxSbIters,
265265
downscore.resize(numfrac, kHighsInf);
266266
upbound.resize(numfrac, getCurrentLowerBound());
267267
downbound.resize(numfrac, getCurrentLowerBound());
268-
if (!mipsolver.submip) shadowscore.resize(numfrac, 0.0);
269-
edgescore.resize(numfrac, 0.0);
268+
if (!mipsolver.submip) {
269+
shadowscore.resize(numfrac, 0.0);
270+
edgescore.resize(numfrac, 0.0);
271+
}
270272

271273
upscorereliable.resize(numfrac, 0);
272274
downscorereliable.resize(numfrac, 0);
@@ -356,7 +358,7 @@ HighsInt HighsSearch::selectBranchingCandidate(int64_t maxSbIters,
356358
// Get the edge weights assigned to the correct variables
357359
const double* edgeWt = lp->getLpSolver().getDualEdgeWeights();
358360
HighsInt numweightsstored = 0;
359-
if (edgeWt) {
361+
if (edgeWt && !mipsolver.submip) {
360362
const HighsInt* basisinds =
361363
lp->getLpSolver().getBasicVariablesArray();
362364
HighsInt numRow = lp->numRows();
@@ -817,16 +819,22 @@ HighsInt HighsSearch::selectBranchingCandidate(int64_t maxSbIters,
817819
}
818820

819821
if (!mipsolver.submip) {
820-
sortCandidates(shadowscore);
821-
if (numcands == 1) {
822-
downNodeLb = downbound[perm[0]];
823-
upNodeLb = upbound[perm[0]];
824-
return perm[0];
822+
double avgshadowscore = 0;
823+
double avgedgescore = 0;
824+
for (HighsInt i = 0; i < numfrac; i++) {
825+
avgshadowscore += shadowscore[i];
826+
avgedgescore += edgescore[i];
825827
}
826-
}
827-
828-
if (edgeWt) {
829-
sortCandidates(edgescore);
828+
avgshadowscore /= numfrac;
829+
avgedgescore /= numfrac;
830+
for (HighsInt i = 0; i < numfrac; i++) {
831+
shadowscore[i] = 1 - (1 / (1 + (shadowscore[i] / std::max(1e-6,
832+
avgshadowscore))));
833+
edgescore[i] = 1 - (1 / (1 + (edgescore[i] / std::max(1e-6,
834+
avgedgescore))));
835+
shadowscore[i] = shadowscore[i] + (1e-2 * edgescore[i]);
836+
}
837+
sortCandidates(shadowscore);
830838
if (numcands == 1) {
831839
downNodeLb = downbound[perm[0]];
832840
upNodeLb = upbound[perm[0]];

0 commit comments

Comments
 (0)