assert(value !=
NULL);
143assert(ind1 >= 0 && ind2 >= 0);
145diffval = value[ind1] - value[ind2];
148 else if( diffval > 0.0)
186assert(ndominated !=
NULL);
187assert(dominated !=
NULL);
195 for( origindex=0; origindex<size; ++origindex )
196permb[origindex] = origindex;
205bestcurrenta =
a[permb[0]];
208currentb =
b[permb[0]];
210bestcurrents[0] = permb[0];
214 for( indexinpermb = 1; indexinpermb < size; ++indexinpermb )
216origindex = permb[indexinpermb];
217assert(
b[origindex] <= currentb);
223 if( bestcurrenta > besta )
225 for( iterbestcurrent=0; iterbestcurrent < nbestcurrent; ++iterbestcurrent )
226dominated[bestcurrents[iterbestcurrent]] =
FALSE;
228besta = bestcurrenta;
232 for( iterbestcurrent = 0; iterbestcurrent < nbestcurrent; ++iterbestcurrent )
234dominated[bestcurrents[iterbestcurrent]] =
TRUE;
238bestcurrenta =
a[origindex];
239currentb =
b[origindex];
240bestcurrents[0] = origindex;
249 for( iterbestcurrent = 0; iterbestcurrent < nbestcurrent; ++iterbestcurrent )
251dominated[bestcurrents[iterbestcurrent]] =
TRUE;
255bestcurrenta =
a[origindex];
256bestcurrents[0] = origindex;
264bestcurrents[nbestcurrent] = origindex;
269dominated[origindex] =
TRUE;
276 if( bestcurrenta > besta )
278 for( iterbestcurrent = 0; iterbestcurrent < nbestcurrent; ++iterbestcurrent )
279dominated[bestcurrents[iterbestcurrent]] =
FALSE;
283 for( iterbestcurrent = 0; iterbestcurrent < nbestcurrent; ++iterbestcurrent )
285dominated[bestcurrents[iterbestcurrent]] =
TRUE;
306assert(branchratio !=
NULL);
307assert(branchratio->
valid);
312 if( leftgain > 0.0 && rightgain > 0.0 )
314result = pow(branchratio->
upratio, rightgain * branchratio->
invleft) - pow(branchratio->
upratio, (rightgain - leftgain) * branchratio->
invleft) - 1;
318 return(result > 0.0);
347 r= rightgain / leftgain;
354branchratio->
invleft= 1.0 / leftgain;
363branchratio->
invleft= 1.0 / leftgain;
373newratio = pow(2.0, 1.0/
r);
388 for( iters = 0; ((iters <= 5 && !
SCIPisEQ(
scip, ratio, newratio)) ||
390&& iters < treemodel->
maxfpiter&& newratio > 1.0; iters++ )
392 doubleG, H,
a, p, p1, p2, phi_r;
395phi_r = pow(ratio,
r);
396p = phi_r - phi_r / ratio - 1.0;
399p1 = (
r* phi_r - (
r- 1.0) * phi_r / ratio) / ratio;
400p2 = (
r* (
r- 1.0) * phi_r - (
r- 1.0) * (
r- 2.0) * phi_r / ratio) / ratio / ratio;
402H = G * G - (p2 / p);
403 a=
r/ (G + (G >= 0 ? 1.0 : -1.0) * sqrt((
r- 1.0) * (
r* H - G * G)));
404newratio = ratio -
a;
413 for( iters = 0; ((iters <= 10 && !
SCIPisEQ(
scip, ratio, newratio)) ||
415&& iters < treemodel->
maxfpiter&& newratio > 1; iters++ )
418newratio = pow(1.0-1.0/ratio, -1.0/
r);
427 if( iters < treemodel->maxfpiter && newratio > 1.0 )
430branchratio->
upratio= (ratio + newratio) / 2.0;
431branchratio->
invleft= 1.0 / leftgain;
466 intreferencevar = *bestcand;
467 computeVarRatio(
scip, treemodel, branchcands[referencevar], mingains[referencevar], maxgains[referencevar], &bestbranchratio);
469 for( c = 0; c < nbranchcands; ++c )
471 if( (!filterdominated || !dominated[c]) && c != referencevar )
475 computeVarRatio(
scip, treemodel, branchcands[c], mingains[c], maxgains[c], &branchratio);
476 if( branchratio.
valid)
479bestbranchratio = branchratio;
513scaledgain = maxgain / mingain;
514scaledgap = absgap / mingain;
516mindepth = (int)
SCIPceil(
scip, scaledgap / scaledgain);
522gaptoreach = scaledgap * (treemodel->
maxsvtsheight- 1) / mindepth;
525assert(gaptoreach > scaledgain);
529gaptoreach = scaledgap;
532mindepth = (int) ceil(gaptoreach / scaledgain);
533assert(mindepth <= treemodel->maxsvtsheight);
537 for( nr = 1; nr <= mindepth; ++nr )
540 for( ir = 1; ir <= nr; ++ir )
542binomcoeff *= (nr + ceil((gaptoreach - (nr - 1) * scaledgain)) - ir) / ir;
544treesize += binomcoeff;
547treesize = 2.0 * treesize - 1.0;
561 if( branchratio.
valid)
562prediction = treesize * pow(branchratio.
upratio, (scaledgap - gaptoreach) * branchratio.
invleft);
567prediction = treesize;
603besttscand = *bestcand;
604referencevar = *bestcand;
611referencetreesize =
computeSVTS(
scip, treemodel, branchcands[referencevar], localabsgap, mingains[referencevar],
612maxgains[referencevar]);
616treesizes[referencevar] = referencetreesize;
618 for( c = 0; c < nbranchcands; ++c )
620 if( !filterdominated || !dominated[c] )
622 if( c != referencevar )
623treesizes[c] =
computeSVTS(
scip, treemodel, branchcands[c], localabsgap, mingains[c], maxgains[c]);
625treesizes[c] = referencetreesize;
627avgtreesize += treesizes[c];
632avgtreesize = avgtreesize / (nbranchcands - ndominated);
634 for( c = 0; c < nbranchcands; ++c )
636score = (1.0 - 1.0 / (1.0 + avgtreesize / treesizes[c])) + 0.01 * tiebreakerscore[c];
637 if(score > bestscore)
644*bestcand = besttscand;
652nbranchcands, bestcand) );
659nbranchcands, bestcand) );
703 if( branchratio.
valid)
707 intkl = (int)ceil(absgap / leftgain);
708 intkr = (int)ceil(absgap / rightgain);
709 intk = (int)ceil(absgap / (leftgain + rightgain));
715leftsize = (
integerpow(phi_l, kl + 1) - 1.0) / (phi_l - 1.0);
716rightsize = (
integerpow(phi_r, kr + 1) - 1.0) / (phi_r - 1.0);
718 if( k * (leftgain + rightgain) < absgap + rightgain )
719midsize = (1.0 + phi_l) * (phi_klr * phi_lr - 1.0) / (phi_lr - 1.0) - phi_klr * phi_l;
721midsize = (1.0 + phi_l) * (phi_klr - 1.0) / (phi_lr - 1.0);
723prediction = (leftsize + rightsize + midsize) / 3.0;
762besttscand = *bestcand;
763referencevar = *bestcand;
770referencetreesize =
computeSampleTreesize(
scip, treemodel, branchcands[referencevar], localabsgap, mingains[referencevar],
771maxgains[referencevar]);
776treesizes[referencevar] = referencetreesize;
778 for( c = 0; c < nbranchcands; ++c )
780 if( !filterdominated || !dominated[c] )
782 if( c != referencevar )
785treesizes[c] = referencetreesize;
787avgtreesize += treesizes[c];
792avgtreesize = avgtreesize / (nbranchcands - ndominated);
794 for( c = 0; c < nbranchcands; ++c )
796score = (1.0 - 1.0 / (1.0 + avgtreesize / treesizes[c])) + 0.01 * tiebreakerscore[c];
797 if( score > bestscore )
804*bestcand = besttscand;
812nbranchcands, bestcand) );
819nbranchcands, bestcand) );
831assert(treemodel !=
NULL);
833assert(*treemodel !=
NULL);
836 "should candidate branching variables be scored using the Treemodel branching rules?",
840 "scoring function to use at nodes predicted to be high in the tree ('d'efault, 's'vts, 'r'atio, 't'ree sample)",
844 "scoring function to use at nodes predicted to be low in the tree ('d'efault, 's'vts, 'r'atio, 't'ree sample)",
848 "estimated tree height at which we switch from using the low rule to the high rule",
852 "should dominated candidates be filtered before using the high scoring function? ('a'uto, 't'rue, 'f'alse)",
856 "should dominated candidates be filtered before using the low scoring function? ('a'uto, 't'rue, 'f'alse)",
860 "maximum number of fixed-point iterations when computing the ratio",
864 "maximum height to compute the SVTS score exactly before approximating",
868 "which method should be used as a fallback if the tree size estimates are infinite? ('d'efault, 'r'atio)",
872 "which method should be used as a fallback if there is no primal bound available? ('d'efault, 'r'atio)",
876 "threshold at which pseudocosts are considered small, making hybrid scores more likely to be the deciding factor in branching",
889assert(treemodel !=
NULL);
890assert(*treemodel !=
NULL);
894assert(*treemodel ==
NULL);
926 charscoringfunction;
929assert(treemodel !=
NULL);
931assert(*bestcand >= 0);
941&&
SCIPisLT(
scip, localabsgap/mingains[*bestcand], 1.0 * INT_MAX))
942bestcandheight = (int)(localabsgap/mingains[*bestcand]);
944bestcandheight = INT_MAX;
947 if( bestcandheight < treemodel->height )
949scoringfunction = treemodel->
lowrule;
954scoringfunction = treemodel->
highrule;
959 if( scoringfunction !=
'd')
967autofilter = (filtersetting ==
'a'&& (scoringfunction ==
's'|| scoringfunction ==
't'));
968filterdominated = (autofilter || filtersetting ==
't');
971 if( filterdominated )
983 switch( scoringfunction )
987localabsgap, filterdominated, dominated, nbranchcands, ndominated, bestcand) );
991dominated, nbranchcands, bestcand) );
995localabsgap, filterdominated, dominated, nbranchcands, ndominated, bestcand) );
1002 if( filterdominated )
1004assert(dominated !=
NULL);
SCIP_Real SCIPgetNodeLowerbound(SCIP *scip, SCIP_NODE *node)
SCIP_RETCODE SCIPaddCharParam(SCIP *scip, const char *name, const char *desc, char *valueptr, SCIP_Bool isadvanced, char defaultvalue, const char *allowedvalues, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
SCIP_RETCODE SCIPaddIntParam(SCIP *scip, const char *name, const char *desc, int *valueptr, SCIP_Bool isadvanced, int defaultvalue, int minvalue, int maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
SCIP_RETCODE SCIPaddRealParam(SCIP *scip, const char *name, const char *desc, SCIP_Real *valueptr, SCIP_Bool isadvanced, SCIP_Real defaultvalue, SCIP_Real minvalue, SCIP_Real maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
SCIP_RETCODE SCIPaddBoolParam(SCIP *scip, const char *name, const char *desc, SCIP_Bool *valueptr, SCIP_Bool isadvanced, SCIP_Bool defaultvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
#define SCIPallocBufferArray(scip, ptr, num)
#define SCIPfreeBufferArray(scip, ptr)
#define SCIPfreeBlockMemory(scip, ptr)
#define SCIPallocBlockMemory(scip, ptr)
SCIP_Real SCIPgetUpperbound(SCIP *scip)
SCIP_Real SCIPinfinity(SCIP *scip)
SCIP_Bool SCIPisGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisSumEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Real SCIPceil(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisZero(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_NODE * SCIPgetCurrentNode(SCIP *scip)
void SCIPsortDownInd(int *indarray, SCIP_DECL_SORTINDCOMP((*indcomp)), void *dataptr, int len)
void SCIPhistorySetRatioHistory(SCIP_HISTORY *history, SCIP_Bool valid, SCIP_Real ratio, SCIP_Real balance)
SCIP_Real SCIPhistoryGetLastRatio(SCIP_HISTORY *history)
SCIP_Bool SCIPhistoryIsRatioValid(SCIP_HISTORY *history)
SCIP_Real SCIPhistoryGetLastBalance(SCIP_HISTORY *history)
internal methods for branching and inference history
static SCIP_Real integerpow(SCIP_Real a, int b)
SCIP_RETCODE SCIPtreemodelSelectCandidate(SCIP *scip, SCIP_TREEMODEL *treemodel, SCIP_VAR **branchcands, SCIP_Real *mingains, SCIP_Real *maxgains, SCIP_Real *tiebreakerscore, int nbranchcands, int *bestcand)
SCIP_RETCODE SCIPtreemodelInit(SCIP *scip, SCIP_TREEMODEL **treemodel)
#define DEFAULT_FALLBACKNOPRIM
static SCIP_RETCODE findNonDominatedVars(SCIP *scip, SCIP_Real *a, SCIP_Real *b, int size, int *ndominated, SCIP_Bool *dominated)
static SCIP_RETCODE selectCandidateUsingSVTS(SCIP *scip, SCIP_TREEMODEL *treemodel, SCIP_VAR **branchcands, SCIP_Real *mingains, SCIP_Real *maxgains, SCIP_Real *tiebreakerscore, SCIP_Real localabsgap, SCIP_Bool filterdominated, SCIP_Bool *dominated, int nbranchcands, int ndominated, int *bestcand)
SCIP_RETCODE SCIPtreemodelFree(SCIP *scip, SCIP_TREEMODEL **treemodel)
#define DEFAULT_FILTERLOW
static SCIP_DECL_SORTINDCOMP(sciprealcomp)
static SCIP_Real computeSampleTreesize(SCIP *scip, SCIP_TREEMODEL *treemodel, SCIP_VAR *var, SCIP_Real absgap, SCIP_Real leftgain, SCIP_Real rightgain)
static SCIP_RETCODE selectCandidateUsingRatio(SCIP *scip, SCIP_TREEMODEL *treemodel, SCIP_VAR **branchcands, SCIP_Real *mingains, SCIP_Real *maxgains, SCIP_Bool filterdominated, SCIP_Bool *dominated, int nbranchcands, int *bestcand)
static SCIP_Bool hasBetterRatio(SCIP *scip, SCIP_RATIO *branchratio, SCIP_Real leftgain, SCIP_Real rightgain)
#define DEFAULT_SMALLPSCOST
#define DEFAULT_MAXFPITER
static SCIP_Real computeSVTS(SCIP *scip, SCIP_TREEMODEL *treemodel, SCIP_VAR *var, SCIP_Real absgap, SCIP_Real mingain, SCIP_Real maxgain)
SCIP_Bool SCIPtreemodelIsEnabled(SCIP *scip, SCIP_TREEMODEL *treemodel)
#define DEFAULT_FILTERHIGH
static void computeVarRatio(SCIP *scip, SCIP_TREEMODEL *treemodel, SCIP_VAR *var, SCIP_Real leftgain, SCIP_Real rightgain, SCIP_RATIO *branchratio)
#define LAGUERRE_THRESHOLD
static SCIP_RETCODE selectCandidateUsingSampling(SCIP *scip, SCIP_TREEMODEL *treemodel, SCIP_VAR **branchcands, SCIP_Real *mingains, SCIP_Real *maxgains, SCIP_Real *tiebreakerscore, SCIP_Real localabsgap, SCIP_Bool filterdominated, SCIP_Bool *dominated, int nbranchcands, int ndominated, int *bestcand)
#define DEFAULT_MAXSVTSHEIGHT
#define DEFAULT_FALLBACKINF
Branching rules based on the Single-Variable-Branching (SVB) model.
enum SCIP_Retcode SCIP_RETCODE
internal methods for problem variables
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4