36 #define BRANCHRULE_NAME "inference" 37 #define BRANCHRULE_DESC "inference history branching" 38 #define BRANCHRULE_PRIORITY 1000 39 #define BRANCHRULE_MAXDEPTH -1 40 #define BRANCHRULE_MAXBOUNDDIST 1.0 49 #define DEFAULT_CONFLICTWEIGHT 1000.0 50 #define DEFAULT_CUTOFFWEIGHT 1.0 51 #define DEFAULT_INFERENCEWEIGHT 1.0 52 #define DEFAULT_RELIABLESCORE 0.001 53 #define DEFAULT_FRACTIONALS TRUE 54 #define DEFAULT_USEWEIGHTEDSUM TRUE 59 struct SCIP_BranchruleData
83 if( (*bestscore) < score )
88 (*bestbranchpoint) = branchpoint;
89 (*bestbranchdir) = branchdir;
91 else if( (*bestscore) == score )
117 (*bestbranchpoint) = branchpoint;
118 (*bestbranchdir) = branchdir;
135 if( (*bestscore) < score )
138 (*bestscore) = score;
142 else if( (*bestscore) == score )
197 if( conflictscore < reliablescore )
201 if( cutoffscore < reliablescore )
205 score = conflictweight * conflictscore + cutoffweight * cutoffscore;
207 if( score > *bestscore )
209 (*bestscore) = score;
210 (*branchpoint) = value;
235 if( conflictscore < reliablescore )
239 if( cutoffscore < reliablescore )
243 return (conflictweight * conflictscore + inferenceweight * cutoffscore);
267 if( valuehistory !=
NULL )
278 for( v = 0; v < nvalues; ++v )
332 bestvaluescore = 0.0;
333 bestvaluecand =
NULL;
336 assert(result !=
NULL);
345 bestaggrcand = cands[0];
346 bestvaluecand = cands[0];
347 assert(cands[0] !=
NULL);
349 if( candsols ==
NULL )
354 bestvaluescore =
getValueScore(scip, cands[0], conflictweight, cutoffweight, reliablescore, &bestbranchpoint, &bestbranchdir);
355 SCIPdebugMsg(scip,
"current best value candidate <%s>[%g,%g] %s <%g> (value %g)\n",
360 bestval = candsols[0];
363 bestaggrscore =
getAggrScore(scip, cands[0], conflictweight, inferenceweight, cutoffweight, reliablescore);
365 for( c = 1; c < ncands; ++c )
374 assert(cand !=
NULL);
376 if( candsols ==
NULL )
383 valuescore =
getValueScore(scip, cand, conflictweight, cutoffweight, reliablescore, &branchpoint, &branchdir);
386 evaluateValueCand(cand, valuescore, branchpoint, branchdir, &bestvaluecand, &bestvaluescore, &bestbranchpoint, &bestbranchdir);
388 SCIPdebugMsg(scip,
"current best value candidate <%s>[%g,%g] %s <%g> (value %g)\n",
396 aggrscore =
getAggrScore(scip, cand, conflictweight, inferenceweight, cutoffweight, reliablescore);
402 evaluateAggrCand(cand, aggrscore, val, &bestaggrcand, &bestaggrscore, &bestval);
409 bestaggrcand = cands[0];
410 assert(cands[0] !=
NULL);
412 if( candsols !=
NULL )
413 bestval = candsols[0];
420 for( c = 1; c < ncands; ++c )
427 assert(cand !=
NULL);
429 if( candsols !=
NULL )
439 if( aggrscore < reliablescore )
446 evaluateAggrCand(cand, aggrscore, val, &bestaggrcand, &bestaggrscore, &bestval);
450 assert(bestaggrcand !=
NULL);
452 SCIPdebugMsg(scip,
" -> %d candidates, selected variable <%s>[%g,%g] (prio=%d, solval=%.12f, score=%g, conflict=%g cutoff=%g, inference=%g)\n",
459 if( candsols !=
NULL )
475 assert(bestvaluecand !=
NULL);
483 downub = bestbranchpoint;
484 uplb = bestbranchpoint + 1.0;
489 downub = bestbranchpoint - 1.0;
490 uplb = bestbranchpoint;
516 if( downchild !=
NULL || eqchild !=
NULL || upchild !=
NULL )
539 assert(branchrule !=
NULL);
574 assert(branchruledata !=
NULL);
576 if( branchruledata->fractionals )
589 branchruledata->inferenceweight, branchruledata->cutoffweight, branchruledata->reliablescore,
590 branchruledata->useweightedsum, result) );
609 assert(branchruledata !=
NULL);
617 branchruledata->inferenceweight, branchruledata->cutoffweight, branchruledata->reliablescore,
618 branchruledata->useweightedsum, result) );
635 assert(branchruledata !=
NULL);
642 branchruledata->inferenceweight, branchruledata->cutoffweight, branchruledata->reliablescore,
643 branchruledata->useweightedsum, result) );
668 assert(branchrule !=
NULL);
679 "branching/inference/conflictweight",
680 "weight in score calculations for conflict score",
683 "branching/inference/inferenceweight",
684 "weight in score calculations for inference score",
687 "branching/inference/cutoffweight",
688 "weight in score calculations for cutoff score",
691 "branching/inference/fractionals",
692 "should branching on LP solution be restricted to the fractional variables?",
695 "branching/inference/useweightedsum",
696 "should a weighted sum of inference, conflict and cutoff weights be used?",
700 "branching/inference/reliablescore",
701 "weight in score calculations for conflict score",
enum SCIP_Result SCIP_RESULT
SCIP_RETCODE SCIPgetLPBranchCands(SCIP *scip, SCIP_VAR ***lpcands, SCIP_Real **lpcandssol, SCIP_Real **lpcandsfrac, int *nlpcands, int *npriolpcands, int *nfracimplvars)
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)
SCIP_RETCODE SCIPincludeBranchruleInference(SCIP *scip)
SCIP_BRANCHRULEDATA * SCIPbranchruleGetData(SCIP_BRANCHRULE *branchrule)
SCIP_RETCODE SCIPsetBranchruleExecPs(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHEXECPS((*branchexecps)))
SCIP_Real SCIPgetVarAvgInferenceCutoffScore(SCIP *scip, SCIP_VAR *var, SCIP_Real cutoffweight)
#define DEFAULT_USEWEIGHTEDSUM
#define DEFAULT_CONFLICTWEIGHT
SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
static SCIP_Real getValueScore(SCIP *scip, SCIP_VAR *var, SCIP_Real conflictweight, SCIP_Real cutoffweight, SCIP_Real reliablescore, SCIP_Real *branchpoint, SCIP_BRANCHDIR *branchdir)
SCIP_RETCODE SCIPchgVarLbNode(SCIP *scip, SCIP_NODE *node, SCIP_VAR *var, SCIP_Real newbound)
struct SCIP_BranchruleData SCIP_BRANCHRULEDATA
SCIP_VALUEHISTORY * SCIPvarGetValuehistory(SCIP_VAR *var)
SCIP_Real SCIPgetBranchingPoint(SCIP *scip, SCIP_VAR *var, SCIP_Real suggestion)
SCIP_RETCODE SCIPsetBranchruleFree(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHFREE((*branchfree)))
#define DEFAULT_CUTOFFWEIGHT
SCIP_RETCODE SCIPsetBranchruleCopy(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHCOPY((*branchcopy)))
enum SCIP_Retcode SCIP_RETCODE
static SCIP_DECL_BRANCHCOPY(branchCopyInference)
#define SCIPfreeBlockMemory(scip, ptr)
SCIP_Real SCIPhistoryGetVSIDS(SCIP_HISTORY *history, SCIP_BRANCHDIR dir)
SCIP_RETCODE SCIPincludeBranchruleBasic(SCIP *scip, SCIP_BRANCHRULE **branchruleptr, const char *name, const char *desc, int priority, int maxdepth, SCIP_Real maxbounddist, SCIP_BRANCHRULEDATA *branchruledata)
SCIP_RETCODE SCIPchgVarUbNode(SCIP *scip, SCIP_NODE *node, SCIP_VAR *var, SCIP_Real newbound)
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)
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_RETCODE SCIPgetExternBranchCands(SCIP *scip, SCIP_VAR ***externcands, SCIP_Real **externcandssol, SCIP_Real **externcandsscore, int *nexterncands, int *nprioexterncands, int *nprioexternbins, int *nprioexternints, int *nprioexternimpls)
#define SCIPallocBlockMemory(scip, ptr)
static SCIP_DECL_BRANCHEXECEXT(branchExecextInference)
static SCIP_Real getAggrScore(SCIP *scip, SCIP_VAR *var, SCIP_Real conflictweight, SCIP_Real inferenceweight, SCIP_Real cutoffweight, SCIP_Real reliablescore)
SCIP_RETCODE SCIPsetBranchruleExecLp(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHEXECLP((*branchexeclp)))
enum SCIP_BranchDir SCIP_BRANCHDIR
int SCIPvaluehistoryGetNValues(SCIP_VALUEHISTORY *valuehistory)
SCIP_RETCODE SCIPbranchVar(SCIP *scip, SCIP_VAR *var, SCIP_NODE **downchild, SCIP_NODE **eqchild, SCIP_NODE **upchild)
#define DEFAULT_INFERENCEWEIGHT
static SCIP_DECL_BRANCHFREE(branchFreeInference)
const char * SCIPvarGetName(SCIP_VAR *var)
SCIP_RETCODE SCIPcreateChild(SCIP *scip, SCIP_NODE **node, SCIP_Real nodeselprio, SCIP_Real estimate)
SCIP_RETCODE SCIPbranchVarVal(SCIP *scip, SCIP_VAR *var, SCIP_Real val, SCIP_NODE **downchild, SCIP_NODE **eqchild, SCIP_NODE **upchild)
SCIP_RETCODE SCIPgetPseudoBranchCands(SCIP *scip, SCIP_VAR ***pseudocands, int *npseudocands, int *npriopseudocands)
#define BRANCHRULE_MAXBOUNDDIST
int SCIPvarGetBranchPriority(SCIP_VAR *var)
void SCIPbranchruleSetData(SCIP_BRANCHRULE *branchrule, SCIP_BRANCHRULEDATA *branchruledata)
SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
SCIP_RETCODE SCIPsetBranchruleExecExt(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHEXECEXT((*branchexecext)))
#define DEFAULT_FRACTIONALS
#define DEFAULT_RELIABLESCORE
SCIP_Real SCIPcalcChildEstimate(SCIP *scip, SCIP_VAR *var, SCIP_Real targetvalue)
SCIP_Real SCIPhistoryGetCutoffSum(SCIP_HISTORY *history, SCIP_BRANCHDIR dir)
SCIP_Real * SCIPvaluehistoryGetValues(SCIP_VALUEHISTORY *valuehistory)
static SCIP_RETCODE performBranching(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)
static SCIP_DECL_BRANCHEXECLP(branchExeclpInference)
SCIP_HISTORY ** SCIPvaluehistoryGetHistories(SCIP_VALUEHISTORY *valuehistory)
const char * SCIPbranchruleGetName(SCIP_BRANCHRULE *branchrule)
static void evaluateAggrCand(SCIP_VAR *cand, SCIP_Real score, SCIP_Real val, SCIP_VAR **bestcand, SCIP_Real *bestscore, SCIP_Real *bestval)
inference history branching rule
static SCIP_DECL_BRANCHEXECPS(branchExecpsInference)
int SCIPvarGetIndex(SCIP_VAR *var)
SCIP_Real SCIPgetVarSol(SCIP *scip, SCIP_VAR *var)
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
SCIP_Real SCIPgetVarAvgInferenceScore(SCIP *scip, SCIP_VAR *var)
#define BRANCHRULE_PRIORITY
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)
#define BRANCHRULE_MAXDEPTH
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_Real SCIPgetVarConflictScore(SCIP *scip, SCIP_VAR *var)