53#define BRANCHRULE_NAME "inference"
54#define BRANCHRULE_DESC "inference history branching"
55#define BRANCHRULE_PRIORITY 1000
56#define BRANCHRULE_MAXDEPTH -1
57#define BRANCHRULE_MAXBOUNDDIST 1.0
66#define DEFAULT_CONFLICTWEIGHT 1000.0
67#define DEFAULT_CUTOFFWEIGHT 1.0
68#define DEFAULT_INFERENCEWEIGHT 1.0
69#define DEFAULT_RELIABLESCORE 0.001
70#define DEFAULT_FRACTIONALS TRUE
71#define DEFAULT_USEWEIGHTEDSUM TRUE
73#define DEFAULT_CONFLICTPRIO 1
74#define DEFAULT_CUTOFFPRIO 1
79struct SCIP_BranchruleData
105 if( *bestscore < score )
110 *bestbranchpoint = branchpoint;
111 *bestbranchdir = branchdir;
113 else if( (*bestscore) == score )
139 *bestbranchpoint = branchpoint;
140 *bestbranchdir = branchdir;
161 if( *bestscore < score )
174 bestcands[*nbestcands] = cand;
188 for(
c = 0;
c < nbestcands; ++
c )
213 bestcands[0] = bestcands[
c];
242 if( conflictscore < reliablescore )
246 if( cutoffscore < reliablescore )
250 score = conflictweight * conflictscore + cutoffweight * cutoffscore;
252 if( score > *bestscore )
254 (*bestscore) = score;
255 (*branchpoint) = value;
280 if( conflictscore < reliablescore )
284 if( cutoffscore < reliablescore )
288 return (conflictweight * conflictscore + inferenceweight * cutoffscore);
311 if( valuehistory !=
NULL )
322 for( v = 0; v < nvalues; ++v )
366 bestaggrcand = cands[0];
369 bestval = candsols[0];
370 bestcands[0] = cands[0];
374 bestaggrscore =
getAggrScore(
scip, cands[0], conflictweight, inferenceweight, cutoffweight, reliablescore);
376 for(
c = 1;
c < ncands; ++
c )
388 aggrscore =
getAggrScore(
scip, cand, conflictweight, inferenceweight, cutoffweight, reliablescore);
395 evaluateAggrCand(
scip, cand, aggrscore, val, &bestaggrcand, &bestaggrscore, &bestval, bestcands, nbestcands);
433 if( useweightedsum ==
FALSE )
437 conflictweight = 0.0;
438 inferenceweight = 1.0;
446 if( conflictprio > cutoffprio )
450 bestcands, &nbestcands);
456 selectBestCands(
scip, bestcands, candsols, nbestcands, 0.0, inferenceweight, cutoffweight, reliablescore,
457 bestcands, &nbestcands);
460 else if( conflictprio == cutoffprio )
463 selectBestCands(
scip, cands, candsols, ncands, conflictweight, inferenceweight, cutoffweight, reliablescore,
464 bestcands, &nbestcands);
468 assert(conflictprio < cutoffprio);
471 selectBestCands(
scip, cands, candsols, ncands, 0.0, inferenceweight, cutoffweight, reliablescore,
472 bestcands, &nbestcands);
479 selectBestCands(
scip, bestcands, candsols, nbestcands, conflictweight, 0.0, 0.0, reliablescore,
480 bestcands, &nbestcands);
484 assert(nbestcands == 0 || bestcands[0] !=
NULL);
495 bestaggrcand = bestcands[0];
499 for(
c = 0;
c < ncands; ++
c )
501 if( bestaggrcand == cands[
c] )
503 bestval = candsols[
c];
515 SCIPdebugMsg(
scip,
" -> %d candidates, selected variable <%s>[%g,%g] (prio=%d, solval=%.12f, conflict=%g cutoff=%g, inference=%g)\n",
525 if( downchild !=
NULL || eqchild !=
NULL || upchild !=
NULL )
569 bestvaluecand =
NULL;
585 bestaggrcand = cands[0];
586 bestvaluecand = cands[0];
592 bestvaluescore =
getValueScore(cands[0], conflictweight, cutoffweight, reliablescore, &bestbranchpoint, &bestbranchdir);
593 SCIPdebugMsg(
scip,
"current best value candidate <%s>[%g,%g] %s <%g> (value %g)\n",
598 bestaggrscore =
getAggrScore(
scip, cands[0], conflictweight, inferenceweight, cutoffweight, reliablescore);
600 for(
c = 1;
c < ncands; ++
c )
615 valuescore =
getValueScore(cand, conflictweight, cutoffweight, reliablescore, &branchpoint, &branchdir);
618 evaluateValueCand(cand, valuescore, branchpoint, branchdir, &bestvaluecand, &bestvaluescore, &bestbranchpoint, &bestbranchdir);
620 SCIPdebugMsg(
scip,
"current best value candidate <%s>[%g,%g] %s <%g> (value %g)\n",
625 aggrscore =
getAggrScore(
scip, cand, conflictweight, inferenceweight, cutoffweight, reliablescore);
632 evaluateAggrCand(
scip, cand, aggrscore, val, &bestaggrcand, &bestaggrscore, &bestval, bestcands, &nbestcands);
639 bestaggrcand = cands[0];
647 for(
c = 1;
c < ncands; ++
c )
663 if( aggrscore < reliablescore )
670 evaluateAggrCand(
scip, cand, aggrscore, val, &bestaggrcand, &bestaggrscore, &bestval, bestcands, &nbestcands);
679 SCIPdebugMsg(
scip,
" -> %d candidates, selected variable <%s>[%g,%g] (prio=%d, solval=%.12f, score=%g, conflict=%g cutoff=%g, inference=%g)\n",
706 downub = bestbranchpoint;
707 uplb = bestbranchpoint + 1.0;
712 downub = bestbranchpoint - 1.0;
713 uplb = bestbranchpoint;
738 if( downchild !=
NULL || eqchild !=
NULL || upchild !=
NULL )
799 if( branchruledata->fractionals )
812 branchruledata->inferenceweight, branchruledata->cutoffweight, branchruledata->reliablescore,
813 branchruledata->useweightedsum,
result) );
840 branchruledata->inferenceweight, branchruledata->cutoffweight, branchruledata->reliablescore,
841 branchruledata->useweightedsum,
result, branchruledata->conflictprio, branchruledata->cutoffprio) );
865 branchruledata->inferenceweight, branchruledata->cutoffweight, branchruledata->reliablescore,
866 branchruledata->useweightedsum,
result) );
902 "branching/inference/conflictweight",
903 "weight in score calculations for conflict score",
906 "branching/inference/inferenceweight",
907 "weight in score calculations for inference score",
910 "branching/inference/cutoffweight",
911 "weight in score calculations for cutoff score",
914 "branching/inference/fractionals",
915 "should branching on LP solution be restricted to the fractional variables?",
918 "branching/inference/useweightedsum",
919 "should a weighted sum of inference, conflict and cutoff weights be used?",
923 "branching/inference/reliablescore",
924 "weight in score calculations for conflict score",
928 "branching/inference/conflictprio",
929 "priority value for using conflict weights in lex. order",
932 "branching/inference/cutoffprio",
933 "priority value for using cutoff weights in lex. order",
#define BRANCHRULE_PRIORITY
#define BRANCHRULE_MAXDEPTH
#define BRANCHRULE_MAXBOUNDDIST
static void evaluateAggrCand(SCIP *scip, SCIP_VAR *cand, SCIP_Real score, SCIP_Real val, SCIP_VAR **bestcand, SCIP_Real *bestscore, SCIP_Real *bestval, SCIP_VAR **bestcands, int *nbestcands)
static void tiebreakAggrCand(SCIP_VAR **bestcands, int nbestcands)
static SCIP_RETCODE performBranchingSol(SCIP *scip, SCIP_VAR **cands, SCIP_Real *candsols, int ncands, SCIP_Real conflictweight, SCIP_Real inferenceweight, SCIP_Real cutoffweight, SCIP_Real reliablescore, SCIP_Bool useweightedsum, SCIP_RESULT *result, int conflictprio, int cutoffprio)
static void evaluateValueCand(SCIP_VAR *cand, SCIP_Real score, SCIP_Real branchpoint, SCIP_BRANCHDIR branchdir, SCIP_VAR **bestcand, SCIP_Real *bestscore, SCIP_Real *bestbranchpoint, SCIP_BRANCHDIR *bestbranchdir)
#define DEFAULT_CONFLICTPRIO
static void selectBestCands(SCIP *scip, SCIP_VAR **cands, SCIP_Real *candsols, int ncands, SCIP_Real conflictweight, SCIP_Real inferenceweight, SCIP_Real cutoffweight, SCIP_Real reliablescore, SCIP_VAR **bestcands, int *nbestcands)
#define DEFAULT_INFERENCEWEIGHT
static SCIP_Real getAggrScore(SCIP *scip, SCIP_VAR *var, SCIP_Real conflictweight, SCIP_Real inferenceweight, SCIP_Real cutoffweight, SCIP_Real reliablescore)
#define DEFAULT_USEWEIGHTEDSUM
#define DEFAULT_CONFLICTWEIGHT
static void checkValueScore(SCIP_Real value, SCIP_HISTORY *history, SCIP_BRANCHDIR dir, SCIP_Real conflictweight, SCIP_Real cutoffweight, SCIP_Real reliablescore, SCIP_Real *bestscore, SCIP_Real *branchpoint, SCIP_BRANCHDIR *branchdir)
#define DEFAULT_FRACTIONALS
#define DEFAULT_CUTOFFWEIGHT
static SCIP_Real getValueScore(SCIP_VAR *var, SCIP_Real conflictweight, SCIP_Real cutoffweight, SCIP_Real reliablescore, SCIP_Real *branchpoint, SCIP_BRANCHDIR *branchdir)
#define DEFAULT_RELIABLESCORE
static SCIP_RETCODE performBranchingNoSol(SCIP *scip, SCIP_VAR **cands, int ncands, SCIP_Real conflictweight, SCIP_Real inferenceweight, SCIP_Real cutoffweight, SCIP_Real reliablescore, SCIP_Bool useweightedsum, SCIP_RESULT *result)
#define DEFAULT_CUTOFFPRIO
inference history branching rule
#define SCIP_STRINGEQ(name, reference, retcode)
SCIP_RETCODE SCIPincludeBranchruleInference(SCIP *scip)
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)
SCIP_RETCODE SCIPincludeBranchruleBasic(SCIP *scip, SCIP_BRANCHRULE **branchruleptr, const char *name, const char *desc, int priority, int maxdepth, SCIP_Real maxbounddist, SCIP_BRANCHRULEDATA *branchruledata)
const char * SCIPbranchruleGetName(SCIP_BRANCHRULE *branchrule)
SCIP_BRANCHRULEDATA * SCIPbranchruleGetData(SCIP_BRANCHRULE *branchrule)
SCIP_RETCODE SCIPsetBranchruleExecExt(SCIP *scip, SCIP_BRANCHRULE *branchrule,)
SCIP_RETCODE SCIPsetBranchruleCopy(SCIP *scip, SCIP_BRANCHRULE *branchrule,)
SCIP_RETCODE SCIPsetBranchruleExecLp(SCIP *scip, SCIP_BRANCHRULE *branchrule,)
void SCIPbranchruleSetData(SCIP_BRANCHRULE *branchrule, SCIP_BRANCHRULEDATA *branchruledata)
SCIP_RETCODE SCIPsetBranchruleFree(SCIP *scip, SCIP_BRANCHRULE *branchrule,)
SCIP_RETCODE SCIPsetBranchruleExecPs(SCIP *scip, SCIP_BRANCHRULE *branchrule,)
SCIP_RETCODE SCIPgetExternBranchCands(SCIP *scip, SCIP_VAR ***externcands, SCIP_Real **externcandssol, SCIP_Real **externcandsscore, int *nexterncands, int *nprioexterncands, int *nprioexternbins, int *nprioexternints, int *nprioexternimpls)
SCIP_Real SCIPgetBranchingPoint(SCIP *scip, SCIP_VAR *var, SCIP_Real suggestion)
SCIP_Real SCIPcalcChildEstimate(SCIP *scip, SCIP_VAR *var, SCIP_Real targetvalue)
SCIP_RETCODE SCIPbranchVarVal(SCIP *scip, SCIP_VAR *var, SCIP_Real val, SCIP_NODE **downchild, SCIP_NODE **eqchild, SCIP_NODE **upchild)
SCIP_RETCODE SCIPgetLPBranchCands(SCIP *scip, SCIP_VAR ***lpcands, SCIP_Real **lpcandssol, SCIP_Real **lpcandsfrac, int *nlpcands, int *npriolpcands, int *nfracimplvars)
SCIP_RETCODE SCIPbranchVar(SCIP *scip, SCIP_VAR *var, SCIP_NODE **downchild, SCIP_NODE **eqchild, SCIP_NODE **upchild)
SCIP_RETCODE SCIPgetPseudoBranchCands(SCIP *scip, SCIP_VAR ***pseudocands, int *npseudocands, int *npriopseudocands)
SCIP_RETCODE SCIPcreateChild(SCIP *scip, SCIP_NODE **node, SCIP_Real nodeselprio, SCIP_Real estimate)
#define SCIPallocClearBufferArray(scip, ptr, num)
#define SCIPallocBufferArray(scip, ptr, num)
#define SCIPfreeBufferArray(scip, ptr)
#define SCIPfreeBlockMemory(scip, ptr)
#define SCIPallocBlockMemory(scip, ptr)
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Real SCIPgetVarAvgInferenceScore(SCIP *scip, SCIP_VAR *var)
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
SCIP_RETCODE SCIPchgVarUbNode(SCIP *scip, SCIP_NODE *node, SCIP_VAR *var, SCIP_Real newbound)
SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
int SCIPvarGetIndex(SCIP_VAR *var)
const char * SCIPvarGetName(SCIP_VAR *var)
SCIP_Real SCIPgetVarSol(SCIP *scip, SCIP_VAR *var)
SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
int SCIPvarGetBranchPriority(SCIP_VAR *var)
SCIP_Real SCIPgetVarConflictScore(SCIP *scip, SCIP_VAR *var)
SCIP_RETCODE SCIPchgVarLbNode(SCIP *scip, SCIP_NODE *node, SCIP_VAR *var, SCIP_Real newbound)
SCIP_Real SCIPgetVarAvgInferenceCutoffScore(SCIP *scip, SCIP_VAR *var, SCIP_Real cutoffweight)
SCIP_VALUEHISTORY * SCIPvarGetValuehistory(SCIP_VAR *var)
int SCIPvaluehistoryGetNValues(SCIP_VALUEHISTORY *valuehistory)
SCIP_HISTORY ** SCIPvaluehistoryGetHistories(SCIP_VALUEHISTORY *valuehistory)
SCIP_Real * SCIPvaluehistoryGetValues(SCIP_VALUEHISTORY *valuehistory)
assert(minobj< SCIPgetCutoffbound(scip))
SCIP_Real SCIPhistoryGetCutoffSum(SCIP_HISTORY *history, SCIP_BRANCHDIR dir)
SCIP_Real SCIPhistoryGetVSIDS(SCIP_HISTORY *history, SCIP_BRANCHDIR dir)
public methods for branching rules
public methods for branching and inference history structure
public methods for message output
public methods for problem variables
public methods for branching rule plugins and branching
public methods for memory management
public methods for message handling
public methods for numerical tolerances
public methods for SCIP parameter handling
public methods for SCIP variables
#define SCIP_DECL_BRANCHEXECPS(x)
#define SCIP_DECL_BRANCHEXECLP(x)
#define SCIP_DECL_BRANCHEXECEXT(x)
#define SCIP_DECL_BRANCHCOPY(x)
#define SCIP_DECL_BRANCHFREE(x)
struct SCIP_Branchrule SCIP_BRANCHRULE
struct SCIP_BranchruleData SCIP_BRANCHRULEDATA
struct SCIP_History SCIP_HISTORY
@ SCIP_BRANCHDIR_DOWNWARDS
struct SCIP_ValueHistory SCIP_VALUEHISTORY
enum SCIP_BranchDir SCIP_BRANCHDIR
enum SCIP_Result SCIP_RESULT
enum SCIP_Retcode SCIP_RETCODE
struct SCIP_Node SCIP_NODE