45 #define BRANCHRULE_NAME "allfullstrong" 46 #define BRANCHRULE_DESC "all variables full strong branching" 47 #define BRANCHRULE_PRIORITY -1000 48 #define BRANCHRULE_MAXDEPTH -1 49 #define BRANCHRULE_MAXBOUNDDIST 1.0 53 struct SCIP_BranchruleData
89 assert(branchrule != NULL);
92 assert(result != NULL);
104 assert(branchruledata != NULL);
106 if( branchruledata->skipdown == NULL )
108 assert(branchruledata->skipup == NULL);
119 assert(npseudocands > 0);
120 assert(npriopseudocands > 0);
125 npriopseudocands, &bestpseudocand, &bestdown, &bestup, &bestscore, &bestdownvalid, &bestupvalid, &provedbound, result) );
135 assert(0 <= bestpseudocand && bestpseudocand < npseudocands);
136 assert(
SCIPisLT(scip, provedbound, cutoffbound));
138 var = pseudocandscopy[bestpseudocand];
141 SCIPdebugMsg(scip,
" -> %d candidates, selected candidate %d: variable <%s>[%g,%g] (solval=%g, down=%g, up=%g, score=%g)\n",
143 bestdown, bestup, bestscore);
147 if( allcolsinlp && !exactsolve )
149 if( downchild != NULL )
154 if( eqchild != NULL )
159 if( upchild != NULL )
183 assert(
scip != NULL);
184 assert(branchrule != NULL);
219 branchruledata->lastcand = 0;
229 assert(result != NULL);
245 assert(result != NULL);
277 int npriopseudocands,
297 assert(scip != NULL);
298 assert(pseudocands != NULL);
299 assert(bestpseudocand != NULL);
300 assert(skipdown != NULL);
301 assert(skipup != NULL);
302 assert(bestdown != NULL);
303 assert(bestup != NULL);
304 assert(bestscore != NULL);
305 assert(bestdownvalid != NULL);
306 assert(bestupvalid != NULL);
307 assert(provedbound != NULL);
308 assert(result != NULL);
324 *bestdown = lpobjval;
326 *bestdownvalid =
TRUE;
329 *provedbound = lpobjval;
330 if( npseudocands > 1 )
354 assert(branchrule != NULL);
358 assert(branchruledata != NULL);
368 for( i = 0, c = branchruledata->lastcand; i < npseudocands; ++i, ++c )
370 c = c % npseudocands;
371 assert(pseudocands[c] != NULL);
380 SCIPdebugMsg(scip,
"applying strong branching on %s variable <%s>[%g,%g] with solution %g\n",
390 skipdown[c] ? NULL : &down, skipup[c] ? NULL : &up, &downvalid, &upvalid, &downinf, &upinf, &downconflict, &upconflict, &lperror) );
395 skipdown[c] ? NULL : &down, skipup[c] ? NULL : &up, &downvalid, &upvalid, &downinf, &upinf, &downconflict, &upconflict, &lperror) );
409 "(node %" SCIP_LONGINT_FORMAT
") error in strong branching call for variable <%s> with solution %g\n",
415 down =
MAX(down, lpobjval);
416 up =
MAX(up, lpobjval);
417 downgain = down - lpobjval;
418 upgain = up - lpobjval;
419 assert(!allcolsinlp || exactsolve || !downvalid || downinf ==
SCIPisGE(scip, down, cutoffbound));
420 assert(!allcolsinlp || exactsolve || !upvalid || upinf ==
SCIPisGE(scip, up, cutoffbound));
421 assert(downinf || !downconflict);
422 assert(upinf || !upconflict);
425 if( downinf || upinf )
430 if( downinf && upinf )
442 SCIPdebugMsg(scip,
" -> integral variable <%s> is infeasible in both directions\n",
450 SCIPdebugMsg(scip,
" -> fractional variable <%s> is infeasible in both directions\n",
485 else if( allcolsinlp && !exactsolve && downvalid && upvalid )
490 minbound = MIN(down, up);
491 *provedbound =
MAX(*provedbound, minbound);
495 if( c < npriopseudocands )
523 if( score > *bestscore )
528 *bestdownvalid = downvalid;
529 *bestupvalid = upvalid;
542 solval-
SCIPfeasCeil(scip, solval-1.0), downgain, 1.0) );
550 SCIPdebugMsg(scip,
" -> var <%s> (solval=%g, downgain=%g, upgain=%g, score=%g) -- best: <%s> (%g)\n",
556 branchruledata->lastcand = c;
575 branchruledata->lastcand = 0;
576 branchruledata->skipsize = 0;
577 branchruledata->skipup = NULL;
578 branchruledata->skipdown = NULL;
584 assert(branchrule != NULL);
enum SCIP_Result SCIP_RESULT
SCIP_BRANCHRULEDATA * SCIPbranchruleGetData(SCIP_BRANCHRULE *branchrule)
#define SCIPallocBlockMemoryArray(scip, ptr, num)
SCIP_RETCODE SCIPsetBranchruleExecPs(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHEXECPS((*branchexecps)))
#define BRANCHRULE_MAXBOUNDDIST
SCIP_Real SCIPgetCutoffbound(SCIP *scip)
SCIP_Real SCIPnodeGetLowerbound(SCIP_NODE *node)
static SCIP_DECL_BRANCHEXECPS(branchExecpsAllfullstrong)
#define BRANCHRULE_MAXDEPTH
SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
SCIP_Bool SCIPisGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
struct SCIP_BranchruleData SCIP_BRANCHRULEDATA
static SCIP_DECL_BRANCHINIT(branchInitAllfullstrong)
SCIP_RETCODE SCIPsetBranchruleFree(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHFREE((*branchfree)))
SCIP_RETCODE SCIPprintDisplayLine(SCIP *scip, FILE *file, SCIP_VERBLEVEL verblevel, SCIP_Bool endline)
SCIP_Real SCIPinfinity(SCIP *scip)
SCIP_RETCODE SCIPsetBranchruleCopy(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHCOPY((*branchcopy)))
enum SCIP_Retcode SCIP_RETCODE
SCIP_Real SCIPgetBranchScoreMultiple(SCIP *scip, SCIP_VAR *var, int nchildren, SCIP_Real *gains)
SCIP_BRANCHRULE * SCIPfindBranchrule(SCIP *scip, const char *name)
#define SCIPfreeBlockMemory(scip, ptr)
SCIP_RETCODE SCIPincludeBranchruleBasic(SCIP *scip, SCIP_BRANCHRULE **branchruleptr, const char *name, const char *desc, int priority, int maxdepth, SCIP_Real maxbounddist, SCIP_BRANCHRULEDATA *branchruledata)
#define SCIPduplicateBufferArray(scip, ptr, source, num)
SCIP_RETCODE SCIPchgVarLb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
#define SCIPfreeBufferArray(scip, ptr)
#define SCIPallocBlockMemory(scip, ptr)
SCIP_RETCODE SCIPincludeBranchruleAllfullstrong(SCIP *scip)
SCIP_Real SCIPfeasCeil(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPfeasFloor(SCIP *scip, SCIP_Real val)
SCIP_RETCODE SCIPsetBranchruleExecLp(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHEXECLP((*branchexeclp)))
SCIP_RETCODE SCIPupdateVarPseudocost(SCIP *scip, SCIP_VAR *var, SCIP_Real solvaldelta, SCIP_Real objdelta, SCIP_Real weight)
SCIP_Real SCIPgetBranchScore(SCIP *scip, SCIP_VAR *var, SCIP_Real downgain, SCIP_Real upgain)
SCIP_Bool SCIPisLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
static SCIP_DECL_BRANCHFREE(branchFreeAllfullstrong)
SCIP_RETCODE SCIPchgVarUb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
static SCIP_RETCODE branch(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_RESULT *result)
const char * SCIPvarGetName(SCIP_VAR *var)
SCIP_RETCODE SCIPgetVarStrongbranchInt(SCIP *scip, SCIP_VAR *var, int itlim, SCIP_Real *down, SCIP_Real *up, SCIP_Bool *downvalid, SCIP_Bool *upvalid, SCIP_Bool *downinf, SCIP_Bool *upinf, SCIP_Bool *downconflict, SCIP_Bool *upconflict, SCIP_Bool *lperror)
SCIP_Real SCIPvarGetLPSol(SCIP_VAR *var)
SCIP_RETCODE SCIPbranchVarVal(SCIP *scip, SCIP_VAR *var, SCIP_Real val, SCIP_NODE **downchild, SCIP_NODE **eqchild, SCIP_NODE **upchild)
static SCIP_DECL_BRANCHEXECLP(branchExeclpAllfullstrong)
void SCIPverbMessage(SCIP *scip, SCIP_VERBLEVEL msgverblevel, FILE *file, const char *formatstr,...)
SCIP_RETCODE SCIPgetPseudoBranchCands(SCIP *scip, SCIP_VAR ***pseudocands, int *npseudocands, int *npriopseudocands)
SCIP_Bool SCIPhasCurrentNodeLP(SCIP *scip)
SCIP_RETCODE SCIPstartStrongbranch(SCIP *scip, SCIP_Bool enablepropagation)
SCIP_LPSOLSTAT SCIPgetLPSolstat(SCIP *scip)
SCIP_Bool SCIPvarIsInLP(SCIP_VAR *var)
int SCIPgetDepth(SCIP *scip)
SCIP_RETCODE SCIPupdateNodeLowerbound(SCIP *scip, SCIP_NODE *node, SCIP_Real newbound)
void SCIPbranchruleSetData(SCIP_BRANCHRULE *branchrule, SCIP_BRANCHRULEDATA *branchruledata)
#define BRANCHRULE_PRIORITY
SCIP_RETCODE SCIPfixVar(SCIP *scip, SCIP_VAR *var, SCIP_Real fixedval, SCIP_Bool *infeasible, SCIP_Bool *fixed)
static SCIP_DECL_BRANCHCOPY(branchCopyAllfullstrong)
int SCIPgetNVars(SCIP *scip)
all variables full strong LP branching rule
SCIP_Real SCIPgetLPObjval(SCIP *scip)
SCIP_RETCODE SCIPendStrongbranch(SCIP *scip)
const char * SCIPbranchruleGetName(SCIP_BRANCHRULE *branchrule)
SCIP_RETCODE SCIPsetBranchruleInit(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHINIT((*branchinit)))
SCIP_Bool SCIPallColsInLP(SCIP *scip)
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
#define SCIPfreeBlockMemoryArrayNull(scip, ptr, num)
SCIP_Bool SCIPisFeasIntegral(SCIP *scip, SCIP_Real val)
#define BMSclearMemoryArray(ptr, num)
SCIP_RETCODE SCIPgetVarStrongbranchFrac(SCIP *scip, SCIP_VAR *var, int itlim, SCIP_Real *down, SCIP_Real *up, SCIP_Bool *downvalid, SCIP_Bool *upvalid, SCIP_Bool *downinf, SCIP_Bool *upinf, SCIP_Bool *downconflict, SCIP_Bool *upconflict, SCIP_Bool *lperror)
SCIP_RETCODE SCIPselectVarPseudoStrongBranching(SCIP *scip, SCIP_VAR **pseudocands, SCIP_Bool *skipdown, SCIP_Bool *skipup, int npseudocands, int npriopseudocands, int *bestpseudocand, SCIP_Real *bestdown, SCIP_Real *bestup, SCIP_Real *bestscore, SCIP_Bool *bestdownvalid, SCIP_Bool *bestupvalid, SCIP_Real *provedbound, SCIP_RESULT *result)
SCIP_Longint SCIPgetNNodes(SCIP *scip)
SCIP_Bool SCIPisExactSolve(SCIP *scip)