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);
123 allowaddcons, &bestpseudocand, &bestdown, &bestup, &bestscore, &bestdownvalid, &bestupvalid, &provedbound, result) );
133 assert(0 <= bestpseudocand && bestpseudocand < npseudocands);
134 assert(
SCIPisLT(scip, provedbound, cutoffbound));
136 var = pseudocands[bestpseudocand];
139 SCIPdebugMsg(scip,
" -> %d candidates, selected candidate %d: variable <%s>[%g,%g] (solval=%g, down=%g, up=%g, score=%g)\n",
141 bestdown, bestup, bestscore);
145 if( allcolsinlp && !exactsolve )
147 if( downchild !=
NULL )
152 if( eqchild !=
NULL )
157 if( upchild !=
NULL )
180 assert(branchrule !=
NULL);
215 branchruledata->lastcand = 0;
225 assert(result !=
NULL);
241 assert(result !=
NULL);
273 int npriopseudocands,
294 assert(scip !=
NULL);
295 assert(pseudocands !=
NULL);
296 assert(bestpseudocand !=
NULL);
297 assert(skipdown !=
NULL);
298 assert(skipup !=
NULL);
299 assert(bestdown !=
NULL);
300 assert(bestup !=
NULL);
301 assert(bestscore !=
NULL);
302 assert(bestdownvalid !=
NULL);
303 assert(bestupvalid !=
NULL);
304 assert(provedbound !=
NULL);
305 assert(result !=
NULL);
321 *bestdown = lpobjval;
323 *bestdownvalid =
TRUE;
326 *provedbound = lpobjval;
327 if( npseudocands > 1 )
351 assert(branchrule !=
NULL);
355 assert(branchruledata !=
NULL);
365 for( i = 0, c = branchruledata->lastcand; i < npseudocands; ++i, ++c )
367 c = c % npseudocands;
368 assert(pseudocands[c] !=
NULL);
377 SCIPdebugMsg(scip,
"applying strong branching on %s variable <%s>[%g,%g] with solution %g\n",
387 skipdown[c] ?
NULL : &down, skipup[c] ?
NULL : &up, &downvalid, &upvalid, &downinf, &upinf, &downconflict, &upconflict, &lperror) );
392 skipdown[c] ?
NULL : &down, skipup[c] ?
NULL : &up, &downvalid, &upvalid, &downinf, &upinf, &downconflict, &upconflict, &lperror) );
406 "(node %" SCIP_LONGINT_FORMAT
") error in strong branching call for variable <%s> with solution %g\n",
412 down =
MAX(down, lpobjval);
413 up =
MAX(up, lpobjval);
414 downgain = down - lpobjval;
415 upgain = up - lpobjval;
416 assert(!allcolsinlp || exactsolve || !downvalid || downinf ==
SCIPisGE(scip, down, cutoffbound));
417 assert(!allcolsinlp || exactsolve || !upvalid || upinf ==
SCIPisGE(scip, up, cutoffbound));
418 assert(downinf || !downconflict);
419 assert(upinf || !upconflict);
422 if( downinf || upinf )
431 if( allowaddcons && downinf == downconflict && upinf == upconflict )
436 else if( downinf && upinf )
448 SCIPdebugMsg(scip,
" -> integral variable <%s> is infeasible in both directions\n",
456 SCIPdebugMsg(scip,
" -> fractional variable <%s> is infeasible in both directions\n",
491 else if( allcolsinlp && !exactsolve && downvalid && upvalid )
496 minbound =
MIN(down, up);
497 *provedbound =
MAX(*provedbound, minbound);
501 if( c < npriopseudocands )
529 if( score > *bestscore )
534 *bestdownvalid = downvalid;
535 *bestupvalid = upvalid;
548 solval-
SCIPfeasCeil(scip, solval-1.0), downgain, 1.0) );
556 SCIPdebugMsg(scip,
" -> var <%s> (solval=%g, downgain=%g, upgain=%g, score=%g) -- best: <%s> (%g)\n",
562 branchruledata->lastcand = c;
581 branchruledata->lastcand = 0;
582 branchruledata->skipsize = 0;
583 branchruledata->skipup =
NULL;
584 branchruledata->skipdown =
NULL;
590 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)
SCIP_RETCODE SCIPchgVarLb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
#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)
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)
SCIP_RETCODE SCIPselectVarPseudoStrongBranching(SCIP *scip, SCIP_VAR **pseudocands, SCIP_Bool *skipdown, SCIP_Bool *skipup, int npseudocands, int npriopseudocands, SCIP_Bool allowaddcons, int *bestpseudocand, SCIP_Real *bestdown, SCIP_Real *bestup, SCIP_Real *bestscore, SCIP_Bool *bestdownvalid, SCIP_Bool *bestupvalid, SCIP_Real *provedbound, SCIP_RESULT *result)
#define BRANCHRULE_PRIORITY
SCIP_RETCODE SCIPfixVar(SCIP *scip, SCIP_VAR *var, SCIP_Real fixedval, SCIP_Bool *infeasible, SCIP_Bool *fixed)
static SCIP_RETCODE branch(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_Bool allowaddcons, SCIP_RESULT *result)
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_Longint SCIPgetNNodes(SCIP *scip)
SCIP_Bool SCIPisExactSolve(SCIP *scip)