/** creates the random branching rule and includes it in SCIP */ SCIP_RETCODE SCIPincludeBranchruleRandom( SCIP* scip /**< SCIP data structure */ ) { SCIP_BRANCHRULEDATA* branchruledata; SCIP_BRANCHRULE* branchrule; /* create random branching rule data */ SCIP_CALL( SCIPallocMemory(scip, &branchruledata) ); branchruledata->seed = 0; /* include allfullstrong branching rule */ SCIP_CALL( SCIPincludeBranchruleBasic(scip, &branchrule, BRANCHRULE_NAME, BRANCHRULE_DESC, BRANCHRULE_PRIORITY, BRANCHRULE_MAXDEPTH, BRANCHRULE_MAXBOUNDDIST, branchruledata) ); assert(branchrule != NULL); /* set non-fundamental callbacks via specific setter functions*/ SCIP_CALL( SCIPsetBranchruleCopy(scip, branchrule, branchCopyRandom) ); SCIP_CALL( SCIPsetBranchruleFree(scip, branchrule, branchFreeRandom) ); SCIP_CALL( SCIPsetBranchruleInit(scip, branchrule, branchInitRandom) ); SCIP_CALL( SCIPsetBranchruleExecLp(scip, branchrule, branchExeclpRandom) ); SCIP_CALL( SCIPsetBranchruleExecExt(scip, branchrule, branchExecextRandom) ); SCIP_CALL( SCIPsetBranchruleExecPs(scip, branchrule, branchExecpsRandom) ); SCIP_CALL( SCIPaddIntParam(scip, "branching/" BRANCHRULE_NAME "/seed", "initial random seed value", &branchruledata->initseed, FALSE, DEFAULT_INITSEED, 0, INT_MAX, NULL, NULL) ); return SCIP_OKAY; }
/** creates the nodereopt branching rule and includes it in SCIP */ SCIP_RETCODE SCIPincludeBranchruleNodereopt( SCIP* scip /**< SCIP data structure */ ) { SCIP_BRANCHRULE* branchrule; SCIP_BRANCHRULEDATA* branchruledata; assert(scip != NULL ); /* no branching rule data */ branchruledata = NULL; /* include nodereopt branching rule */ SCIP_CALL( SCIPincludeBranchruleBasic(scip, &branchrule, BRANCHRULE_NAME, BRANCHRULE_DESC, BRANCHRULE_PRIORITY, BRANCHRULE_MAXDEPTH, BRANCHRULE_MAXBOUNDDIST, branchruledata)); assert(branchrule != NULL ); /* set non fundamental callbacks via setter functions */ SCIP_CALL(SCIPsetBranchruleExecLp(scip, branchrule, branchExeclpnodereopt)); SCIP_CALL(SCIPsetBranchruleExecExt(scip, branchrule, branchExecextnodereopt)); SCIP_CALL(SCIPsetBranchruleExecPs(scip, branchrule, branchExecpsnodereopt)); return SCIP_OKAY; }
/** creates the all variables full strong LP branching rule and includes it in SCIP */ SCIP_RETCODE SCIPincludeBranchruleAllfullstrong( SCIP* scip /**< SCIP data structure */ ) { SCIP_BRANCHRULEDATA* branchruledata; SCIP_BRANCHRULE* branchrule; /* create allfullstrong branching rule data */ SCIP_CALL( SCIPallocMemory(scip, &branchruledata) ); branchruledata->lastcand = 0; branchruledata->skipup = NULL; branchruledata->skipdown = NULL; /* include allfullstrong branching rule */ SCIP_CALL( SCIPincludeBranchruleBasic(scip, &branchrule, BRANCHRULE_NAME, BRANCHRULE_DESC, BRANCHRULE_PRIORITY, BRANCHRULE_MAXDEPTH, BRANCHRULE_MAXBOUNDDIST, branchruledata) ); assert(branchrule != NULL); /* set non-fundamental callbacks via specific setter functions*/ SCIP_CALL( SCIPsetBranchruleCopy(scip, branchrule, branchCopyAllfullstrong) ); SCIP_CALL( SCIPsetBranchruleFree(scip, branchrule, branchFreeAllfullstrong) ); SCIP_CALL( SCIPsetBranchruleInit(scip, branchrule, branchInitAllfullstrong) ); SCIP_CALL( SCIPsetBranchruleExecLp(scip, branchrule, branchExeclpAllfullstrong) ); SCIP_CALL( SCIPsetBranchruleExecPs(scip, branchrule, branchExecpsAllfullstrong) ); return SCIP_OKAY; }
/** creates the myfullstrong branching rule and includes it in SCIP */ SCIP_RETCODE SCIPincludeBranchruleMyfullstrong( SCIP* scip /**< SCIP data structure */ ) { SCIP_BRANCHRULEDATA* branchruledata; SCIP_BRANCHRULE* branchrule; /* create myfullstrong branching rule data */ SCIP_CALL( SCIPallocMemory(scip, &branchruledata) ); /* TODO: (optional) create branching rule specific data here */ /* include branching rule */ SCIP_CALL( SCIPincludeBranchruleBasic(scip, &branchrule, BRANCHRULE_NAME, BRANCHRULE_DESC, BRANCHRULE_PRIORITY, BRANCHRULE_MAXDEPTH, BRANCHRULE_MAXBOUNDDIST, branchruledata) ); assert(branchrule != NULL); /* set non fundamental callbacks via setter functions */ SCIP_CALL( SCIPsetBranchruleCopy(scip, branchrule, branchCopyMyfullstrong) ); SCIP_CALL( SCIPsetBranchruleFree(scip, branchrule, branchFreeMyfullstrong) ); SCIP_CALL( SCIPsetBranchruleInit(scip, branchrule, branchInitMyfullstrong) ); SCIP_CALL( SCIPsetBranchruleExit(scip, branchrule, branchExitMyfullstrong) ); SCIP_CALL( SCIPsetBranchruleExecPs(scip, branchrule, branchExecpsMyfullstrong) ); #if 0 SCIP_CALL( SCIPsetBranchruleInitsol(scip, branchrule, branchInitsolMyfullstrong) ); SCIP_CALL( SCIPsetBranchruleExitsol(scip, branchrule, branchExitsolMyfullstrong) ); SCIP_CALL( SCIPsetBranchruleExecExt(scip, branchrule, branchExecextMyfullstrong) ); SCIP_CALL( SCIPsetBranchruleExecLp(scip, branchrule, branchExeclpMyfullstrong) ); #endif return SCIP_OKAY; }
/** creates the inference history branching rule and includes it in SCIP */ SCIP_RETCODE SCIPincludeBranchruleInference( SCIP* scip /**< SCIP data structure */ ) { SCIP_BRANCHRULEDATA* branchruledata; SCIP_BRANCHRULE* branchrule; /* create inference branching rule data */ SCIP_CALL( SCIPallocMemory(scip, &branchruledata) ); /* include branching rule */ SCIP_CALL( SCIPincludeBranchruleBasic(scip, &branchrule, BRANCHRULE_NAME, BRANCHRULE_DESC, BRANCHRULE_PRIORITY, BRANCHRULE_MAXDEPTH, BRANCHRULE_MAXBOUNDDIST, branchruledata) ); assert(branchrule != NULL); /* set non-fundamental callbacks via specific setter functions*/ SCIP_CALL( SCIPsetBranchruleCopy(scip, branchrule, branchCopyInference) ); SCIP_CALL( SCIPsetBranchruleFree(scip, branchrule, branchFreeInference) ); SCIP_CALL( SCIPsetBranchruleExecLp(scip, branchrule, branchExeclpInference) ); SCIP_CALL( SCIPsetBranchruleExecExt(scip, branchrule, branchExecextInference) ); SCIP_CALL( SCIPsetBranchruleExecPs(scip, branchrule, branchExecpsInference) ); /* inference branching rule parameters */ SCIP_CALL( SCIPaddRealParam(scip, "branching/inference/conflictweight", "weight in score calculations for conflict score", &branchruledata->conflictweight, TRUE, DEFAULT_CONFLICTWEIGHT, 0.0, SCIP_REAL_MAX, NULL, NULL) ); SCIP_CALL( SCIPaddRealParam(scip, "branching/inference/inferenceweight", "weight in score calculations for inference score", &branchruledata->inferenceweight, TRUE, DEFAULT_INFERENCEWEIGHT, SCIP_REAL_MIN, SCIP_REAL_MAX, NULL, NULL) ); SCIP_CALL( SCIPaddRealParam(scip, "branching/inference/cutoffweight", "weight in score calculations for cutoff score", &branchruledata->cutoffweight, TRUE, DEFAULT_CUTOFFWEIGHT, 0.0, SCIP_REAL_MAX, NULL, NULL) ); SCIP_CALL( SCIPaddBoolParam(scip, "branching/inference/fractionals", "should branching on LP solution be restricted to the fractional variables?", &branchruledata->fractionals, TRUE, DEFAULT_FRACTIONALS, NULL, NULL) ); SCIP_CALL( SCIPaddBoolParam(scip, "branching/inference/useweightedsum", "should a weighted sum of inference, conflict and cutoff weights be used?", &branchruledata->useweightedsum, FALSE, DEFAULT_USEWEIGHTEDSUM, NULL, NULL) ); /* inference branching rule parameters */ SCIP_CALL( SCIPaddRealParam(scip, "branching/inference/reliablescore", "weight in score calculations for conflict score", &branchruledata->reliablescore, TRUE, DEFAULT_RELIABLESCORE, 0.0, SCIP_REAL_MAX, NULL, NULL) ); return SCIP_OKAY; }