Skip to content

Commit d00e0a8

Browse files
committed
style and remove unused code
1 parent 6a13030 commit d00e0a8

File tree

1 file changed

+41
-53
lines changed

1 file changed

+41
-53
lines changed

src/scip/branch_relpscost.c

Lines changed: 41 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
* better than the best strong-branching or pseudo-candidate? */
105105
#define DEFAULT_STARTRANDSEED 5 /**< start random seed for random number generation */
106106
#define DEFAULT_DYNAMICLOOKAHEAD TRUE /**< should we use a dynamic lookahead based on a tree size estimation of further strong branchings? */
107-
#define DEFAULT_MINSAMPLESIZE 20 /**< minimum sample size to estimate the tree size for dynamic lookahead */
107+
#define DEFAULT_MINSAMPLESIZE 10 /**< minimum sample size to estimate the tree size for dynamic lookahead */
108108
#define DEFAULT_DYNAMICLOOKDISTRIBUTION 1 /**< which distribution should be used for dynamic lookahead? 0=exponential, 1=Pareto, 2=log-normal */
109109
#define DEFAULT_RANDINITORDER FALSE /**< should slight perturbation of scores be used to break ties in the prior scores? */
110110
#define DEFAULT_USESMALLWEIGHTSITLIM FALSE /**< should smaller weights be used for pseudo cost updates after hitting the LP iteration limit? */
@@ -152,7 +152,6 @@ struct SCIP_BranchruleData
152152
SCIP_Real sumlogmeangains; /**< sum of logarithms of all means of the dual gains */
153153
SCIP_Real logstdevgain; /**< logarithm of the standard deviation of the means of the dual gains */
154154
SCIP_Real nzerogains; /**< number of zero dual gains */
155-
int ndualgains; /**< number of dual gains used in the computation of the mean */
156155
int currndualgains; /**< number of dual gains used in the computation of the mean from current node */
157156
int sbiterofs; /**< additional number of allowed strong branching LP iterations */
158157
int maxlookahead; /**< maximal number of further variables evaluated without better score */
@@ -862,8 +861,8 @@ SCIP_RETCODE updateMinMaxMeanGain(
862861
/* Compute the depth of the tree with the assumption that left and right dual gains are equal */
863862
static
864863
SCIP_Real strongBranchingDepth(
865-
SCIP_Real gap,
866-
SCIP_Real maxmeangain
864+
SCIP_Real gap, /**< gap to be closed */
865+
SCIP_Real maxmeangain /**< maximum mean gain of the branching candidates */
867866
)
868867
{
869868
assert(maxmeangain >= 0.0);
@@ -876,22 +875,22 @@ SCIP_Real strongBranchingDepth(
876875
/* Compute the size of the tree with the assumption that left and right dual gains are equal */
877876
static
878877
SCIP_Real strongBranchingTreeSize(
879-
SCIP_Real depth_tree
878+
SCIP_Real estimatedepth /**< estimated depth of the tree */
880879
)
881880
{
882-
return pow(2.0, depth_tree + 1.0) - 1.0;
881+
return pow(2.0, estimatedepth + 1.0) - 1.0;
883882
}
884883

885884
/* Calculate the cumulative distribution function (CDF) value for an exponential distribution. */
886885
static
887886
SCIP_Real cdfProbability(
888-
SCIP_Real rate,
889-
SCIP_Real zeroprob,
890-
SCIP_Real proposedgain,
891-
SCIP_Real mingain,
892-
SCIP_Real logmeangain,
893-
SCIP_Real logstdevgain,
894-
int distributioncdf
887+
SCIP_Real rate, /** rate of the distribution */
888+
SCIP_Real zeroprob, /** probability of zero gain */
889+
SCIP_Real proposedgain, /** proposed gain */
890+
SCIP_Real mingain, /** minimum gain */
891+
SCIP_Real logmeangain, /** logarithm og mean gain */
892+
SCIP_Real logstdevgain, /** logarithm of standard deviation of gain */
893+
int distributioncdf /** distribution type (PARETODISTRIBUTION, EXPONENTIALDISTRIBUTION, LOGNORMALDISTRIBUTION) */
895894
)
896895
{
897896
if(distributioncdf == PARETODISTRIBUTION)
@@ -917,15 +916,15 @@ SCIP_Real cdfProbability(
917916
/* Calculate the expected size of a tree with one more iteration of strong branching */
918917
static
919918
SCIP_Real expectedTreeSize(
920-
SCIP* scip,
921-
SCIP_Real gap,
922-
SCIP_Real zeroprob,
923-
SCIP_Real currentdepth,
924-
SCIP_Real lambda,
925-
SCIP_Real mingain,
926-
SCIP_Real logmeangain,
927-
SCIP_Real logstdevgain,
928-
int distributioncdf
919+
SCIP* scip, /** SCIP data structure */
920+
SCIP_Real gap, /** gap to be closed */
921+
SCIP_Real zeroprob, /** probability of zero gain */
922+
SCIP_Real currentdepth, /** current depth of the tree */
923+
SCIP_Real lambda, /** rate of the distribution */
924+
SCIP_Real mingain, /** minimum gain */
925+
SCIP_Real logmeangain, /** logarithm of mean gain */
926+
SCIP_Real logstdevgain, /** logarithm of standard deviation of gain */
927+
int distributioncdf /** distribution type (PARETODISTRIBUTION, EXPONENTIALDISTRIBUTION, LOGNORMALDISTRIBUTION) */
929928
)
930929
{
931930

@@ -999,15 +998,15 @@ SCIP_Real expectedTreeSize(
999998
/* Decide if we continue strong branching based based on lookahead */
1000999
static
10011000
SCIP_Bool continueStrongBranchingLookahead(
1002-
SCIP* scip,
1003-
int candidx,
1004-
int ninitcands,
1005-
SCIP_Real lookahead,
1006-
SCIP_Real maxlookahead,
1007-
int nbdchgs,
1008-
int nbdconflicts,
1009-
int maxbdchgs,
1010-
SCIP_Longint maxnsblpiterations
1001+
SCIP* scip, /**< SCIP data structure */
1002+
int candidx, /**< index of the branching candidate */
1003+
int ninitcands, /**< number of initial candidates */
1004+
SCIP_Real lookahead, /**< lookahead value */
1005+
SCIP_Real maxlookahead, /**< maximum lookahead value */
1006+
int nbdchgs, /**< number of bound changes found */
1007+
int nbdconflicts, /**< number of bound conflicts found */
1008+
int maxbdchgs, /**< maximal number of bound tightenings before the node is reevaluated */
1009+
SCIP_Longint maxnsblpiterations /**< maximal number of strong branching LP iterations */
10111010
)
10121011
{
10131012
return candidx < ninitcands && lookahead < maxlookahead && nbdchgs + nbdconflicts < maxbdchgs
@@ -1017,10 +1016,10 @@ SCIP_Bool continueStrongBranchingLookahead(
10171016
/** Decide if we continue strong branching based on the estimation of the tree size given the current gains. */
10181017
static
10191018
SCIP_Bool continueStrongBranchingTreeSizeEstimation(
1020-
SCIP* scip,
1021-
SCIP_BRANCHRULEDATA* branchruledata,
1022-
SCIP_Real lookahead,
1023-
SCIP_Real maxlookahead
1019+
SCIP* scip, /**< SCIP data structure */
1020+
SCIP_BRANCHRULEDATA* branchruledata, /**< branching rule data */
1021+
SCIP_Real lookahead, /**< lookahead value */
1022+
SCIP_Real maxlookahead /**< maximum lookahead value */
10241023
)
10251024
{
10261025
SCIP_Real lambda;
@@ -1615,7 +1614,10 @@ SCIP_RETCODE execRelpscost(
16151614

16161615
mingains[c] = MIN(downgain, upgain);
16171616
maxgains[c] = MAX(downgain, upgain);
1618-
SCIP_CALL( updateMinMaxMeanGain(scip, branchrule, downgain, upgain) );
1617+
1618+
if( branchruledata->dynamiclookahead )
1619+
SCIP_CALL( updateMinMaxMeanGain(scip, branchrule, downgain, upgain) );
1620+
16191621
SCIPdebugMsg(scip, " -> strong branching on variable <%s> already performed (down=%g (%+g), up=%g (%+g), pscostscore=%g)\n",
16201622
SCIPvarGetName(branchcands[c]), down, downgain, up, upgain, pscostscore);
16211623
}
@@ -1708,11 +1710,9 @@ SCIP_RETCODE execRelpscost(
17081710
}
17091711

17101712
/* initialize unreliable candidates with strong branching until maxlookahead is reached,
1711-
* search best strong branching candidate,
1712-
* Given the dynamiclookaheadquot we allow dynamiclookaheadquot percent more and less lookahead
1713+
* search best strong branching candidate
17131714
*/
17141715
maxlookahead = (SCIP_Real)branchruledata->maxlookahead * (1.0 + (SCIP_Real)nuninitcands/(SCIP_Real)nbranchcands);
1715-
17161716
inititer = branchruledata->inititer;
17171717
if( inititer == 0 )
17181718
{
@@ -1944,7 +1944,8 @@ SCIP_RETCODE execRelpscost(
19441944
assert(downinf || !downconflict);
19451945
assert(upinf || !upconflict);
19461946

1947-
SCIP_CALL( updateMinMaxMeanGain(scip, branchrule, downgain, upgain) );
1947+
if( branchruledata->dynamiclookahead )
1948+
SCIP_CALL( updateMinMaxMeanGain(scip, branchrule, downgain, upgain) );
19481949

19491950
/* @todo: store pseudo cost only for valid bounds?
19501951
* depending on the user parameter choice of storesemiinitcosts, pseudo costs are also updated in single directions,
@@ -2459,18 +2460,6 @@ SCIP_DECL_BRANCHEXECLP(branchExeclpRelpscost)
24592460
branchruledata->sumlogmeangains = 0.0;
24602461
branchruledata->logstdevgain = 0.0;
24612462
branchruledata->nzerogains = 0;
2462-
if( branchruledata->ndualgains + branchruledata->currndualgains > 0 )
2463-
{
2464-
/* update mean dual gain */
2465-
int total = branchruledata->ndualgains + branchruledata->currndualgains;
2466-
branchruledata->meandualgain = ((SCIP_Real) branchruledata->ndualgains / total ) * branchruledata->meandualgain
2467-
+ ((SCIP_Real) branchruledata->currndualgains / total ) * branchruledata->currmeandualgain;
2468-
branchruledata->ndualgains += branchruledata->currndualgains;
2469-
2470-
}
2471-
branchruledata->currmeandualgain = 0.0;
2472-
branchruledata->currndualgains = 0;
2473-
SCIPdebugMsg(scip," -> mean dual gain of previous nodes: mean of %d dual gains: %g\n", branchruledata->ndualgains, branchruledata->meandualgain);
24742463

24752464
/* determine whether we should run filtering */
24762465
runfiltering = ! branchruledata->nosymmetry && branchruledata->filtercandssym && SCIPgetSubscipDepth(scip) == 0 && ! SCIPinDive(scip) && ! SCIPinProbing(scip);
@@ -2539,7 +2528,6 @@ SCIP_RETCODE SCIPincludeBranchruleRelpscost(
25392528
branchruledata->npermvars = 0;
25402529
branchruledata->permvarmap = NULL;
25412530
branchruledata->meandualgain = 0.0;
2542-
branchruledata->ndualgains = 0;
25432531
branchruledata->currmeandualgain = 0.0;
25442532
branchruledata->currndualgains = 0;
25452533
branchruledata->maxmeangain = -SCIPinfinity(scip);

0 commit comments

Comments
 (0)